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
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
Please make sure that your rule!recomend is returning a boolean value and call it just like you are doing. I think may be you need to index some property from the output of that rule. Can you show us the code of this rule or may be the output?
if( rule!APN_isBlank(ri!ISR_Studyrequest), a!dataSubset({}), index( index(a!queryEntity( entity: cons!ISR_DSE_STUDY_MEDICAL_REVIEW, query: a!query( logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "studyRequestId", operator: "=", value: ri!ISR_Studyrequest ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 1, sort: a!sortInfo( field: "medicalReviewId", ascending: false ) ) ) ),"data",{}),"passRecommendation",{}),
)
Are you passing a value to ISR_Studyrequest rule input? Check the value in ri!studyRequest.studyRequestId of the interface.
Also what is the data type of "passRecommendation" field?
I am checking by passing some rule input it is giving value as" false".
passrecommendation data type is boolean
Then there is no reason for it to not work if you have corrected the errors in your code with the code I shared.
Please share the latest code of your interface.
And this time please use code box to paste your code.
Thank you Sanch it it was working.
Small doubt if we want to save 1 value in 2 targets by using the save function can we use like this a!save(target1{target2,value})
You can pass an array of targets in a!save().
a!save({target1, target2},value)