I am trying to figure out the logic for merging 3 searches and sorting the final merge. Currently if i sort on the last search in the merge it only sorts that search. If I sort individually it sorts the items individually but not on the whole.
Does anyone know how to run a sort on multiple search merges?
I believe you would do your first search, then merge the second and then merge the thirdā¦after that dynamic expression is completed you would do āadd moreā and select :sorted
Weirdly, I donāt think thatās right. Putting the sort at the end only seems to sort the last mini-list in the merge, not the entire mega-list. @zachenson did you ever figure this out?
Iām trying to merge two lists for a workaround for āorā-logic filtering a mildly complicated RG. You cannot do ListA:filtered mergedwith ListB:filtered because Bubble reads it as (ListA:filtered mergedwith ListB):filtered.
I thought I found a solution by using workflows to store the filtered Lists A and B in separate states. I then set the data source on the RG to StateA mergedwith StateB:sorted, assuming that Sort would behave the same way as Filter and apply to the final merged list. Nope! Bubble seems to treat them differently, so Iām stuck with (StateA) merged with (StateB:sorted).
I assume Iām missing something obvious because itās very strange that Sort and Filter would have such different logic.
So I played with some different conditions and it would sort the entire list when the list was relatively short, like 10 items. But when the list got long, it wouldnāt. Maybe itās performing the sort a certain amount of time after the merge, so maybe the merge hasnāt finished when the sort starts on longer lists? Maybe itās more about when the repeating group starts loading its list? Maybe itās just that long lists are more prone to issues. I donāt know. I ended up finding another way using states, but I appreciate the reply.
I used subtraction instead of addition. In my case, I could create a List C filter, which was the things that were meant to be excluded by my original List A and B filters. I stored List C as a state on the RG whenever the dropdown I used to choose the filtering options was changed. Then a conditional on the RG changed the data source based on the dropdownās value. The data source became: āFull List:sorted minus RGās List C stateā. Since the full list was already sorted the way I wanted, the subtraction just removed pieces while preserving the same order.
All of this was to solve another common RG frustration in the forums: you canāt sort a list of things based on another thingās attribute. Iām building a quiz app and I create Student Answer things that store Answer Key things so that I can edit answer keys without needing to copy all of the new info into every single student answer of that question. I wanted to sort a list of Student Answers by the attached Keyās section number, then question number. Huge PITA. Ended up just putting the question and section numbers on the Student Answer and letting any mismatches be tomorrowās problem.
@nakano_satoko, if you are asking about the parentheses feature, it is an experimental feature that you can enable by going to the Settings >> Versions tab and checking the box beside Expression parentheses.