Hi all,
How can I cast True or false into yes or no?is there any function to convert like this?
Thanks in advance
Discussion posts and replies are publicly visible
Simply use if()
if(ri!booleanValue, "Yes", "No")
Thank you Sanchit,
But my requirement is little different .I am retrieving some boolean value from expression rule so it gives result as"false" and I want to use this false to some boolean fie
a!localvariables{ local!recomend: a!defaultValue( value: ri!studyMedicalReview.recomend, //retrieved values should go into the field goes as default // default: rule!recomend(ISR_Studyrequest: ri!studyRequest.studyRequestId) ), local!yesNo: { "Yes", "No" }, local!booleanArray: { true(), false() }, a!sideBySideItem( item: a!radioButtonField( label: "Recomended", labelPosition: "ABOVE", choiceLabels: local!yesNo, choiceValues: local!booleanArray, value: local!recomend saveInto: { local!recomend }}
I'm having a hard time understanding your use case. Can you post a screenshot of the error you're getting? What does the value of "local!recomend" evaluate to?
The value of that component must have the exact same data type as the items in choiceValues. Could it be that your local contains a string with the value "false"?
a!localvariables{ local!recomend: a!defaultValue( value: ri!studyMedicalReview.recomend, //retrieved values should go into the field goes as default // default: rule!recomend(ISR_Studyrequest: ri!studyRequest.studyRequestId) ), local!yesNo: { "Yes", "No" }, local!booleanArray: { true(), false() }, a!sideBySideItem( item: a!radioButtonField( label: "Recomended", labelPosition: "ABOVE", choiceLabels: local!yesNo, choiceValues: local!booleanArray, value: local!recomend saveInto: { local!recomend } primaryButtons: { a!buttonWidget( label: "Submit", submit: true(), saveInto: { ri!buttonPressed, a!save( ri!studyMedicalReview.recomend, local!recomend ) } ) }}
Hi Mike ,
Sorry to confuse you. I tried the above code it was giving some error initially but later that it didnt show any error and not providing the right output also.
I am retrieving some boolean value from rule!recomend that is "false"(which I got from the rule!recomend).I am trying to place the same boolean value into the field "Recomend" in the interface when ri!studyMedicalReview.recomend has no value.But I am not getting the right output and not getting any error also.
Could you check and confirm where I am doing mistake?
Many thanks
Hi Stefan,
Choice values contains local!booleanArray: { true(), false() } these values but from the rule I am trying to place "false"(which is also boolean value) in the local!recomend when the ri!studyMedical.recomend is blank.
hi Sirio, in value parameter of radio button field , just have null check in you radio button field like below,
a!radioButtonField( value:if( a!isNullOrEmpty(ri!studyMedical.recomend), false, ri!studyMedical.recomend )
Hi Gopal Thank you for the reply.
But how can use the retrieved value from rule!recomend in the radio field when the ri!studyMedical.recomend is empty with the above code
Did you copy this code from Interface designer? This code is full of errors.
I tried what you said and it works perfectly
a!localvariables( local!recomend: a!defaultValue(value: null, default: false()), local!yesNo: { "Yes", "No" }, local!booleanArray: { true(), false() }, a!radioButtonField( label: "Recomended", labelPosition: "ABOVE", choiceLabels: local!yesNo, choiceValues: local!booleanArray, value: local!recomend, saveInto: { local!recomend } ) )
Thank you for the reply Sanchit.
But from the above code how can we use the retrieved boolean value from rule!recomend