Hi Team,I have a requirement for creating an audit table in that i need compare the existing data and updated data and need to add only changed field values. for this 1st I'm querying the existing data in a local var, then after changing some fields in the UI, I'm performing a save into operation which involves a!foreach which compares the queried data & UI rule input fields so when there is a difference I'm appending one row for that changed field in audit record type rule input(array). but if there is no change I no need empty- row in audit table. but some how my code appending empty rows for fields with no changes. Kindly provide suggestion it'll be helpful.Thanks in advance
here ri!isupdate will check whether it is update action or create actionhere I didn't change anything in one field but it gets adding null value
Discussion posts and replies are publicly visible
Appian Expressions follows a functional approach in which you cannot update a variable. You try to do that in your foreach.
One of my job interview questions is: "In which cases do you use an append() inside a foreach?" Answer: "Never!"
Remove the append() from that foreach and let it just create a list of records. Then wrap it into a reject(isnull(_), <FOREACH>) to get rid of the null values.