Explain various operators

Hi Scott,
Thank you for the great video tutorial. I learned a lot about this great program with invaluable tips and guidance.

Of course after the tutorial there are so many more questions that come to mind.

This is one of them; in the snippet below, which I copied numerous times from an example you provided that allows one to make a numbered list from a menu can you explain the various operators such as "len", "count" and is "i" an operator or something you had designated and I simply copied?


{note}Eye Colour{formmenu: name=Eye_Colour; multiple=yes; Brown; Grey; Black; Blue; Green}{endnote}
{if: len(Eye_Colour) > 0 and count(Eye_Colour) > 0; trim=yes}
The group's eye colour includes:{repeat: for i in seq(1, count(Eye_Colour))}
{=i}. {=Eye_Colour[i]}{endrepeat}{endif: trim=left}

Sorry about this Scott (I am hoping the video will jog my memory)

But can you help with this scenario.

4 different drugs: Drug1, Drug2, Drug3, Drug4
9 reasons to stop them: Reason1, Reason2, Reason3, Reason4, Reason5, Reason6, Reason7, Reason8, Reason9

Reasons 1-3 Low risk reasons; Reasons 4-6 Moderate risk reasons; Reasons 7-9 High risk reasons;

if Drug1 & Low risk reasons -> Guideline A
if Drug1 & Moderate risk reasons -> Guideline B
if Drug1 & High risk reasons -> Guideline C

if Drug2 & Low risk reasons -> Guideline D
if Drug2 & Moderate risk reasons -> Guideline D
if Drug2 & High risk reasons -> Guideline F

if Drug3 & Low risk reasons -> Guideline G
if Drug3 & Moderate risk reasons -> Guideline H
if Drug3 & High risk reasons -> Guideline I

if Drug4 & Low risk reasons -> Guideline J
if Drug4 & Moderate risk reasons -> Guideline K
if Drug4 & High risk reasons -> Guideline L

THEN dependent on Guidelines will determine which procedure:

If Guidelines A, D, G or J -> Procedure X
If Guidelines B, E, H or K -> Procedure Y
If Guidelines C, F, I or L -> Procedure Z

I know we touched on this but my memory is failing me.

Thanks in advance

So it's probably best to map something like this out sequentially.

Here is an approach to a slightly simplified scenario:

First define your source inputs:
Drug: {formmenu: Drug 1; Drug 2; name=drug}
Reason: {formmenu: Reason 1; Reason 2; Reason 3; Reason 4; name=reason}

Now let's define some intermediate variables to keep track of the risk:

{low_risk=includes(["Reason 1", "Reason 2"], reason)}
{mod_risk=includes(["Reason 3"], reason)}
{high_risk=includes(["Reason 4"], reason)}

Now let's determine the guidelines:

{guideline_a= drug == "Drug 1" and low_risk}
{guideline_b= drug == "Drug 1" and mod_risk}
{guideline_c= drug == "Drug 1" and high_risk}

{guideline_d= drug == "Drug 2" and low_risk}
{guideline_e= drug == "Drug 2" and mod_risk}
{guideline_f= drug == "Drug 2" and high_risk}

Now let's show the final procedure recommendation:

{if: guideline_a or guideline_b or guideline_d}
You should do procedure X
{elseif: guideline_c or guideline_e or guideline_f}
You should do procedure Y