23
Views
22
Comments
Solved
Show multiple value in expression widget

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 . 

Rank: #68
Solution

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

TextListToCSV.oml

Rank: #68

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.


Cheers,

João

Rank: #68

Hi,


It is a Text List, if you name the variable TextList, Service Studio should be able to understand the data type you want.


Cheers,

João

Champion
Rank: #134

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

Thanks

Rank: #68

Hi Amit,


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.


Cheers,

João

Rank: #68

Hi riesta,


I'm sending you an OML in attachment, with an example and you can see the client action for yourself.


Hope it helps.


Cheers,

João

TextListToCSV.oml

Rank: #68
Solution

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

TextListToCSV.oml

mvp_badge
MVP
Rank: #72

 Hi Riesta,

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

Rank: #94

Hi Riesta,

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

Rank: #68

Hi Riesta,


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,

João

Rank: #68

Hi Riesta,


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.


Hope it helps.


Cheers,

João

Test.oml

Rank: #68

Hi Riesta,


I'm glad I could help :)


Cheers,

João