Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What the parameters before brackets mean?

In the documentation you can insert data inside a table with the following syntax:

(insert table-name id {"parameter":parameterValue})

But here, in this example i have extra values in parameters before the brackets.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

(insert loans-inventory (inventory-key loanId entityName) {"balance":loanAmount})

What (inventorty-key loanId and entintynName) syntax mean? (inventory-key) is a function.

inventory-key function

(defun inventory-key (loanId:string owner:string)
(format "{}:{}" [loanId owner]))

>Solution :

(inventory-key loanId entityName) is a call to the inventory-key function with loanId and entityName as arguments. It all returns a value that serves the purpose as a key to the row that is being inserted in the table.

The key used comes from the output of the inventory-key function, which looking at the example (loans tutorial) it is a function that returns a string in the format of loanId:owner, probably to make it unique.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading