Hi
I need to display multiple input integer fields within one integer field based on multiple dropdown selection means i have a multiple dropdown which has 11 options if i select one option from dropdown the input integer field related to that need to display likewise if i select three options from dropdown three input integer input field has to display.
I have defined 11 integer field individually like below but need to know the best approach to define in one integer field please suggest on this
contents: { a!integerField( label: "Organization Hierarchy", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),1) ), a!integerField( label: "Location Hierarchy", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),2) ), a!integerField( label: "Account Hierarchy", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),3) ), a!integerField( label: "ETC Account Hierarchy", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),4) ), a!integerField( label: "Product Hierarchy", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),5) ), a!integerField( label: "CIM Mapping Rule", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),6) ), a!integerField( label: "Company Hierarchy", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),7) ), a!integerField( label: "PROD Area to CC", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),8) ), a!integerField( label: "Functional Area Hierarchy", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),9) ), a!integerField( label: "HQ Hierarchy", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),10) ), a!integerField( label: "LPT Account", value: ri!selectedHierarchies, saveInto: ri!selectedHierarchies, showWhen:contains(tointeger(ri!impactedHierarchyList),11) ), },
Discussion posts and replies are publicly visible
This approach is good when you want to save the values of these fields in individual variables or you want to define individual configurations. But if not, here is how I would do it.
a!localVariables( local!labels: { "Label 1", "Label 2", "Label 3", "Label 4", "Label 5", "Label 6", "Label 7", "Label 8", "Label 9", "Label 10", "Label 11" }, local!values: repeat(11, null), local!selectedFields: {}, a!columnsLayout( columns: { a!columnLayout( contents: a!multipleDropdownField( choiceLabels: local!labels, choiceValues: enumerate(11) + 1, value: local!selectedFields, saveInto: local!selectedFields ) ), a!columnLayout( contents: a!forEach( items: local!selectedFields, expression: a!integerField( label: local!labels[fv!item], value: local!values[fv!item], saveInto: local!values[fv!item] ) ) ) } ) )
Hi Harshit
Thank you for the update i want to save these values and need to write those details to database
Hi Harshit Bumb , How to clear integer field when unselect mutlidropdown field?
Just make this small change
a!localVariables( local!labels: { "Label 1", "Label 2", "Label 3", "Label 4", "Label 5", "Label 6", "Label 7", "Label 8", "Label 9", "Label 10", "Label 11" }, local!values: repeat(11, null), local!selectedFields: {}, local!choiceValues: enumerate(11) + 1, a!columnsLayout( columns: { a!columnLayout( contents: a!multipleDropdownField( choiceLabels: local!labels, choiceValues: local!choiceValues, value: local!selectedFields, saveInto: { local!selectedFields, a!forEach( items: remove( local!choiceValues, local!selectedFields ), expression: a!save(local!values[fv!item], null) ) } ) ), a!columnLayout( contents: a!forEach( items: local!selectedFields, expression: a!integerField( label: local!labels[fv!item], value: local!values[fv!item], saveInto: local!values[fv!item] ) ) ) } ) )