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
Can you share some more detail around how you're calling this interface from the site and/or parent interface? In particular, how the value being passed in for ri!moneyAccounts is initially being established prior to being passed into the interface in question. As the error message indicates, you're probably using an indvalid method of doing such, though it's hard to guess at exactly what.
Of course The interface I have on my site calls another interface where I pass the moneyAccount to it.contents: 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" } ),
contents: 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" } ),
This explains what you see in your error message. From this parent contxt, you're passing the direct result of a query into the rule input, but then in the sub-interface, you're trying to save a new value into it. The issue is that the new value does not have a proper location to save "up" into (such as a local variable).
Also I would caution you that even if you provide a local variable for it to save up into, this change will only be transient and will not affect the DB value unless you take specific steps to also save the new value into the DB.