Skip to main content
kavyam0002
August 18, 2022
Solved

radio button

  • August 18, 2022
  • 3 replies
  • 0 views

Hi 

 a!radioButtonField(
              labelPosition: "COLLAPSED",
              choiceLayout: "COMPACT",
              disabled: ri!isReadOnly_bool,
              choiceLabels: cons!CR_APP_TXT_CHOICE_LABELS_YES_NO,
              choiceValues: touniformstring(
                cons!CR_APP_INT_CHOICE_VALUES
              ),
              value: fv!item.overrideFlag_int,
              saveInto: {
                fv!item.overrideFlag_int,
                if(
                  isnull(
                    fv!item.id_int
                  ),
                  {},
                  {
                    a!save(
                      fv!item.updatedBy_txt,
                      loggedInUser()
                    ),
                    a!save(
                      fv!item.updatedOn_dt,
                      now()
                    ),
                    a!save(
                      fv!item.updatedByRole_txt,
                      rule!CR_FN_getUserRole(
                        inputUser_txt: loggedInUser()
                      )
                    )
                  }
                )
              }
            )

am getting this error for this code 

    Best answer by harshitb6843

    Add toInteger() instead of toUniformstring().

    a!radioButtonField(
      labelPosition: "COLLAPSED",
      choiceLayout: "COMPACT",
      disabled: ri!isReadOnly_bool,
      choiceLabels: cons!CR_APP_TXT_CHOICE_LABELS_YES_NO,
      choiceValues: tointeger(
        cons!CR_APP_INT_CHOICE_VALUES
      ),
      value: fv!item.overrideFlag_int,
      saveInto: {
        fv!item.overrideFlag_int,
        if(
          isnull(
            fv!item.id_int
          ),
          {},
          {
            a!save(
              fv!item.updatedBy_txt,
              loggedInUser()
            ),
            a!save(
              fv!item.updatedOn_dt,
              now()
            ),
            a!save(
              fv!item.updatedByRole_txt,
              rule!CR_FN_getUserRole(
                inputUser_txt: loggedInUser()
              )
            )
          }
        )
      }
    )

    3 replies

    mikes0011
    Brainy
    August 18, 2022

    You're passing in an integer for "value", but for some reason, you're converting your choiceValues array to string.  Is there any particular reason you're using "toUniformString()" there?

    The Expression Guru
    harshitb6843
    August 18, 2022

    Add toInteger() instead of toUniformstring().

    a!radioButtonField(
      labelPosition: "COLLAPSED",
      choiceLayout: "COMPACT",
      disabled: ri!isReadOnly_bool,
      choiceLabels: cons!CR_APP_TXT_CHOICE_LABELS_YES_NO,
      choiceValues: tointeger(
        cons!CR_APP_INT_CHOICE_VALUES
      ),
      value: fv!item.overrideFlag_int,
      saveInto: {
        fv!item.overrideFlag_int,
        if(
          isnull(
            fv!item.id_int
          ),
          {},
          {
            a!save(
              fv!item.updatedBy_txt,
              loggedInUser()
            ),
            a!save(
              fv!item.updatedOn_dt,
              now()
            ),
            a!save(
              fv!item.updatedByRole_txt,
              rule!CR_FN_getUserRole(
                inputUser_txt: loggedInUser()
              )
            )
          }
        )
      }
    )

    mikes0011
    Brainy
    August 18, 2022

    Also: if the constant is properly defined as "array of integer" type, there is no need to use "toInteger()" or any other transformation on it.

    The Expression Guru