Hello, I have a "little" problem.
I have an array that I want to modify using a! save, inside my foreach. Everything works fine on the interface.
a!sideBySideItem( item: a!buttonArrayLayout( buttons: { a!buttonWidget( label: "", icon: "trash-o", size: "SMALL", width: "MINIMIZE", style: "DESTRUCTIVE", loadingIndicator: true, saveInto: { a!save( target: ri!moneyAccounts[fv!index].isDeleted, value: true() ), } ), a!buttonWidget( label: "", icon: "pencil-square-o", size: "SMALL", width: "MINIMIZE", style: "PRIMARY" ) }, align: "START" ), width: "MINIMIZE" )
But when I want to use it on the site I get this error. Please help
Discussion posts and replies are publicly visible
HI brayanm0001,
Can you also describe how is this interface rendered on your site
Is it through a parent interface / process model ?
I believe you are using a parent interface and inside that you have not declared this rule parameter as a local variable.
Eg. lets say your above code is in a rule say, rule!ABC which has a rule input ri!moneyAccounts
then in your parent interface, you must declare a local variable for this rule input as well
so, make sure you are calling this rule ABC in the parent interface something as
rule!ABC(
moneyAccounts: local!moneyAccounts
)
Yes, of course, this is my code on my site, I call this interface that I mentioned where I have the list of money accounts and I pass the moneyAccount parameter through an expression.a!columnsLayout( columns: { a!columnLayout( contents: { rule!BMC_ListMoneyAccounts( moneyAccounts: rule!BMC_GetMoneyAccounts( uuidUser: user(loggedInUser(), "uuid") ).data ) }, width: "AUTO" ) }, stackWhen: { "PHONE", "TABLET_PORTRAIT", "TABLET_LANDSCAPE", "DESKTOP_NARROW" } ),
a!columnsLayout( columns: { a!columnLayout( contents: { rule!BMC_ListMoneyAccounts( moneyAccounts: rule!BMC_GetMoneyAccounts( uuidUser: user(loggedInUser(), "uuid") ).data ) }, width: "AUTO" ) }, stackWhen: { "PHONE", "TABLET_PORTRAIT", "TABLET_LANDSCAPE", "DESKTOP_NARROW" } ),
Thanks.
well, if you see the moneyAccounts parameter value is not set to a rule input / local variable / process variable and that's the reason it is giving you an error.
So, if you do something like the below, it will work.
a!localVariables( local!accounts: rule!BMC_GetMoneyAccounts(uuidUser: user(loggedInUser(), "uuid")).data, a!columnsLayout( columns: { a!columnLayout( contents: { rule!BMC_ListMoneyAccounts(moneyAccounts: local!accounts) }, width: "AUTO" ) }, stackWhen: { "PHONE", "TABLET_PORTRAIT", "TABLET_LANDSCAPE", "DESKTOP_NARROW" } ) )
Done, it worked correctly many thanks to you and Mike Schmitt for your answers.