I am not sure if I understood your use case correctly but here is a snippet which I created after some changes in the original one.
{run: medicines =[]
}
Medicines List:
{repeat: for medicine in medicines}
{=medicine} every {formmenu: default=8; 16; 24} hours{button: var index = location(medicines, medicine)
medicines = merge(slice(medicines, 1, index - 1), slice(medicines, index + 1))
; label=❌}{endrepeat}
New Medicine:
{formtext: name=medicine; default=} {button: if medicine = ""
notify("Medicine cannot be blank")
return
endif
medicines = merge(medicines, [medicine])
medicine = ""
; label=Add Medicine}
Hi, Ashwin.
Yes that my idea but I was thinking about the posibility of make different selections or formmenu for each "Medicine".
Really, thank you so much,
Luis
1 Like
Do you mean that the frequency options would change depending on the medicine?
Ex.
Propranolol would show options: every 8 hours, every 12 hours
Acetaminophen would show options: every 6 hours, every 8 hours
1 Like
Yes, @Timothy_Wong, that's the issue.
Something like this?
{formmenu: Med1; default=Med2; Med3; name=Medication}
{if: contains(medication, "Med1")}{formmenu: every 2 hours; default=every 4 hours; every 6 hours; name=Freq1}{endif}
{if: contains(medication, "Med2")}{formmenu: every 4 hours; default=every 6 hours; every 8 hours; name=Freq2}{endif}
{if: contains(medication, "Med3")}{formmenu: every 6 hours; default=every 8 hours; every 10 hours; name=Freq2}{endif}
1 Like
Hi @Luis_Andres_Herrera,
In my previous solution, you can easily make different selections for each medicine you add or do you want to add a specific form menu for each medicine, for example, medicine 1 can have options for every 4 or 8 hours, while medicine 2 can have options for 2, 4, or 6 hours?