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
