I want to sort list by using dynamic value

I don’t have a field for sorting. I need to sort by using dynamic value. Can anyone help me with that?


I want to sort out a repeating group using the user’s full name(a-z). but after the apply this method. It’s sorted according to date

Hi there,

Can you try removing the sort by dynamic field, on the search for part at the start you should be able to select to sort by the name? “full_name” in your case.

image

acutely @Oliver-wholegraintech, I don’t have a field for sorting that`s why I am using a


dynamic field

What type of field is full name?

full name is a user data type. but in the repeating group, I have different types of data.

1 Like

Oh that makes sense.

And so when the conditional rule is active, and it should be sorting by name, it’s just sorting by the date created?

yes @Oliver-wholegraintech

Just to rule any other factors out, I would suggest using the debugger and when the rg should be in that conditional rule, check the data source and make sure it is working properly?

in debugger, it`s showing error,(The dynamic sort field is not recognized as a field on the type Team-Member)

I’m pretty sure that’s because the field isn’t on your the object you’re filtering.

So you will need to add the user name to the team member, or search for a list of users, sort by name, and display their team member object etc sorry

I would love to go through on your app, to see whats happen and probably give a fix. its okey with you to share your editor only view .

You might be misinterpreting how sorting by ‘Dynamic field name’ works

Dynamic field allows you to sort by different fields depending on user selection. IE if a user chooses to sort by last name, you can dynamically input the name of the field for ‘last name’, but if they want to sort by date of birth, occupation, etc… the dyanamic field name allows you to dynamically change the sorting without having to list out all the different sortings in condtionals.
The dynamic expression needs to output the name of a field of your RG’s dataType, it definitely cannot result in a list of names.

As @Oliver-wholegraintech said, either add a name field to the Team Member dataType, or run a search for users instead of teammembers, so you can sort by their name.

Do you have a field on your User which stores the Team-member entries associated to them?

1 Like

yes I have a field on User which stores the Team-member entries associated with them

Ok, so to summarise:

Option A:
Add a redundant field on the team member dataType that stores the users’ name. This would allow you to simply sort by this new field. You could populate this new field on existing data by using either a recursive backend workflow or using a single backend workflow and the ‘Bulk’ functionality on the data tab. To keep the Name on the two tables synched you could use a trigger backend workflow that triggers when User before Name is not User now name.

Option B:
(i’ll list this here for completeness, but this is not an optimal approach)

Use the following dynamic expression in the conditional:
Search for Team-Members (Constrained how you'd like):filtered: each item's user: sorted by Full Name: each item's Team Member: filtered (add the same contraints you added previously)
or something along these lines.

As you can tell the above expression is quite inefficient (it will work very well with low volumes of data, but will start slowing down if there is a lot of data), and in this particular case and it might not work because of privacy rules if the User’s Team Member field is not public.

You could tweak your privacy rules (let users see the team-member list field, but secure the data in the team member table) to make it work, however i would personally just go for option A.

`

2 Likes