Hello, I wanna ask, how to show a multiple value in 1 expression widget?
so, I have a genre movie list such as horror, thriller, romance, action. and we can choose that more than 1. so, for example I choose horror and thriller. after that, I want to show the genre that I choose in one expression widget. so, the output will be like horror,thriller .
Hi riesta,
Are you sure you have this assign correct and you are passing the correct list?
In my example, I put Horror and Drama on the list and I can see them both (see here).
Cheers,
João
João Marques wrote:
Hi Joao,
I already do triple check, and I already do the same with yours. the assign and the passing it's already correct. But the value is only "Horror, "
If in List append I make hardcode in the element, it's work. but if I take the attribute from the aggregate, i can't.
-Riesta
Thanks
Hi Riesta,
You can create a client action that receives a text list and returns a comma separated text. Like this:
Then on your expression, you just have to use the function, like this:
Hope it helps.
I wanna ask again, what is the data type for the input parameter (textList)? is it text or text structure list?
Thank you
Hi,
It is a Text List, if you name the variable TextList, Service Studio should be able to understand the data type you want.
when I want to make CSV+TextList.current+"," in assign for CSV in loop for each cycle, why there is an error? the error is "can not apply "+" operator to "Text" together with "text structure".
Hi riesta kristianti tannia,
My suggestion is no need to loop the record just use String_Join funtion pass the list and get the value as comma separated.
Please refer below snapshot :
- AV
Amit Verma wrote:
Hi Amit,
If I already make it in server action, and should I make it into function? if no, how can I use it in expression widget?
Your suggestion is a server-side action, it would be ideal for Traditional Web or server logic, but you won't be able to use it as a function in an expression in Reactive or Mobile application and it would be preferable to do this on the client side than on the server side, if it is a Reactive or Mobile application.
I'm sending you an OML in attachment, with an example and you can see the client action for yourself.
I've already following like in your OML, but it's still doesn't work. the output only "horror, ".
You could also copy/paste the String_Join function from this Forge component (which is for Mobile) into your Reactive module. It does the same thing as Joao showed you, only now you don’t have to build it yourself. These text utils are all client actions which you could directly use on your screen.
You could also convert the Mobile module into a Reactive module first. Just open the Text Utils module and then open the Module menu >> select Convert >> Convert to Reactive Module and publish it.
Now you can add the String_Join client action as a dependency to your module and use it directly inside an Expression like this:
String_Join(TextList, “,”)
Hope this helps.
Regards,
Nordin
Nordin Ahdi wrote:
Hi Nordin,
Can you give me an example how to use string_Join() ? because I've tried it, and the problem is always in the first parameter. i;m confused how to use the first parameter. in the first parameter, should I make the local variabel and the data type is record list or the data type is list ? or actually I can use the aggregate for the first parameter?
The first parameter (for solution given above) is a Text List.
Here's an example of its Data Type:
You should use this variable to build your own List of the Texts that you want to join.
This should be the variable that you use for String_Join action.
Kind regards,
Rui Barradas
Rui Barradas wrote:
Hi Rui Barradas,
I've tried it use data type Text List in the local variabel. but, i can't work for the action string_join() or in the expression widget when I want use string_Join() as a function.
Can you share your OML so we can better help you?
It does not make sense the same code works on one place and not on the other.
Thanks,
this is the OML. You can see it in the showMultipleValue screen for the screen where I put the expression widget.
When you are adding to the table TextList, you were using ListAppend which only appends one element.
Instead, you should use ListAppendAll which allows you to append a list to another list:
The OML goes in attachment.
wow.. it's work. Thank you very much
I'm glad I could help :)