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
Please clarify what you mean by "get the output" - what is this referring to? What are you trying to do?
From this text "username1; {username1; username2}", how can we split based on ";"
Is there a way to split the words using functions in Appain?
Yes you can use the split function but not sure if that will help you do what you want to do.
docs.appian.com/.../fnc_text_split.html
split function is not diving desired result
Mike Schmitt and Mathieu Drouin can you suggest any alternative approach?
That's what I said :)
Problem is you have the same delimiter in both places. That's why Mike was asking where this string was coming from because maybe there is a better way to do this.
Purvaja said:can you suggest any alternative approach?
Is this literal string the only thing you will ever need to handle? Or are there potential variations? This is why I was asking what the source for this string is - if we don't know what cases you'll need to handle, it's nearly impossible to give a meaningful solution.
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, ",")