How to use order by with constraints
Hi,
Say, I have two tables (T1 and T2) table T1 has a reference field Ref1 (from table T2). I have successfully been able to implement constraints in the reference field to only show selective records, however I am not able to make it out how to use "order by" inside the constraint. I want the filtered records (from table T2) to be sorted by Name and shown on the reference field on the T1 form.
9 replies
-
Hello Vermaji,
The order by clause cannot be used directly in a constraint for a reference field for the purpose you want to achieve because the constraint is only used to filter the records that should be displayed in the reference field's selection list.
So, order by
Once the desired records are displayed in the reference field selection window, simply click on the column you want to sort by (e.g., Name
)
and choose ascending or descending order directly from the interface. This way, the constraint filters the records, and the user has full control over the sorting without the need for additional code.Just make sure that when setting up the sorting, you are in admin mode (wrench icon enabled).
Fabio
-
Hi.
is correct! In edit mode, you can set the default sorting and column arrangement for the reference field selection window, and it should be saved for future use.
After that, when the user opens the selection window, they will see the default sorting (the one set while in admin mode). They can temporarily change it in that view, but upon the next access, the sorting will reset to the one set by the admin.
-
and I understand what you mean and yes it did save the changes I made in admin mode. But I want to know that is there a way we can sort the records through script dynamically instead of doing it manually using the admin mode ??
-
Thank you all for helping me out.
Content aside
- Status Answered
- yesterdayLast active
- 9Replies
- 34Views
-
4
Following