In UI I have option to add data using addRowLink. Once I select one name consider h1, then I click on addRow then there I can write any alphanumeric code and I am storing that in backend. but if I am selecting multiple names(2) then if I click on addRowLink 2 new row boxes are being displayed. In UI even if I select multiple names only one row should be displayed and in backend the code should be updated for all selected names. no submit button is available in that interface
saveInto: { a!localVariables( /* Build one new row per selected partyId (no duplicate prevention) */ local!newRows: if( a!isNullOrEmpty(local!selectedInsuredId), {}, a!forEach( items: local!selectedInsuredId, expression: a!localVariables( /* Find the index of this party to resolve its applicationId */ local!idx: index(fv!item, wherecontains(fv!item, local!insuredParty['recordType!{f953bbb6-0363-40ce-afe7-4fd0315e1fc0}UWG Party.fields.{19291ea5-16a7-4ddb-9fc9-dbd77b0f9b3e}id']), null() ), /* Construct a new UWG MIB Reporting Code row */ 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code'( 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code.fields.{42e0ad63-0ba5-42bf-bf62-feff961f8d11}applicationId': index(local!insuredParty['recordType!{f953bbb6-0363-40ce-afe7-4fd0315e1fc0}UWG Party.fields.{0b7cc71a-9085-4b8d-8173-d3fb2dfcaeed}appianApplicationID'], local!idx, null()), 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code.fields.{b7e4ad0f-8daa-4d4e-bdff-38c77b595b2a}mrcIsMibReportingCodeValidated': false, 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code.fields.{36931678-bcb8-43ba-abd3-9f09fa9ec90e}partyId': fv!item, 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code.fields.{5a73b0fe-cee4-4d8f-b9d5-cc3a7a574644}createdOn': now(), 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code.fields.{4ea74402-050f-4d34-b459-3ae196ba1c73}createdBy': loggedInUser(), 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code.fields.{da86ac28-b1d2-41c3-ab2b-11af8f8b9c24}updatedOn': now(), 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code.fields.{a1ee9757-ddda-4f4c-a659-68c1d6ebbfe8}updatedBy': loggedInUser(), 'recordType!{a705bdd4-5853-4575-bf26-39f58fbcb25a}UWG MIB Reporting Code.fields.{ed97db33-4b1a-458d-bd65-f33878fa9879}isActive': true ) ) ) ), /* Perform ONE append to avoid "last save wins" */ if( a!isNullOrEmpty(local!newRows), {}, { a!save(ri!mibReportingCodes, append(ri!mibReportingCodes, local!newRows)), a!save(local!mibCodesValidated, null()), a!save(local!noMibCodesAdded, null()) } ) ) }
Discussion posts and replies are publicly visible
So you say that you want to add only one item, even if you select multiple. Correct?
If yes, what is the foreach doing?
I really have a hard time following your explanation.
no if I select two values and if I click on addrowlink only one row should be available but I am getting 2 rows as shown in image. I want only one row even If I select multiple values in dropdown but in database the code should be updated for all selectedvalues
OK, but in line 7 you add one item for each selected insurer. If you only want to add a single item, foreach() will not make it.
then how to achieve it only one rowlink should be added and in backend the same value should be saved for multiple values and submit button is not available in this interface
1) how to achieve it only one rowlink should be added: Remove the foreach()
2) in backend the same value should be saved for multiple values: I do not know your data model. But some king of a one-to-many relationship might be an idea.
3) submit button is not available in this interface: Add a submit button. I do not know what you are doing or plan to achieve. The standard Appian way is the add an interface to a process start form, acquire the data in the form, submit it, and store the data using a write records node.