Sorting fields when using Do a Search :Merge With and :Sort

I’ve created a drop down list that presents Users with a list of product sizes. This can be used to add default sizes to the products they create in my app (S, M, L, XL etc) but they can also add sizes that they create that are specific to their own products (eg Huge, Tiny, Microscopic).

I log the sizes in a tblSizes in the database. The dropdown needs to show sizes that

A) Product Name is “Add New Item” (this allows them to create more custom sizes)
B) Haven’t been deleted
C) Have been created by the current user OR are default sizes

I can achieve all this but I want the resulting dropdown choices to be sorted the field by tblSizeName so it’s easier to find them. If I use :Sorted it will sort it but it will include Add New Item in the sort which always needs to be top of the list. When I use the parentheses to Sort only B and C, the sort doesn’t work. It looks like this…

Screenshot 2024-01-15 120053

I guess I could create a numeric “ID” field to sort by but I understand there isn’t an incremental numeric field option and this isn’t a recommended method

Can anyone tell my how I might go about this?

It looks as though your sort is only being applied to the last search, not the combined searches of B and C.

You’ve got:

image

When what you need is:

image

Use the new expression builder for more control.

1 Like

Many thanks for this Adam. How do I edit the parentheses using this new expression builder. I’ve had it installed a while now but I don’t use it because I can’t get on with it. I can see that it’s the answer to this conundrum today though.

You just have to click the correct ‘more’ button (in this case by clicking between the last and second last closing parenthesis).

I’m obviously doing something wrong. All it does is insert uneditable parentheses that cannot be changed at any point in the expression other than by adding them at the end. That in turn causes the expression not to work. Is there any documentation for this thing? I can’t find any.
Even trying to close down the search constraints box takes 5 attempts as it just springs back open. I assume it’s something I’m doing but no idea what. Can’t say I’m a fan of this thing though.