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 }}
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.
Many thanks
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
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)