Skip to main content
kavyam0002
Brainy
Aug 18, 2022 12:20 PM UTC
Solved

radio button

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 

    harshitb6843
    Brainy
    Aug 18, 2022 12:25 PM UTC

    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
    Aug 18, 2022 12:24 PM UTC

    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
    Brainy
    Aug 18, 2022 12:25 PM UTC

    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
    Aug 18, 2022 12:47 PM UTC

    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