Use widget attributes in expressions


Please forgive me if this is a stupid question. This is my very first application and OutSystems is completely new to me.

I have a slider widget on a screen and I want to use its numerical value to set the value of a variable whenever the user slides it.

In the expression editor, the only attribute I seem to be able to reference is "Id". How do I reference Value, MinValue, MaxValue, etc?

Thanks in advance.

Rank: #94

Hello Martin,

Hope you're doing well.

First of all, welcome to OutSystems and to the Community! :)

If you want to have access to the selected value, you'll need to define a screen action as the Handler for the Slider's OnChange event, like:

This event will be triggered everytime the user changes the slider and passes the selected value for the Value variable.

You can refer to this documentation.

Hope that this helps you!

Kind regards,

Rui Barradas

Rank: #63930

Thanks a lot for replying!

This does help somewhat but what I want to do is the reverse (I think).

I have these variables:

And these Range Sliders:

I want to set each variable to the number that the corresponding slider is set to whenever the slider is slid.

I've created an OnChange event handler for each slider and I'm trying to the variable using an expression like:

varPasswordLength = rsPasswordLength.value

Of course, it doesn't work but I don't know how to accomplish this.

Thanks again for your help.

Rank: #286

Martin, Assign the selected values of each handler to the local variables you have created using Assign element like below



Rank: #2

Hi Martin,

Please look more closely at the answer Rui gave and the documentation he pointed to. Value is an Input Parameter of the OnChange handler. It will contain the current value of the slider.

Rank: #286

Hi Martin,

On the Slider's on change event, you need to define handler passing value for the selected range where your slider is currenly.

In its action, you can assign value of 'Selected Value' to screen variable as below:

And regarding Max value and Min  Value, you can create variables inside screen named as Maxvalue (default value 10) and MinValue (default value 1) as per your convenience, so you can directly use them inside your code.

Pass them as below:

This way you will be able to use SelectedRange, MinValue and MaxValue both inside your code.

Hope this helps, Thanks :)

Rank: #63930

Thanks everyone! I'm trying this now and will update you soon.