Hello,
"Can you please help me? My array field, which is auto populated from another array field, takes the information but does not save it in the database. How can I adjust it to save?"
I intend to get "Codigo Finca" auto populate from a "Finca" field array list.
my interface code:
My expression rule:
property(a!queryEntity( entity:cons!SCP_FINCA_DSE, query: a!query( selection: a!querySelection( columns: { a!queryColumn(field: "codigoFinca"), a!queryColumn(field: "id"), a!queryColumn(field:"value") } ), pagingInfo: a!pagingInfo(1,-1) ) ),"data",null)
Appreciate your help.
Regards,
Discussion posts and replies are publicly visible
Hi I did not get your question, could you give more context on this please
Please elaborate your ask
The code you shared does not include anything that would save data to the database.
I assume that you are trying to update the record in the database, using the saveInto parameter in the dropdown.
This will only update the record locally, but will not save it to the database. If you want to update the record in the database, you will have to use either the smart service Writerecords in a PMO or the a!writeRecords function in your interface
Not sure but I think you want write a record using a array.
Hi,Did got the question. From my assumption,You are trying to perform cascading dropdown like from first drop down based on selected value you want to get the choice values in the second drop downIf that is the case then use wherecontains in choice values and choicelables to get the value.OrIf you are trying to write into database provide writerecord in submit button or use process model for writing the data to database.Provide detailed view if these are not the cases.
hello, thank to all for the replies.
Tejakunchala, you are correct, I´m trying to perform cascading dropdown like from first drop down based on selected value, I want to get the choice values in the second drop down ( autopopulate in the second dropdown).
This is a start form, so it´s is writng to a record on the PM.
can you pls guide me on the code you are suggesting me.
thanks a lot.
Hi,
a!dropdownField( placeholder: "Select-Country", choiceLabels: index(local!Countries,"country",null()), choiceValues: index(local!Countries,"countryId",null()), value: fv!item.country, saveInto: {fv!item.country,a!save(fv!item.state,null())} ), a!dropdownField( placeholder: "Select-state", choiceLabels: if(a!isNullOrEmpty(fv!item.country),local!states.state,index(local!states[wherecontains(tointeger(fv!item.country),local!states.countryId)],"state",null())), choiceValues: if(a!isNullOrEmpty(fv!item.country),local!states.stateId,index(local!states[wherecontains(tointeger(fv!item.country),local!states.countryId)],"stateId",null())), value: fv!item.state, saveInto: {fv!item.state, } ),
Local variables:-
local!Countries:{ a!map(countryId:1,country:"India"), a!map(countryId:2,country:"USA") }, local!states:{ a!map(stateId:1,countryId:1,state:"Andhra Pradesh"), a!map(stateId:2,countryId:1,state:"Telangana"), a!map(stateId:3,countryId:2,state:"Canada") },
Go through the code and follow logic for your code.Based on selected country, state choice values will be changed.
Here wherecontains used to get the index of the match country and from local!states it will get the values based on the index.
https://appianspace.com/2023/07/03/cascading-drop-down-in-appian/ - If you are unable to understand the code, refer this.
Thanks a lot, I´ll try and get back. thanks also for refering to the blog.