Pass combobox variable to OnChange screen action (for the combo box) for SQL Update

Pass combobox variable to OnChange screen action (for the combo box) for SQL Update

  

I am trying to pass the variable of a combobox to its own OnChange screen action, but the variable does not seem to be updating? 

I have attached a picture of the On Change screen action. 

What am I missing? Do I need to refresh the combobox? 

Thanks in advance.

Hi Nicholas,

The combo box is attached to a variable. As soon as you select a value in the combo box, the variable will be update and if an OnChange is enabled, the action will be executed.

Inside the action, just refer to the variable. It will have the value you selected.

P.S. If inside the action the variable is not being updated, check if it has the correct value.

Also, the source is an aggregate/sql query or you have only special values?

I'm not able to download your image. It says is not an image in my mobile...

Jauch wrote:

P.S. If inside the action the variable is not being updated, check if it has the correct value.

Also, the source is an aggregate/sql query or you have only special values?

I'm not able to download your image. It says is not an image in my mobile...

Hi Jauch, 


Thank you so much for the reply! 

Sorry about the image, not sure what went wrong there. 

The source is a static data entity which has pre-populated values. For some reason the variable has the same value no matter what selection you make in the combobox? Does the combobox need to be refreshed? 

Thanks


Hi,

No. If you set the Entity property of the combo to the static entity, it will store in the variable the selected value as soon as you select one. No need to do refresh.

The variable must be of type your static entity identifier.

The OnChange event is an Ajax submit, so as soon as the action is called, the variable, visible in the action, will have the selected value.

Things you must have in mind.

If the variable type is not correct, you can have problems.

If you are not using the variable, the optimiser can just ignore it and it's value will never change. So, in the early stages of development, you can be seeing just the effect of it, and as soon as you use it for something, it will work.

As a suggestion, create a new webpage, put a combo box with the Entity property set to your static entity. Create a local variable of type static entity identifier and associate to the combo.

Add an expression, and associate it with a new variable of the same type.

In the onchange event of the combo, set a new screen action. On it, add an assign to store the value of the combo variable into the expression variable and after that, make an Ajax refresh of the expression.

On changing the value on the combo, you should see the selected I'd in the expression.

Cheers