Our new Community environment is going to be launched soon!
This means that you will be redirected to the new environment automatically, where you can sign-in, look up - and post topics again. Please note that not all topics will be transferred, so it might occur that you can’t find the topic you were looking for.
I'm trying to populate and deduplicate a collection at an action event. The collection is populated using an other collection with a has many relation to an a second model with a belongs to, to a third collection.
See the image below of how I've tried to accomplish this and the results.
When encapsulating the expression in the uniq() function, the results are the same.
Any idea how the deduplicate the result?
BTW: The last approach results in a collection, in a collection (var:main_collection). Like this:
After creating an extra collection variable and use var:main_collection[0] in the expression, you can use this in a template and use the uniq filter of Liquid, you do get the desired result. Like this:
But for performance reasons and in cases you are not using a template/Liquid, I like to know an approach for just in Betty.
Hey all,
I'm trying to populate and deduplicate a collection at an action event. The collection is populated using an other collection with a has many relation to an a second model with a belongs to, to a third collection.
See the image below of how I've tried to accomplish this and the results.
When encapsulating the expression in the uniq() function, the results are the same.
Any idea how the deduplicate the result?
BTW: The last approach results in a collection, in a collection (var:main_collection). Like this:
After creating an extra collection variable and use var:main_collection[0] in the expression, you can use this in a template and use the uniq filter of Liquid, you do get the desired result. Like this:
But for performance reasons and in cases you are not using a template/Liquid, I like to know an approach for just in Betty.
Login to reply