Hi guys,
I have the requirement where I need to have two components multi dropdown and an editable grid,
In the multiple drowndown component the user will select the value based on that the number of rows need to be populated in the grid. Where when the user deselect the value in dropdown the corresponding row in the grid need to deleted or not to shown to user.
Discussion posts and replies are publicly visible
Hi santoshd378,
PFA sample code. Hope this helps.
load( local!multiSelectedValues, local!editableGridData: { { employeeId: 1, employeeName: "ABC" }, { employeeId: 2, employeeName: "XYZ" }, { employeeId: 3, employeeName: "PQR" } }, local!filteredData, a!sectionLayout( contents: { a!multipleDropdownField( label: "Multi Select Dropdown", choiceLabels: index( local!editableGridData, "employeeName", {} ), choiceValues: index( local!editableGridData, "employeeId", {} ), value: local!multiSelectedValues, saveInto: { local!multiSelectedValues, a!save( local!filteredData, index( local!editableGridData, wherecontains( local!multiSelectedValues, index( local!editableGridData, "employeeId", {} ) ), {} ) ) } ), a!gridLayout( label: "Editable Grid", headerCells: { a!gridLayoutHeaderCell( label: "Employee Id" ), a!gridLayoutHeaderCell( label: "Employee Name" ) }, rows: a!forEach( items: local!filteredData, expression: a!gridRowLayout( id: fv!index, contents: { a!integerField( readOnly: true(), value: fv!item.employeeId, saveInto: fv!item.employeeId ), a!textField( value: fv!item.employeeName, saveInto: fv!item.employeeName ) } ) ) ) } ) )
Thank you,
Arun
Hi Arun,
i am trying something similar as shown in below screen.
Scenario: Populate data from Database as preselected values in multi drop down which is working fine as shown in below image. Now, need to save new value if user changes the selected values in multi drop down. Upon un-selecting any one value of preselected values, it is immediately unselecting both the preselected values and changes the Source object to empty array [] as you can see in another screen below.
Please advise on how to prepopulate multiple selected values and also be able save new values in the same rule input to update values in DB.
Regards,
Anusha
Hi anushas0002,
Your MultipleDropDownField SaveInto looks like below
saveInto: a!save( ri!TechnologySelected.Source, save!value )
save!value in the multiple dropdown holds the value of choiceValues which is actually local!sources.Id.
I think you want to store both Source Id and DisplayName in the variable. If yes, you can try the below code
saveInto: { a!save( ri!TechnologySelected.Source, a!forEach( items: save!value, expression: { Id: fv!item, DisplayValue: displayvalue( fv!item, local!sources.Id, local!sources.DisplayName, null ) } ) ) }
Hi Vimal, I tried this code inside a foreach loop of editable grid and is throwing below error. Could you please help understand the issue and fix?
Part of the Code is below:
rows: a!forEach( items: local!sources, expression: { a!gridRowLayout( id: fv!index, contents: { a!textField( value: local!sources[fv!index].DisplayName, saveInto: local!sources[fv!index].DisplayName, refreshafter: "UNFOCUS" ), a!textField( value: local!sources[fv!index].FullName, saveInto: local!sources[fv!index].FullName, refreshafter: "UNFOCUS" ), a!textField( value: local!sources[fv!index].Description, saveInto: local!sources[fv!index].Description, refreshafter: "UNFOCUS" ), a!multipleDropdownField( label: "", choiceLabels: local!sources[fv!index].Technologies.Name, choiceValues: local!sources[fv!index].Technologies.Id, value: { local!sources[fv!index].Technologies.Id }, saveInto: a!save( local!sources[fv!index].Technologies, a!forEach( items: save!value, expression: { Id: fv!index, DisplayValue: displayvalue( fv!index, local!sources[fv!item].Technologies.Id, local!sources[fv!item].Technologies.Name, null ) } ) ) ), a!imageField( label: "", images: a!documentImage( document: a!iconIndicator( "REMOVE" ), altText: "Remove Source", caption: "Remove " & fv!item.DisplayName, link: a!dynamicLink( value: fv!index, saveInto: { if( isnull( fv!item.id ), {}, a!save( local!deletedSourceIds, append( local!deletedSourceIds, fv!item.id ) ) ), a!save( local!sources, remove( local!sources, save!value ) ), a!deleteFromDataStoreEntities( { entity: cons!CONS_CoE_SourcesEntity, identifiers: local!deletedSourceIds }, "Deleting source.", "Source Deleted", "Unable to Delete source." ) } ) ), size: "ICON" ) } ) } ), selectable: false, addRowLink: a!dynamicLink( label: "Add New Source(s)", value: local!sources, saveInto: { a!save( local!sources, append( local!sources, 'type!{urn:com:appian:types}Sources'( "", "", "" ) ) ) } ) ) },