Hi,
I want to save one variable which i created in with and values of that variable are getting update on basis of drop down.
I am using that variable(dataset) further to display something. But when i am trying to save any value in that dataset.
I am getting error
Expression evaluation error in rule 'rule_Test' (called by rules 'rule_test1' > 'rule_test2') at function a!applyComponents [line 176]: An error occurred while executing a save: Expression evaluation error: The save target must be a load() variable, process variable, or node input (or a rule input passed one of those three), but instead was:
What i sthe workaround to save the values of with variable instead to use load one as error says.
Discussion posts and replies are publicly visible
load( with( a!gridRowLayout( id: ri!index, contents: { a!textField( label: "Hello" & ri!index, value: ri!masterDataSet[ri!index].name, saveInto: { ri!masterDataSet[ri!index].name, a!save( ri!masterDataSet[ri!index].name, upper( ri!masterDataSet[ri!index].name ) ) /*a!save(*/ /*ri!testDataSet.name,*/ /*save!value*/ /*)*/ }, validations: { if( contains( touniformstring( a!flatten( { remove( ri!testDataSet.name, wherecontains(ri!masterDataSet[ri!index].id,ri!testDataSet.id) ), ri!testDataSet.name, ri!testDataSet.nameCopy } ) ), tostring( ri!masterDataSet[ri!index].name ) ), "This value already exists in the data", "" ) } ) , a!textField( label: "Hii" & ri!index, value: ri!masterDataSet[ri!index].nameCopy, saveInto: { ri!masterDataSet[ri!index].nameCopy, a!save( ri!masterDataSet[ri!index].nameCopy, upper( ri!masterDataSet[ri!index].nameCopy ) ) /*a!save(*/ /*ri!testDataSet.name,*/ /*save!value*/ /*)*/ }, validations: { if( contains( touniformstring( a!flatten( { remove( ri!testDataSet.nameCopy, wherecontains(ri!masterDataSet[ri!index].id,ri!testDataSet.id) ), ri!testDataSet.name, ri!testDataSet.nameCopy } ) ), tostring( ri!masterDataSet[ri!index].nameCopy ) ), "This value already exists in the data", "" ) } )
It will be able to update with dynamic values. **Edit: It will update if the queryEntity is placed in a saveInto; alternatively you could also use a button that is used to for requerying data**
One approach you could take is 1) change masterDataSet to load(), 2) when you update the variables that drive the query entity in their saveIntos, requery the entity as well (if you are constantly updating the parameters of the qe, the amount of database transactions can be risky and depending on the size of the data being queried, can provide a bad user-experience). If you query the entity once, this may be the easiest way to achieve your goal. Below is an example of what I mean:
load( local!datasubset, local!input1, local!input2, a!sectionLayout( contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Input 1", value: local!input1, saveInto: local!input1 ), a!textField( label: "Input 2", value: local!input2, saveInto: local!input2 ), a!buttonLayout( primaryButtons: a!buttonWidget( label: "Search", saveInto: { a!save( local!datasubset, rule!queryEntity( local!input1, local!input2 ) ) } ) ) } ) } ) } ) )
You can also copy the value of the masterDataSet value into a load variable, and make any changes to that variable's value. Then, you would run validations on the load variable that you define.