Skip to main content
kavyam0002
April 20, 2022
Question

wipe the value

  • April 20, 2022
  • 4 replies
  • 0 views

choice1: a!radioButtonField(
              choiceLabels: cons!CR_APP_TXT_CHOICE_LABELS_YES_NO,
              choiceValues: cons!CR_APP_TXT_CHOICE_LABELS_YES_NO,
              choiceLayout: "COMPACT",
              value: fv!item.answer_txt,
              saveInto: if(
                contains(
                  index(
                    ri!crAPPRestructure_cdt.answer_txt,
                    wherecontains(
                      index(
                        local!SingleREFRestructure_cdt,
                        "dependentRefId_int",
                        {}
                      ),
                      ri!crREFRestructure_cdt.Id_int
                    ),
                    {}
                  ),
                  cons!CR_APP_TXT_CHOICE_LABELS_YES_NO[2]
                ),
                a!save(
                  fv!item.answer_txt,
                  null
                ),
                a!save(
                  fv!item.answer_txt,
                  fv!item.answer_txt
                )
                

              ),
              
              disabled: ri!IsReadOnly_bool,
              required: true(),
              requiredMessage: cons!CR_APP_RTF_TXT_VALIDATION_MSG
            ),
            choice2: a!integerField(
              value: fv!item.answer_txt,
              saveInto: 
              fv!item.answer_txt,
              disabled: if(
                or(
                  contains(
                    index(
                      ri!crAPPRestructure_cdt.answer_txt,
                      wherecontains(
                        index(
                          local!SingleREFRestructure_cdt,
                          "dependentRefId_int",
                          {}
                        ),
                        ri!crREFRestructure_cdt.Id_int
                      ),
                      {}
                    ),
                    cons!CR_APP_TXT_CHOICE_LABELS_YES_NO[2]
                  ),
                  ri!IsReadOnly_bool
                ),
                true(),
                false()
              ),
              readOnly: if(
                index(
                  local!SingleREFRestructure_cdt,
                  "readOnlyFlag_int",
                  {}
                ) = 1,
                true(),
                false()
              ),
              required: if(
                or(
                  index(
                    local!SingleREFRestructure_cdt,
                    "readOnlyFlag_int",
                    {}
                  ) = 1,
                  contains(
                    index(
                      ri!crAPPRestructure_cdt.answer_txt,
                      wherecontains(
                        index(
                          local!SingleREFRestructure_cdt,
                          "dependentRefId_int",
                          {}
                        ),
                        ri!crREFRestructure_cdt.Id_int
                      ),
                      {}
                    ),
                    cons!CR_APP_TXT_CHOICE_LABELS_YES_NO[2]
                  )
                ),
                false(),
                true()
              ),
              requiredMessage: cons!CR_APP_RTF_TXT_VALIDATION_MSG
            )

HI, 

here am getting these questions from db and populating in UI so have used choice in grid row layout 

requirement is when i select NO for 1st question the 1.1 data need to wipe/erase [their is one depended data i.e,dependent_id, based on that am differencing]

i have written the code but not meeting the requirement 

can anyone help with that? 

    4 replies

    mikes0011
    Brainy
    April 20, 2022

    For a one-off case you can probably hardcode the components to check the value of the "serial number" for the next/previous rows, and do different trickery in the saveInto parameter to handle data clearing, etc.  But if you want it to be truly dynamic, you will need to build in some sort of relational hierarchy between your questions, on the database side, where for any given question you'd be able to check in that row's logic whether it should behave in any special way depending on the relationship between questions.  Be advised though, this will get pretty complicated.

    The Expression Guru
    kavyam0002
    April 25, 2022

    i have one solution, but not able to write it in code

    we have ref table which has dependent_int=1 that says second row dependent on first row 

    i have written code for if condition but not able to write it for true/false

    when if it doesn't contains yes as value then save null else nothing

    can anyone help me with this?

    need to write code here 

    richardm900458
    April 25, 2022

    Can you Insert the daza scheme your two tables? Your explaination is hard to follow.