Repeated works for Formula but not for Page variable

I am trying to extract distinct values from a dataset for a particular attribute.

Input:
[
{“id”:“1”, “cat_manufacturer”: “abc”, “cat_software”: “mysoftware1”},
{“id”:“2”, “cat_manufacturer”: “efg”, “cat_software”: “mysoftware2”},
{“id”:“3”, “cat_manufacturer”: “abc”, “cat_software”: “mysoftware3”},
{“id”:“4”, “cat_manufacturer”: “efg”, “cat_software”: “mysoftware4”},
{“id”:“5”, “cat_manufacturer”: “abc”, “cat_software”: “mysoftware5”},
{“id”:“6”, “cat_manufacturer”: “xyz”, “cat_software”: “mysoftware6”},
]

Result:
[
{“cat_manufacturer”: “abc”},
{“cat_manufacturer”: “efg”},
{“cat_manufacturer”: “xyz”}
]

Method 1:

I use a list item and repeat it with formula:

MAP(UNIQUE_BY_KEY(data.myDataListOfObjects, “cat_manufacturer”), {value:item.cat_manufacturer})

and set the primary label as “value”. It works !!

Method 2:

I apply same formula to set a page variable. And then try to repeat the list item with page variable and set primary label as current.value.

The first method works but the second method does not work. Can anybody explain why?

Also, I need to change the list item properties on search event which I can’t do if I use method 1 to repeat formula for list item.

Thank you.

UNIQIE_BY_KEY() returns you only one single item from each category. Instead of that please try using the “GROUP()” formula as suggested in the other thread. And there is no real need to duplicate a thread…

@Mihaly_Toth Thank you for the reply. I appreciate your help. I tried both GROUP() and UNIQUE_BY_KEYS() as repeat for List item entering it as a formula.

But when I try to set a page variable using the formula GROUP() OR UNIQUE_BY_KEYS() and then repeat the list item with the page variable it is not working.

Did you make sure that your page variable has the required schema? I mean a list of objects and each property has the same name and type as it should be having?

@Mihaly_Toth Yes. I did ensure I create a list of objects having identical property name and type. It shows no issues with the formula. The result is expression: list of objects with required property. The page variable just doesn’t set. When I try to alert the page var to see the output it shows null.