Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..
960 views

Default Sort in Link records

Jump to solution

HI,

I have a field in change form, that is linked to Location table. When i click the fill button, i want the data to be sorted alphabetically by default. Could someone provide me the steps to achieve this.

Thanks in advance

Regards,

Nagarjun S

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Default Sort in Link records

Jump to solution

By default, the system always sorts the records by the first key in that table's dbdict record.  In the case of the Location table, that's the 'location' field.  So it should already be sorting by that value.  But, if you're looking for it to sort on some other field (like 'location.code' or 'location,name'), there's an OOB feature that is SUPPOSED to work, but I'm not sure how well.  If this OOB method doesn't work, there's another way to do it.

The OOB is pretty straightforward.  In the Link record, in the Link Line (where you have the opportunity to set the Source Field/Target Field array) there's a dropdown Sort Field and Sort Order for the Target.  The way this is SUPPOSED to work is, when the user clicks Fill, the system will sort according to the Sort Field described.

So modify the Link record where you're calling this Fill, select the Link Line for the location fill and set the Sort Field to whatever field ('location.name' for example) and the Sort Order to Ascending

But, I haven't actually ever seen it work.  But, I've always worked with systems that were upgraded from previous versions, so I always assumed there was some leftover bug in RAD code somewhere that prevented that feature from working.

However, there is another way to accomplish it.

When you use the Fill function, the system displays the results using the displayscreen us.fill.qbe.  You can override some settings in the way the records get displayed by modifying the displayscreen record itself using the setsort() function

Type "ds" in the command prompt to bring up the Display Screen records.  Search for the record us.fill.qbe

Then, set some condition under which the system should use the code to sort.  You mentioned a Fill for location values, so you could have something like:

if (filename($L.target)="location") then ($L.void=setsort($L.target, {"location.name"}, 0)))

With this code, whenever anyone clicks on ANY link, the system will evaluate this expression.  If the table being filled from is Location, the system will sort the resulting records by the 'location.name' field.

View solution in original post

0 Likes
4 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Default Sort in Link records

Jump to solution

What version of HP Service Manager are you running?

0 Likes
Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

Re: Default Sort in Link records

Jump to solution

I am using SM 9.30

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Default Sort in Link records

Jump to solution

By default, the system always sorts the records by the first key in that table's dbdict record.  In the case of the Location table, that's the 'location' field.  So it should already be sorting by that value.  But, if you're looking for it to sort on some other field (like 'location.code' or 'location,name'), there's an OOB feature that is SUPPOSED to work, but I'm not sure how well.  If this OOB method doesn't work, there's another way to do it.

The OOB is pretty straightforward.  In the Link record, in the Link Line (where you have the opportunity to set the Source Field/Target Field array) there's a dropdown Sort Field and Sort Order for the Target.  The way this is SUPPOSED to work is, when the user clicks Fill, the system will sort according to the Sort Field described.

So modify the Link record where you're calling this Fill, select the Link Line for the location fill and set the Sort Field to whatever field ('location.name' for example) and the Sort Order to Ascending

But, I haven't actually ever seen it work.  But, I've always worked with systems that were upgraded from previous versions, so I always assumed there was some leftover bug in RAD code somewhere that prevented that feature from working.

However, there is another way to accomplish it.

When you use the Fill function, the system displays the results using the displayscreen us.fill.qbe.  You can override some settings in the way the records get displayed by modifying the displayscreen record itself using the setsort() function

Type "ds" in the command prompt to bring up the Display Screen records.  Search for the record us.fill.qbe

Then, set some condition under which the system should use the code to sort.  You mentioned a Fill for location values, so you could have something like:

if (filename($L.target)="location") then ($L.void=setsort($L.target, {"location.name"}, 0)))

With this code, whenever anyone clicks on ANY link, the system will evaluate this expression.  If the table being filled from is Location, the system will sort the resulting records by the 'location.name' field.

View solution in original post

0 Likes
Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

Re: Default Sort in Link records

Jump to solution

Thanks Jacob, It worked.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.