Question
How can a new record be automatically added to the dataset from the script rule?
Answer
- Open the Document Definition from Project > Document Definitions... > Edit.
- Open the Properties of an existing Field or add a new one.
- Switch to the Rules tab and create a new rule (New Rule > Script > Ok).
- Edit the rule by pressing Edit, and paste a code that will add information to the DataSet. The DataSet record should contain as many Values as the DataSet has Columns. Be careful with letter capitalization as the naming is case-sensitive.
IDataSetRecord r = Context.DataSet("test").CreateRecord();
r.AddValue("A","1");
r.AddValue("B",Context.Document.Batch.Properties.Get("NewBValue"));
Context.DataSet("test").AddRecord(r);
Comments
0 comments
Please sign in to leave a comment.