Skip to main content
January 17, 2022
Question

Saving Data from List of data using CDT in a localvariable or input rule

  • January 17, 2022
  • 6 replies
  • 0 views

hi everyone

i need help to understand something with saving an item in variable which use CDT , 

i create a variable with a CDT ( type document that i defined ) and i created a list which bring me some data , which is also use CDT

now i create a for each because i  want to to save data each time with the function save!() , but after  that i click on test rule it doesnt show nothing everythin is null . 

what am i doing wrong ??? if i using a rule input i have the same issue ... 

what is the way to get the data in another variable .

6 replies

January 17, 2022

this is  what i have before the Save 

richardm900458
January 17, 2022

you don't use a!save in an expression rule. That is part or the saveInto parameter of a SAIL Interface Functions. 
try to use a!update() for expression rules instead.
docs.appian.com/.../fnc_array_a_update.html

January 17, 2022

thank you i  i will read that

stefanhelzle0001
Brainy
January 17, 2022

Appian is using a functional language. Variables are immutable in expressions. In interfaces a variable can only be modified on user interaction.

It takes a while to get used to this.

https://docs.appian.com/suite/help/21.4/Expressions.html

The basic principle is, that if you do not like a value, wrap it into another function or expression.

mikes0011
Brainy
January 17, 2022

I agree with the earlier commentors - what is your input state, and what is your desired output? 

Expression rules are powerful but you have to think of them as a transformation from input X to output Y.  That can be simple (think of the rule "upper()", if input is "a", then output will be "A"), or more complicated (a query, where your input is perhaps a few different filters, and the output is an array of data from the DB which matches those filters).

In your screenshot I can neither tell what your input will be in a real world use case (a single instance of "document"?), nor what your desired output will be.  Knowing these is pretty much a requirement before even starting on creating a workable expression rule.

The Expression Guru