Default Sort in Link records

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:

Parents
  • What version of HP Service Manager are you running?

  • Verified Answer

    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.

  • Verified Answer

    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.

  • Verified Answer

    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.

Reply Children
No Data