Recipe catalog
List and search the Use cases of the documentation, each a complete MQL script for a real task, and get the code, steps and result of one recipe. Typical uses: insert a recipe in the editor as a starting point, find an example that uses a given function.
recipe listrecipe listrecipe get

recipe list


Description

    All the recipes: JSON array of {category, profile, profile_name, id, title, goal, executed (false when the recipe needs your own systems)}, in the order of the Use cases page

admin
recipe list
mentdb
[{"category":"Programming","profile":"mql-beginner","profile_name":"MQL beginner","id":"cart-total-variables","title":"Shopping cart total: variables and arithmetic","goal":"...","executed":true}]

recipe list <json_params>


Description

    Recipes with parameters: profile (id or name), category, search (all the words must be found), code (false: true adds the code of each recipe), limit (the number of recipes at most)

Parameters

    json_params:   The parameters - String - required
admin
recipe list "{\"search\": \"mt940 reconcile\"}"
mentdb
[{"category":"Business & IT","profile":"accountant","profile_name":"Accountant & manager","id":"bank-statement-reconcile","title":"Reconcile a bank statement with the expected payments","goal":"The bank sends an MT940 statement; the accounting system knows the invoices it expects. Matching by reference first, then by amount and date, leaves only the lines that a person must really look at. The amounts stay exact: no rounding by floating point numbers.","executed":true}]
The first recipe of a profile, with its code
admin
recipe list "{\"profile\": \"accountant\", \"limit\": 1, \"code\": true}"
mentdb
[{"category":"Business & IT","profile":"accountant","profile_name":"Accountant & manager","id":"invoice-vat-due-date","title":"Invoice totals with two VAT rates and the due date","goal":"An invoice dated 15 December 2026 has goods at 20% VAT and books at 5.5%. The script computes the VAT and the gross total, then the due date of a '30 days end of month' term, moved back to the last business day when it falls on a weekend.","executed":true,"code":"#1. Invoice dated 2026-12-15, two VAT rates;\ -> \"[ht20]\" (+ 1250 340);\ -> \"[ht55]\" 180;\ -> \"[vat]\" (math round (+ (math percent [ht20] 20) (math percent [ht55] 5.5)) 2);\ -> \"[ttc]\" (math calc \"[ht20]+[ht55]+[vat]\");\ #2. Term: 30 days end of month;\ -> \"[due]\" (date last_day_of_month (date add \"2026-12-15\" \"DAY\" 30));\ #3. A weekend due date moves back to the last business day;\ -> \"[paid]\" (date add_business_days (date add_business_days [due] 1) -1);\ concat \"{\\\"net\\\": \" (+ [ht20] [ht55]) \", \\\"vat\\\": \" [vat] \", \\\"gross\\\": \" [ttc] \", \\\"term_end\\\": \\\"\" [due] \"\\\", \\\"weekend\\\": \" (date is_weekend [due]) \", \\\"due\\\": \\\"\" [paid] \"\\\"}\";"}]"
An unknown profile is an error
admin
recipe list "{\"profile\": \"astronaut\"}"
mentdb
ERROR: Sorry, an error appears (json_params: the profile 'astronaut' does not exist).

recipe get <id>


Description

    One recipe with its code, its steps (name, label, functions), its result (as computed by MentDB) and its "Go further" lines. The id is the one given by recipe list, or profile/id

Parameters

    id:   The recipe id - String - required
admin
recipe get "hl7-lab-result"
mentdb
{"category":"Documents & integration","profile":"integrator","profile_name":"Integrator & ETL developer","id":"hl7-lab-result","title":"Read a laboratory result in HL7 v2 and answer the sender","goal":"Hospital systems exchange pipe-separated HL7 v2 messages. A field is read by its usual path (PID-5.1, OBX(2)-5), results become rows, and the ACK tells the sender that the message was received. All the data here are fictional.","executed":true,"code":"-> \"[cr]\" (string char 13);\ -> \"[msg]\" (concat \"MSH|^~\\&|LABAPP|LAB|HIS|HOSP|20261104101530||ORU^R01|MSG42|P|2.5\" [cr] \"PID|1||900001^^^HOSP^MR||TESTPATIENT^ALICE||19800102|F\" [cr] \"OBR|1|||GLU^Glucose\" [cr] \"OBX|1|NM|GLU^Glucose||5.4|mmol/L|3.9-6.1|N|||F\" [cr] \"OBX|2|NM|K^Potassium||6.2|mmol/L|3.5-5.1|H|||F\");\ -> \"[family]\" (hl7 get [msg] \"PID-5.1\");\ -> \"[second]\" (hl7 get [msg] \"OBX(2)-5\");\ -> \"[flag]\" (hl7 get [msg] \"OBX(2)-8\");\ -> \"[ack]\" (hl7 ack [msg] \"{\\\"now\\\": \\\"2026-11-04T08:00:00Z\\\", \\\"control_id\\\": \\\"ACK42\\\"}\");\ -> \"[res]\" (concat \"patient \" [family] \" | second result \" [second] \" flag \" [flag] \" | ack \" (hl7 get [ack] \"MSA-1\") \" for \" (hl7 get [ack] \"MSA-2\"));\ [res]","steps":[{"name":"get","label":"One field","functions":"hl7 get"},{"name":"rows","label":"Result rows","functions":"hl7 to_rows"},{"name":"ack","label":"The answer","functions":"hl7 ack"}],"result":"patient TESTPATIENT | second result 6.2 flag H | ack AA for MSG42","more":["hl7 send delivers a message over MLLP and returns the ACK; patient data must go through TLS or a VPN.","fhir get, fhir search and fhir create speak to the FHIR REST servers. Neither is a certified medical interface."]}
An unknown id is an error
admin
recipe get "no-such-recipe"
mentdb
ERROR: Sorry, an error appears (the recipe 'no-such-recipe' does not exist (see recipe list)).