Hi,
I have a RichTextDisplayField within which I have a RichTextIcon which has to be executed in loop and I want the icon should be printed only once on updated with last item in the loop.
a!richTextDisplayField( label: "Sample", labelPosition: "COLLAPSED", value: a!localVariables( local!reconds: rule!Record_Rule(), local!time : fv!item.Time, a!forEach( items: local!reconds, expression: a!richTextIcon( icon: "times", caption: fv!item.type & if(not(rule!APN_isEmpty(fv!item.comment)), " : " & fv!item.comment,""), showWhen: and( totime(tostring(text(fv!item.starttime,"hh:mm aa"))) <= totime(local!time), totime(tostring(text(fv!item.endtime,"hh:mm aa"))) >= totime(local!time) ), color: if( fv!item.type = "Busy", "#800000", if( fv!item.type = "Occupied", "#3DD80B", if( fv!item.type = "Off", "#0000FF", "#000000" ) ) ), size: "STANDARD" ) ) ), align: "CENTER" )
Current display :
Expected Display :
Please help me on this
Discussion posts and replies are publicly visible
What is the point of executing a loop for your richTextIcon? If you're really querying a new value of local!reconds for every row of your grid, you could simply pull the last item in that array (when applicable) and use that value for a single richTextIcon delcaration.
Yeah if you are using this in a grid, it would be useful to paste the code of the full grid. Also, when using a grid you should always use fv!row to reference each item in the row instead of looping across a local variable.