I hate saying this, but here goes … In Filemaker, it was possible to do a sort order based on a value list.
I have a situation where I need to sort the foundset based on the order of a valuelist associated with the field. How can I do this in Servoy?
I believe that in a SQL query you can order the records retrieved using an alternate sort order of some kind. One problem though, is that this may not be back-end agnostic (if that matters). If you search the web for “SQL custom sort” or “SQL alternate sort” there is lots of info.
However, I find it preferable to maintain all value lists as user (or admin-user) maintainable data in back-end tables. And for custom-sorted VLs I just include a sortorder field. For displaying the VL in the proper order, in the Define Valuelist window, choose categoryname (or whatever is the field that actually populates the VL) and define the Sort for the VL to go by sortorder. (Hey, there are actually many many plusses to Servoy’s Value List features, over FMP!)
To sort your record by the custom sort … say you wish to sort a list of products by category, using the custom sort order established in a “sortorder” column in the categories table.
– Define a relationship from products to categories based on category_id (or whatever is the PK in categories)
– Sort the records by products_to_categories.sortorder