To save multiple values as a same target in a!save()
Hi Folks,
I am building the below logic i.e comparing the two local variables values if that is true then it has to perform the logic (i.e) 1*50 or else should return the null values. And it has to save the value when I click the button continue. As we cannot save multiple values as a same target in a!save(), Now I am facing issue in saving the values. If I define any one logic in a!save() that is working, whereas for multiple logic it is not working.
Below I have attached my code, you can refer from line 101 to 147. Please suggest If there is any alternative approach for the below logic.
a!localVariables(
local!type,
local!quanity,
local!button,
{
a!cardLayout(
style:"SUCCESS",
contents:{
a!columnsLayout(
columns:{
a!columnLayout(
width:"MEDIUM",
contents:
{
a!textField(
label:"MENU",
readOnly:true(),
),
/*a!textField(readOnly:true() ),*/
a!dropdownField(
label:"Categories",
placeholder:" --- SELECT THE CATEGORY ---",
choiceLabels:cons!CLS_PIZZA_TYPE,
choiceValues:cons!CLS_PIZZA_TYPE,
value:local!type,
saveInto:local!type
),
a!imageField(
label:"Margherita",
labelPosition:"ADJACENT",
align:"CENTER",
showWhen:local!type="Margherita",
size:"LARGE",
style:"AVATAR",
isThumbnail:true,
images:a!documentImage(
document:cons!CLS_IMAGES[2],
)
),
a!imageField(
label:"BBQ",
labelPosition:"ADJACENT",
align:"CENTER",
showWhen:local!type="BBQ",
size:"LARGE",
style:"AVATAR",
isThumbnail:true,
images:a!documentImage(
document:cons!CLS_IMAGES[3],
)
),
a!imageField(
label:"Cheese",
labelPosition:"ADJACENT",
align:"CENTER",
showWhen:local!type="Cheese",
size:"LARGE",
style:"AVATAR",
isThumbnail:true,
images:a!documentImage(
document:cons!CLS_IMAGES[4],
)
),
a!imageField(
label:"Sicilian",
labelPosition:"ADJACENT",
align:"CENTER",
showWhen:local!type="Sicilian",
size:"LARGE",
style:"AVATAR",
isThumbnail:true,
images:a!documentImage(
document:cons!CLS_IMAGES[6],
)
)
}
),
a!columnLayout(
width:"MEDIUM",
contents: {
a!textField(readOnly:true() ),
a!textField(readOnly:true() ),
a!dropdownField(
label:"Quantity",
placeholder:"---SELECT THE QUANTITY ---",
choiceLabels:{1,2,3},
choiceValues: {1,2,3},
value:local!quanity,
saveInto:local!quanity
)
}
),
a!columnLayout(
contents:{
a!textField(
readOnly:true(),
),
a!textField(
readOnly:true(),
),
a!textField(
label:"Total Amount",
value:{
if(and(local!type="Margherita",local!quanity=1),1*50,{}),
if(and(local!type="Margherita",local!quanity=2),2*50,{}),
if(and(local!type="Margherita",local!quanity=3),3*50,{}),
if(and(local!type="BBQ",local!quanity=1),1*100,{}),
if(and(local!type="BBQ",local!quanity=2),2*100,{}),
if(and(local!type="BBQ",local!quanity=3),3*100,{}),
if(and(local!type="Cheese",local!quanity=1),1*150,{}),
if(and(local!type="Cheese",local!quanity=2),2*150,{}),
if(and(local!type="Cheese",local!quanity=3),3*150,{}),
if(and(local!type="Sicilian",local!quanity=1),1*200,{}),
if(and(local!type="Sicilian",local!quanity=2),2*200,{}),
if(and(local!type="Sicilian",local!quanity=3),3*200,{})
},
)
}
)
}
)
}
),
a!sectionLayout(),/* line break */
a!buttonLayout(
primaryButtons: a!buttonWidget(
label:"CONTINUE",
style:"PRIMARY",
submit:true(),
confirmMessage:"Do you want to continue",
value:"Continue",
saveInto:
{
local!button,
a!save(ri!amount,if(and(local!type="Margherita",local!quanity=1),1*50,{})),
a!save(ri!amount,if(and(local!type="Margherita",local!quanity=2),2*50,{})),
a!save(ri!amount,if(and(local!type="Margherita",local!quanity=3),3*50,{})),
a!save(ri!amount,if(and(local!type="BBQ",local!quanity=1),1*100,{})),
a!save(ri!amount,if(and(local!type="BBQ",local!quanity=2),2*100,{})),
a!save(ri!amount,if(and(local!type="BBQ",local!quanity=3),3*100,{})),
a!save(ri!amount,if(and(local!type="Cheese",local!quanity=1),1*150,{})),
a!save(ri!amount,if(and(local!type="Cheese",local!quanity=2),2*150,{})),
a!save(ri!amount,if(and(local!type="Cheese",local!quanity=3),3*150,{})),
a!save(ri!amount,if(and(local!type="Sicilian",local!quanity=1),1*200,{})),
a!save(ri!amount,if(and(local!type="Sicilian",local!quanity=2),2*200,{})),
a!save(ri!amount,if(and(local!type="Sicilian",local!quanity=3),3*200,{})),
}
)
)
}
)
Thanks in Advance!!
Regards,
Charulatha
