Add/Update form not properly saving into GRID

Hello, I have an Add/Update form and a GRID that can add or update data that is already there. I have 1 dropdown in this form that I can't figure out why it is not saving properly to the GRID. I select 1 of the 2 options from the dropdown and submit but it seems to make it NULL on the GRID no matter which option I choose. 

Any help here would be much appreciated. I will share some code snippets below.

Dropdown data fetch:

local!relTypeData: a!refreshVariable(
    value: rule!TB_QE_getValuesForDropdownCategoryFromKeyValueConfig(
      appName: cons!TB_TEXT_KEY_VALUE_CONFIG_APP_NAMES[2],
      category: cons!TB_TEXT_KEYS_CONFIG_CATEGORIES[13],
      selectionList: { "key1", "value1", "isActive" }
    ).data,
    refreshAlways: if(ri!selection = 12, true(), false())
  ),
  local!isActRelType: index(
    local!relTypeData,
    wherecontains(
      cons!TB_TEXT_ISACTIVE[1],
      touniformstring(
        index(local!relTypeData, "isActive", null)
      )
    ),
    null()
  ),
  local!deActRelType: index(
    local!relTypeData,
    wherecontains(
      cons!TB_TEXT_ISACTIVE[2],
      touniformstring(
        index(local!relTypeData, "isActive", null)
      )
    ),
    null()
  ),
  local!actRelTypeDropDownValue: a!forEach(
    local!isActRelType,
    {
      index(
        local!isActRelType[fv!index],
        "key1",
        null()
      ) & " - " & index(
        local!isActRelType[fv!index],
        "value1",
        null()
      )
    }
  ),

Actual Dropdown:

a!sideBySideItem(
                    item: a!dropdownField(
                      label: cons!TB_LABEL_REL_TYPE,
                      labelPosition: "ABOVE",
                      placeholder: "--- Select Rel Type ---",
                      choiceLabels: if(
                        a!isNotNullOrEmpty(
                          wherecontains(
                            touniformstring(index(ri!userPods, "relType", null)),
                            touniformstring(index(local!isActRelType, "key1", null))
                          )
                        ),
                        local!actRelTypeDropDownValue,
                        reject(
                          a!isNullOrEmpty(_),
                          append(
                            local!actRelTypeDropDownValue,
                            if(
                              a!isNotNullOrEmpty(
                                wherecontains(
                                  touniformstring(index(ri!userPods, "relType", null)),
                                  touniformstring(index(local!deActRelType, "key1", null))
                                )
                              ),
                              index(
                                index(
                                  local!deActRelType,
                                  wherecontains(
                                    touniformstring(index(ri!userPods, "relType", null)),
                                    touniformstring(index(local!deActRelType, "key1", null))
                                  ),
                                  null
                                ),
                                "key1",
                                null
                              ) & if(
                                a!isNullOrEmpty(index(ri!userPods, "relType", null)),
                                "",
                                " - "
                              ) & index(
                                index(
                                  local!deActRelType,
                                  wherecontains(
                                    touniformstring(index(ri!userPods, "relType", null)),
                                    touniformstring(index(local!deActRelType, "key1", null))
                                  ),
                                  null
                                ),
                                "value1",
                                null
                              ),
                              index(ri!userPods, "relType", null())
                            )
                          )
                        )
                      ),
                      choiceValues: if(
                        a!isNotNullOrEmpty(
                          wherecontains(
                            touniformstring(index(ri!userPods, "relType", null)),
                            touniformstring(index(local!isActRelType, "key1", null))
                          )
                        ),
                        index(local!isActRelType, "key1", null),
                        reject(
                          a!isNullOrEmpty(_),
                          append(
                            index(local!isActRelType, "key1", null),
                            index(ri!userPods, "relType", null)
                          )
                        )
                      ),
                      value: ri!userPods.relType,
                      saveInto: {
                        ri!userPods.relType,
                        a!save(ri!selection, 0)
                      },
                      searchDisplay: "AUTO",
                      validations: {
                        if(
                          a!isNotNullOrEmpty(index(ri!userPods, "relType", null())),
                          if(
                            a!isNotNullOrEmpty(
                              wherecontains(
                                touniformstring(index(ri!userPods, "relType", null)),
                                touniformstring(index(local!relTypeData, "key1", null))
                              )
                            ),
                            null,
                            "Select a valid value"
                          ),
                          null()
                        ),
                        if(
                          and(
                            tostring(
                              index(
                                index(
                                  local!relTypeData,
                                  wherecontains(
                                    tostring(ri!userPods.relType),
                                    touniformstring(index(local!relTypeData, "key1", null))
                                  ),
                                  null
                                ),
                                "isActive",
                                null
                              )
                            ) = cons!TB_TEXT_ISACTIVE[2],
                            ri!userPods.isActive = cons!TB_TEXT_ISACTIVE[1]
                          ),
                          "The value is inactive, Please select another value",
                          ""
                        )
                      },

                    )
                  ),

GRID Column:

a!gridColumn(
                          label: cons!TB_LABEL_REL_TYPE,
                          sortField: "relType",
                          value: index(fv!row, "relType", null())
                        ),

Any insight on this would be really appreciated. Let me know if I need to add any additional code snippets to understand the issue more.

Thanks in advance,

Thomas

  Discussion posts and replies are publicly visible

Parents Reply Children
  • +1
    Certified Associate Developer
    in reply to TomWould

    Tom,

    Your code seems fine. Few questions,

    1. Your RelType has no value for the first few rows in the grid and the remaining seems to have values. Try updating the rows that value for RelType. This way you can find whether the issue is in Add path or Update path.

    2. You can check the table directly in the RDBMS to ensure whether the value is present in the table and not displayed in your grid or the value itself not getting updated in the table. This will give some idea about where the problem is.

  • Thanks for the reply Simbu,

    1. It seems when I try to add the rel type appears with no value, AND when I try to update an existing one it changes to no value. The ones that are appearing empty on the GRID are also NULL in the actual Oracle DB.

    2. It seems that it is not updating or adding the proper rel type in the actual RDBMS either.

    I am not quite sure where to go from here, I keep messing with the SaveInto: code thinking maybe it is something there.

  • +1
    Certified Associate Developer
    in reply to TomWould

    Excellent. The issue seems more on the value getting overridden before the value gets stored to DB in your process. You may check the nodes between the start form and write to db.