How can I cause an expression to be repeated n number of times?
Question
Application Type
Reactive

Hi there.

I know the title sounds kinda weird. Let me try to explain my problem a bit better:

I have an Expression widget. The expression I want to show here is the asterisk symbol (*) repeated x times. In this case, there's an Integer local variable inside the screen that specifies how many times this asterisk symbol should appear inside the expression.

I thought I could get around this like this:

"*" * AsteriskTimes

However, I (obviously) can't use the * operator with text and numbers.

So, in what other way could I solve this? Any help would be appreciated :)

Hello @Yizuhi Galaviz,

Please review attached oml.

Regards

AJ

DemoRepeatExpression.oml

Hi Yizuhi,

Hope you are doing good!

Please find attached the OML to display * n number of times. Kindly review this and let me know, if you need any other help.

Thanks & Kind Regards,

Sachin

DisplayStar.oml

Hi Yizuhi, 

You can use an icon from the OutSystems icon widget, use a web block for display stars and pass a count of stars as an input parameter

Regards

Shradha

Hello, Yizuhi.

Use an ad-hoc loop but if you want to keep the original variable '*', create a new local variable to assign 5 stars '*****'. =AJ= and Sachin already answered how to use the ad-hoc loop.

Alternatively, if you are thinking about using a loop at web screen or web block (not define the variable in a client action), you would need a structure list and record to repeat that expression and will need to use a table widget to repeat it I guess.

Thanks.


Regards,

Brian


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.