Hi,
I have One Array in local variable.
like
data=[type:Opportunity,Name:Dickenson Mobile Generators,Account:[type:Account,Name:Dickenson plc],Amount:15000.0]; [type:Opportunity,Name:United Oil Office Portable Generators,Account:[type:Account,Name:United Oil & Gas Corp.],Amount:125000.0]; [type:Opportunity,Name:Express Logistics Standby Generator,Account:[type:Account,Name:Express Logistics and Transport],Amount:220000.0]; [type:Opportunity,Name:GenePoint Standby Generator,Account:[type:Account,Name:GenePoint],Amount:85000.0]; [type:Opportunity,Name:Grand Hotels Kitchen Generator,Account:[type:Account,Name:Grand Hotels & Resorts Ltd],Amount:15000.0], identifiers=1; 2; 3; 4; 5]
and want to store this five opportunity data in rule input to insert into the Appian Cloud Database separately(Five row in appian Cloud Database) after clicking on submit button or on load of form.
to implement this i created one rule input like:
but after clicking on submit button i get the all data in rule input five time with merge data . like
and i need this data in rules input in five time with different values like
code on submit button:
so how i can do this.
Discussion posts and replies are publicly visible
Hi Gawali,
Please check out the code below. Here the testCdt is your CDT.
load( local!testVar: { /* Your Data */ data: { { type: "Opportunity", Name: "DickensonMobileGenerators", Account: { type: "Account", Name: "Dickensonplc" }, Amount: 15000.0 }, { type: "Opportunity", Name: "UnitedOilOfficePortableGenerators", Account: { type: "Account", Name: "UnitedOil & GasCorp." }, Amount: 125000.0 }, { type: "Opportunity", Name: "ExpressLogisticsStandbyGenerator", Account: { type: "Account", Name: "ExpressLogisticsandTransport" }, Amount: 220000.0 }, { type: "Opportunity", Name: "GenePointStandbyGenerator", Account: { type: "Account", Name: "GenePoint" }, Amount: 85000.0 }, { type: "Opportunity", Name: "GrandHotelsKitchenGenerator", Account: { type: "Account", Name: "GrandHotels & ResortsLtd" }, Amount: 15000.0 } }, identifiers: { 1, 2, 3, 4, 5 } }, a!buttonLayout( secondaryButtons: { a!buttonWidget( label: "submit", saveInto: { a!save( ri!testCdt, a!forEach( items: local!testVar.data, expression: { name: fv!item.Name, accountName: fv!item.Account.Name, amount: fv!item.Amount } ) ) } ) } ) )
Hope this helps!
Hi @Edwin Yesa Thangappan I have requirement to pass the main forEach index in second sub forEach. like i highlighted fv!index from main loop and that highlighted fv!index want in second sub loop in the place of highlighted ri!SID_QuesIndex_RI text. so how can i do this. contents: { a!forEach( items: local!items, expression: { a!textField( label: "Question " & fv!index, value: fv!item.QuestionText, saveInto: { ri!SID_reviewQ_RI[fv!index].QuestionText, a!save(ri!SID_QuesIndex_RI,fv!index) }, labelPosition: "ADJACENT" ), a!forEach( items: fv!item.RevAnsCDT, expression: { a!textField( label: "Option " & fv!index , value: fv!item.AnsText, saveInto: ri!SID_reviewQ_RI.RevAnsCDT[fv!index].AnsText, align: "LEFT", labelPosition: "ADJACENT" ), a!integerField( label: "Weightage " & fv!index, value: fv!item.Weightage, saveInto: ri!SID_reviewQ_RI[ri!SID_QuesIndex_RI].RevAnsCDT[fv!index].Weightage, align: "LEFT", labelPosition: "ADJACENT" ) } ) } ) }