(SOLVED) About global attributes, iteration or string operations

(Ernesto) #1

I want to share my problem here, just in case someone could help.

Consider this situation: each user can choose number 1 or number 2, which will be then saved in their attribute my_number. In certain flow, I need to lists (for example) the user_ID of the users who have chose number 2. User can change their choose anytime.

I though several ways to solve that situation:

  1. Iterate over each users and get their my_number attribute; if its value is 2 then get the user_ID. I currently do not know how to make such iteration. Anyway, it seems not the more good solution.

  2. Use a global attribute (as explained on Global variables) named users_number2. Then, when a user choose number 2, add its user_ID to that global attribute. This way users_number2 will contain all users IDs of users that have chosen number 2.

I do not know yet the right way to make the addition. I think that we can only use a string as a value of an attribute, right? So, we can append the user_ID values to users_number2, and have something like:
“user1_ID, user6_ID, user3_ID”.

But here I have this concern: how can we make other changes or operations here, based on the current value of users_number2? For example to get each user_ID separately, or to delete a particular user_ID value (because that user changed to number 1 choice).

I’m stuck on this and trying to figure out how to solve it. Thank you in advance for any help or indication.

(Ernesto) #2

It seems that solution is using Code service (https://support.flowxo.com/article/145-code)…