Sort A Repeating Group By User

My mind is going blank on this…

I have a repeating group that lists all the products.

But, I want the current user’s products that they’ve created to show first.

In the data type there is a built-in field for ‘creator’, but I can’t pull that up as a constraint.

Can someone help me figure this out?

You just need to merge two searches for your RG datasource.

Search for Products created by Current User merged with Search for products not created by the current user.

1 Like

I think you can create two repeating groups on top of eachother. Top one might show the ones current user created, and the bottom one shows the rest.

1 Like

I considered that…

but, I thought there had to be an easier way to just sort one repeating group.

Interesting.

I’ll try that also and let you know if that worked for me.

Natively, you cannot sort by fields that are objects, only basic types like date, text, number.

For approaches using objects you can use nested sorting through plugins like List Shifter.

But in your case you could just generate a merged list, of the current user + other users like @adamhholmes suggested.

1 Like

Thank you.

I was wondering if I could just add another data type ‘creator’ and attach it to user then sort by that?

I would then have 2 ‘creators’ but one I could sort by?

I know what you mean, but even doing this will not be possible since Creator is a built-in reference to the User itself (that created the given record), so it is an object.

1 Like

Ok. But I’m saying what if I add a second ‘creator’ that isn’t built in?

Will be the same, you can test it, just create another field as User type and try to find this one in the sort options.

The problem is not the built-in (Creation Date is a built-in and you have access since it is a date), but with object fields.

You could use a text field to maybe store the User’s Name, but well… this was not the more efficient route and you will need to update this when the name in User Datatype was updated.

1 Like

Ohhh, ok, I see what you’re saying

I also considered using a custom state, but thought there should be an easier way.

I’m not sure exactly how that would be done.

Can you give more details?

You can only sort by sortable field types: primarily that means Dates, Numbers, Texts.

You can’t sort by another datatype (nor by any values from fields on connected datatypes)

I’m not sure exactly how that would be done.

Can you give more details?

Just do a search for Products where Created by = Current User

merged with

A search for Products where Created by <> Current User

Just do that directly in the Datasource of the RG

1 Like

I’m a little slow about this…

I don’t understand what you mean ‘merge’ with?

I did a constraint for 'created by = current user…

but I don’t know what to put in for ‘merge with’

:merged with is a Bubble list operator.

Just select it from the options in the expression dropdown:

2 Likes

You’re awesome!

1 Like