Appian Community Team,
I need to have an Expression Rule that does the below:
Takes 2 Rule Inputs:
1. reviewID (Number data type)
2. file (Document Data type, this is Array holding list of documents)
I need to write an Expression rule that iterates through the Rule Input file and then outputs a list of Record Data ReviewDocument, this ReviewDocument record will have data points from both Rule Input reviewID and File.
Can you please advise on sample code for this.
Discussion posts and replies are publicly visible
What exactly do you want to do with these documents? Can you describe how the output of that expression should look like?
Can you be more specific about the output? You want something like this??
a!foreach(ri!file, recordtype!XYZ( documet: fv!item, reviewid:ri!review id))
Hi Stefan Helzle ,
I have a Table(Record) called REVIEW_DOCUMENTS in the Database. This Table has below data points:
REVIEW_ID
DOCUMENT_ID
DOCUMENT_NAME
I want to populate above Record with Review ID and Documents information using an Expression Rule, we can expect to have multiple Documents for a given Review ID. Then eventually in the process model I want to write that Records output into a Database Table REVIEW_DOCUMENTS so that I can show the documents to users in Summary screens.
To your question on what I was expecting the Expression Rule to output, I want that to display list of ReviewDocuments Records with Review Id, Doc Id and Doc Name data points in each.
Please let me know if you are having any questions. I am open for suggestions if I am not thinking correctly here.
Regards,
Mahesh
This looks like a good case for a foreach() iterating on the documents. The expression part of the foreach() creates a new record for each of the documents using the reviewId value from the rule input.
https://docs.appian.com/suite/help/24.4/reference-records.html#use-a-record-type-constructor
Thank you Venkat Avuluri , This is helpful. Appreciate the quick response here.
Stefan Helzle This is helpful. Appreciate the quick response here.