Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Absent Member.. fespil Absent Member..
Absent Member..
606 views

Wizard using comboboxes

Jump to solution

Hello team, I am trying to configure the following:

 

On Change Management module, the field "risk.assessment" should be calculated according some questions.

 

So for those questions,  I have configured a button that calls a wizard, and the wizard is associated with a form called "frmCalcRisk".

 

The form "frmCalcRisk" has six comboboxes configured with 4 values on each combobox with the questions. For the values I am using local variables ($value1, $value2, $value3,$value4, $value5, $value6).

 

After that, on the action tab of the wizard -> expression,  I sum the variables and then assign them to another variables "$result" as it shows below:

 

$result=$value1+$value2+$value3+$value4+$value5+$value6

if ($resultado>=6 and $result<11) then (risk.assessment in $L.file=1)

if ($result>=11 and $result<17) then (risk.assessment in $L.file=2)

if ($result>=17 and $result<23) then (risk.assessment in $L.file=3)

if ($result>=23 and $result<25) then (risk.assessment in $L.file=4)

 

But the field "risk.assessment" is promtly correctly. I have also tried to printf the value for the var, but I get this message: "$result is not defined en car. 1" 

 

Any help on this will be really appreciated.

 

Kind regards, Federico.-

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.. John Stagaman Absent Member..
Absent Member..

Re: Wizard using comboboxes

Jump to solution

The previous is correct: you are combining character strings and need to convert them to numbers before you can add them together, but the expression above will not work, as the val() function requires an additional parameter to identify the target data type to execute the conversion.

 

Note that $result may need to be converted to a character before you save it as the risk value. 

 

$result=val($value1,1)+val($value2,1)+val($value3,1)+val($value4.1)+val($value5,1)+val($value6,1)

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
6 Replies
Absent Member.. fespil Absent Member..
Absent Member..

Re: Wizard using comboboxes

Jump to solution

As I have 6 comboboxes, the result that I have in $result is "111111" (concatenated).

 

How can I sum the values instead of concatenating them?

 

Regards, Federico.-

0 Likes
Regular Contributor.. jergus Regular Contributor..
Regular Contributor..

Re: Wizard using comboboxes

Jump to solution

Hello,

 

since the RAD language is loosely typed, RTE guesses the type of your variables. It sets data type to character. That is the reason why server concatenates  strings instead of summing the integers. You have set the data type using the val() function.

 

$result=val($value1)+val($value2)+val($value3)+val($value4)+val($value5)+val($value6)

 

0 Likes
Highlighted
Absent Member.. John Stagaman Absent Member..
Absent Member..

Re: Wizard using comboboxes

Jump to solution

The previous is correct: you are combining character strings and need to convert them to numbers before you can add them together, but the expression above will not work, as the val() function requires an additional parameter to identify the target data type to execute the conversion.

 

Note that $result may need to be converted to a character before you save it as the risk value. 

 

$result=val($value1,1)+val($value2,1)+val($value3,1)+val($value4.1)+val($value5,1)+val($value6,1)

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
Regular Contributor.. jergus Regular Contributor..
Regular Contributor..

Re: Wizard using comboboxes

Jump to solution

Hello John,

 

You are right, val()function has optional second parameter which specifies the datatype. But once ommited, default datatype 1 is used .

So I think my expression would work.

 

jergus

 

Absent Member.. fespil Absent Member..
Absent Member..

Re: Wizard using comboboxes

Jump to solution

Jergus and Jonh, first of all thank you for your comments.

 

I have tried both methods and both are working fine but I m still performing some issues in this case.

 

For example the variable $resul (or $resultado in Spanish) has a null value but the others variables $value1, $value2 ($valor1, $valor2 in Spanish) are showing properly.

 

I have tried using the val method with $result (or $resultado in Spanishwith no success.

 

I am attaching a file that describes the complete process. The form design with teh field properties of the combobox, the wizard with its calculations, and assignation, and so on.

 

Any help on this will be appreciated.

 

Kind regards, Federico.-

0 Likes
Absent Member.. fespil Absent Member..
Absent Member..

Re: Wizard using comboboxes

Jump to solution

I had a typo on my lines... now it working properly.

 

Thank you both guys!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.