Manually setting List<ui::Option>

Discussions about the LSPS expression language.
Forum rules
Make sure every topic contains information about your LSPS version and if relevant also your server OS, client OS, database name and version, and application server name and version.
eric.graham
 
Posts: 58
Joined: Tue May 13, 2014 12:20 pm

Manually setting List<ui::Option>

Wed Oct 04, 2017 9:05 pm

hello - I am having trouble remembering how to set a (List<ui::Option>) manually. I have a function getYesNoOptions() with the Expression:
[new Option(value -> false, label -> "No"),
new Option(value -> true, label -> "Yes")]

The value (for some reason) is NULL in a old ticket, and it is a required value. - This is only used for a flag, so we do not persist to the database, or else I could just update the value there. I am looking for a way in the Management Console to set the getYesNoOptions() to use the value (value->false, label->"No").
But my attempts have not been successful. Could someone please shed some light on how this can be achieved?

Thank you in advance

**(I have also referenced the LSPS Documents, and the LSPS Expression Language Refcard 3.2 ... I am just not getting the results I need)

Eva Kopalova
 
Posts: 5
Joined: Mon Jan 20, 2014 11:14 am

Re: Manually setting List<ui::Option>

Thu Oct 05, 2017 10:19 am

Hi Eric,

For starters, the function looks ok to me.

However I am a little bit confused and I would need more information.

Right now I could imagine that you are struggling with one of the following:
* You want to change business data (the flag) stored in a global variable,
which is your "old ticket".

The solution is to assign it the required value in the Management Console directly as you suggested
(use persist mode).

Code: Select all
oldTicket.yesNoOptionProperty := true


* The "old ticket" is a form and you are trying to set options for a combo box.
You set its Required property to true but not much happened:

The property is simply a flag and does not imply any further logic (you need to implement this yourself)
Check https://docs.whitestein.com/lsps/3_2/pds/inputcomponents.html#combobox

If none of this is the case, please, provide further information about the situation so we can help you out asap.

eric.graham
 
Posts: 58
Joined: Tue May 13, 2014 12:20 pm

Re: Manually setting List<ui::Option>

Thu Oct 05, 2017 2:38 pm

My apologizes for not specifying the field type. I am trying to set this in a radio button.

When doing what you suggest, I get the following result:

"Expression result:
Type mismatch. Cannot convert from Boolean to List<ui::Option>"

Again, this is a "Yes/No" radio button field that is mandatory, and for some reason, it is NULL in the old ticket. (old meaning it was created months ago, and the field has progressed past the the process it was to be chosen in, and is now in a read only state.) So corrected it in the Management Console seems to be the best solution. - But I am still facing issues on setting this value to "false/"No""

Radio Button - Binding: (Reference<Object>) &scrapFormInitiated (setting this to false does not cause the actual yes/no field to be marking in the function)
- Options: (List<ui::Option>) getYesNoOptions()

Function - Name: getYesNoOption
- ReturnType: List<Option>
- Implementation: Expression : [new Option(value -> false, label -> "No"),
new Option(value -> true, label -> "Yes")]

Version: 3.1 - Build: 3.1.1029

Hope this addition information helps

Eva Kopalova
 
Posts: 5
Joined: Mon Jan 20, 2014 11:14 am

Re: Manually setting List<ui::Option>

Thu Oct 05, 2017 3:25 pm

Eric,
I am wondering: if you enter into the Management Console in the model instance Expression Evaluator
Code: Select all
getYesNoOptions()

does this return the options?

What about:
Code: Select all
radioButtonInOldTicket.yesNoOptionProperty := [new Option(value -> false, label -> "No"),
new Option(value -> true, label -> "Yes")]


Also, could you, please, explain to me what "old ticket" is?

eric.graham
 
Posts: 58
Joined: Tue May 13, 2014 12:20 pm

Re: Manually setting List<ui::Option>

Thu Oct 05, 2017 3:34 pm

Running "getYesNoOptions()" in the Expression Evaluator returns

"Expression result:
[ui::Option(value->true, label->"Yes"), ui::Option(value->false, label->"No")]"


So trying "getYesNoOptions := [new Option(value -> false, label -> "No")]" returns

"Expression result:
Left side of an assignment must be a variable, a property, a dereference or def expression"



"Also, could you, please, explain to me what "old ticket" is?"
A ticket in our system that was created in the past, where now the process that the Radio button is in, is in Read Only state. Our ticket process works as once the current process has completed, the previous process is in Read Only, and cannot be edited. - Does this help?

Eva Kopalova
 
Posts: 5
Joined: Mon Jan 20, 2014 11:14 am

Re: Manually setting List<ui::Option>

Thu Oct 05, 2017 3:38 pm

From this I figure you want to change the body of the getYesNoOption() function?

Byron Glueck
 
Posts: 85
Joined: Thu Apr 26, 2012 8:17 pm

Re: Manually setting List<ui::Option>

Thu Oct 05, 2017 4:33 pm

Can you provide the form expression for the control in question and any related variables (and types)? For example:

Code: Select all
_selectList := new ui::RadioButtonList(
    modelingId -> #"_uWlpIKnZEeeW67SuGFjSyw",
    options -> {->getYesNoOptions()},
    binding -> &myValue);


You can access this by choosing 'Display Form Expression...' from the form's context menu.

eric.graham
 
Posts: 58
Joined: Tue May 13, 2014 12:20 pm

Re: Manually setting List<ui::Option>

Thu Oct 05, 2017 7:18 pm

@Byron -

ISF := new ui::RadioButtonList(
modelingId -> #"ISF__Y8ANkBqJEeSme8onEMu8LQ",
options -> {->getYesNoOptions()},
binding -> &scrapFormInitated,
readOnly -> {->readOnly},
label -> {->"Initiate Scrap Form"},
required -> {->showDispositionUnit()});

Byron Glueck
 
Posts: 85
Joined: Thu Apr 26, 2012 8:17 pm

Re: Manually setting List<ui::Option>

Fri Oct 06, 2017 3:17 am

Can you confirm that the correct name of the binding, scrapFormInitated or scrapFormInitiated? Setting the proper one's value has what effect on the radio button?

eric.graham
 
Posts: 58
Joined: Tue May 13, 2014 12:20 pm

Re: Manually setting List<ui::Option>

Fri Oct 06, 2017 2:16 pm

@Byron
The Binding: values (from copy/paste out of LSPS is "&scrapFormInitated"
- I can send you screen shots (via your email) of the Console Management, our ticket in the app showing the Radio button's NULL state, and the LSPS properties for a visual.

Next
Return to Expression language

Who is online

Users browsing this forum: No registered users and 0 guests