Skip to main content
May 3, 2023
Solved

How can I cast True or false into yes or no?

  • May 3, 2023
  • 17 replies
  • 0 views

Hi all,

How can I cast True or false into yes or no?is there any function to convert like this?

Thanks in advance

    Best answer by sanchitg0002

    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 }
      )
    )

    17 replies

    May 3, 2023

    Simply use if()

    if(ri!booleanValue, "Yes", "No")

    May 3, 2023

    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
                        }}
    ld in the interface .I have tried the above code but it giving error as choice values are yes or no but you are using false value.so How can I overcome this issue

    mikes0011
    Brainy
    May 3, 2023

    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?