Can anyone help me to display a list of values one below the other without any , or ; at the end in an expression rule? I have tried using char(10), char(13), concat function with <br> but none works.
Discussion posts and replies are publicly visible
Please share the details of where do you want to display the list values.
If it is in a paragraph field then the below code works:
a!paragraphField( value : if(isnull(ri!input_text),ri!a,joinarray(ri!input_text,char(10))), readOnly: false(), saveInto : a!save(ri!input_text,if(isnull(save!value),save!value,split(save!value,";"))) ),
The variable input_text is of multiple type text rule input. When the data is entered in the paragraph field separated by ';' delimiter then the data in the paragraph field gets displayed line by line.
Thanks for your response.
I wanted to display a list of values one below the other in an email using expression rule and it worked using the below code.
striphtml(a!forEach(items: ri!input,
expression: concat(fv!item,"<br>"))).
Try this, without loop
joinarray(ri!input,"<br>")
joinarray( index( ri!employees, where( a!forEach( ri!employees, not(isnull( fv!item )) ) ), {} ), char( 10 ))
Input:
{"ABC","XYZ","","PQR"}
Output:
"ABC
XYZ
PQR"
Vinay's code above should be sufficient. I would also like to point out that if you wrap the whole thing in stripHtml like in your original example here, the <br> tags will still be lost as stripHtml just gets rid of them. If the value of ri!input would need to have stripHtml run on it for sanitization reasons / etc, then it should go inside your forEach expression.
Following are 2 alternative examples that take care of this, the main difference being where and how the "<br/>" tag is added.
concat( a!forEach( items: ri!input, expression: stripHtml(fv!item) & if(fv!isLast, null(), "<br/>") ) ) /* or, alternatively */ joinArray( a!forEach( items: ri!input, expression: stripHtml(fv!item) ), "<br/>" )