Question
Could you please advise on how to implement filling in multiple fields of a document in a table in a Loop, taking data from a separate simple table? For example, there is a Documents table (1) with several fields. Another table is in a Loop, and in its row part, for example, documents consist of fields from the Documents table (1). We select the document number we need from table (1) in the Select field in the Loop, and the rest are filled in automatically.
Answer
There can be two approaches ā pull or push.
This is done through Codes in the fields that need to be filled. For example, we fill in the item
field with the product number and need to pull the cost of this product from the product price directory into the cost field. We write the Code in the Cost field:
=: select(table: 'price'; field: 'price'; where: 'id' = #item)
This is done through Action Codes. On a trigger for a change in the item
field, we write an Action Code that will set the product cost value from the price directory into the Cost field:
=: set(table: $#ntn; field: 'price' = $price)
price: select(table: 'price'; field: 'price'; where: 'id' = $#nfv)