Hi Team,
users: "username1; {username1; username2}" =>type text
how to get the output as 2 items
username1
{username1; username2}
Discussion posts and replies are publicly visible
Yes, Mike Schmittand Mathieu Drouin
I have rule inputs that passes the current user list,
eg: username1 or {username1; username2} or combination username1; {username1; username2}
Ideally, is there a way to append a string with ","
Let's say, I have a string of type text string, now if I want to {"txt1","txt2","text3"}. How to do that?
Purvaja said:rule inputs that passes the current user list,
Can you provide some more detail on this? What format(s) are the rule input(s)? In what way is it/they assigned the "current user list"? What are you trying to achieve overall?
To be very clear,
I have a local variable list-> which stores the values of the pickerFieldUsers, it can be single user or multiple user values.
These values are passed to rule to get the desired output like this
{"txt1","txt2","text3"}
Well the thing there is - a!pickerFieldUsers() will store an array of users - there should be no need to ever manually parse it via splitting a semicolon-delineated flat string.
but when I write to DB, it is writing with ";" but I want to write it with ","
I would recommend against storing an array as a flat string like this. If you really need to, then I'd suggest you create a JSON string via a!toJson(), since the resulting JSON string will be able to be parsed back into an array later simply by using a!fromJson().
and also, can you please help me to debug this logic. Instead of replacing ";" with "," it is removing the text
This rule is confusing together the separate elements of array data and flat text data in several different places and several different ways - until you understand the difference and code to this, the output you see will consistently be unexpected and confusing. I'm not even clear what you're trying to do.
Here, we are trying to find the index of ";" and replace with ","
joinArray( ri!userList, ",")