Most of the data displayed in the repeating group come from data set “Security Master”, hence I’ve configured the “Type of content” of the repeating group to "Security. However, I do have the “Risk Rating” coming from a different data set called “Product Risk Profile”. Both data sets have a shared data object called “FundKernel_ID”.
Now, I want to create a sort the reporting group based on Risk Rating but I can’t seem to get it correct. Here’s what I’ve done…
First, I’ve set a condition for the repeating group for when the drop down value is Risk Rating and do a Data Source search for Securities Master. A constraint is set up to make sure the product listed are “Active”. So far, so good.
But that doesn’t really sort the Risk Rating. So I thought I would add another constraint that would associate the Security Master with the Risk Rating by identifying their “FundKernel_ID” data object. When I tried to do that, it gave me an error.
If you hover over the expression it will tell you to what it’s evaluating. The constraint FundKernel_ID = needs to evaluate to 1 single FundKernel_ID
The expression search for ProductRiskProfile's FundKernel_ID:first item is probably evaluating to a list of FundKernel_IDs. Because the first part of your search is evaluating to a list of ProductRiskProfiles. You probably need a :first item after the first expression.
In any case, I don’t think that’s what you’re trying to accomplish.
My rough guess on the sorting is that you could achieve it by adding a :sorted to the end of the expression. But that will do the sorting on the client side. If your search returns a lot of items (~>200) it might slow down the user’s browser.
Could you add the sort field to the data type? That way you could select it from the Sort by on the search.
The expression search for ProductRiskProfile's FundKernel_ID:first item is probably evaluating to a list of FundKernel_IDs. Because the first part of your search is evaluating to a list of ProductRiskProfiles . You probably need a :first item after the first expression.
I get what you’re saying and I’ve tried that and the error persists.
Could you add the sort field to the data type? That way you could select it from the Sort by on the search.
That is an option I’ve considered. But I will also want to sort and filter other items that are in other data types, and just thought that could make managing the data more complicated.
I guess my bottomline question is…is it possible to have a sort function based on a data object that does not belong to the data type of the repeating group?
In the meantime, here’s a bad idea what if your base search is the sorting one? Meaning: you search & sort per FundKernel_ID and somehow string together the ProductRiskProfile list on that?
Maybe that equal signs needs to be is in instead. Here’s one of my app’s search expression, I’m wondering if this could be of any help:
Thank you very much for the suggestion. I will give it a try.
I also discovered another problem while experimenting with this. This could be a limitation of Bubble. Would be great to get some people inside for feedback.
Apparently, you can’t sort a data object if the content of the object comes from an Option Set. I’ve tried several times. I guess that’s because when I first originally set up the data object in the data type, I didn’t define it as Text or Number.
I don’t suppose there is a way to convert that? the 'Display" option doesn’t do it.
I’m not familiar with that function, and I can’t seem to find it in the Bubble Manual.
Would you care to give me a quick walk through on how to use List Shifter?
Having said that, I have found another thread in the forum where they admit that indeed current Bubble doesn’t have support for sorting data objects with Option Set: How to solve for a "dynamic" Option Set
Did ListShifter help? I’m also struggling with this problem. It can’t be just us. This is a VERY normal database function.
In normal database applications, you run a query which merges all the data together into a sort of temporary table and then you display it to the user. While compiling the query, you can sort it or filter it. I feel like Bubble is doing this ‘query’ function directly inside the repeating group and therefore the filtering/sorting is limited.
I’m sorry to say that I haven’t invested much time into this problem since I think this one can get a bit complicated. So I’m focusing my time on completing the more basic element of my app first.