Closed Kodzhabashev closed 8 months ago
In GitLab by @moiri on Jan 16, 2019, 13:42
Using the small library JsonLogic
and a new style conditionalContainer
content can be rendered depending on whether the specified condition is true.
To refer to a field field_name
of a form form_name
use the syntax "@form_name#field_name"
.
The following example would represent one case as explained to me by @olivierbur (the condition is true if (mean(q1, q2, q3) >= mean(q4, q5, q6)) and (mean(q7, q8, q9) >= mean(q10, q11, q12)) and (mean(q7, q8, q9) >= mean(q13, q14, q15))
)
{"and":[
{">=":[
{"/":[
{"+":["@survey#q1","@survey#q2","@survey#q3"]},
3
]},
{"/":[
{"+":["@survey#q4","@survey#q5","@survey#q6"]},
3
]}
]},
{">=":[
{"/":[
{"+":["@survey#q7","@survey#q8","@survey#q9"]},
3
]},
{"/":[
{"+":["@survey#q10","@survey#q11","@survey#q12"]},
3
]}
]},
{">=":[
{"/":[
{"+":["@survey#q7","@survey#q8","@survey#q9"]},
3
]},
{"/":[
{"+":["@survey#q13","@survey#q14","@survey#q15"]},
3
]}
]}
]}
In GitLab by @moiri on Jan 16, 2019, 13:44
closed via commit c4ec48063e65134cbad6a4e4e346dc10a06585a5
In GitLab by @moiri on Jan 16, 2019, 13:46
It might be interesting to create a nice interface which allows to build such conditions. For the moment we have to do with the rather cryptic json notation as shown above.
In GitLab by @olivierbur on Jan 16, 2019, 13:51
Nice thank you! I think it will do for the moment. I will inform you when I created such a condition to see for you if it works. However, it will have to wait a few days.
In GitLab by @moiri on Jan 16, 2019, 13:56
Great!
I will now work on #116 and once this is done I will create a new version (v0.9.9) and update Hermes if that's ok with you.
In GitLab by @moiri on Jan 16, 2019, 13:57
mentioned in commit 5aee88118b0009efe7f312648b8df21aa193bc1d
In GitLab by @olivierbur on Jan 16, 2019, 13:59
That's perfect. Just let me know, so I can Log-out for that time.
In GitLab by @moiri on Jan 9, 2019, 17:54
Create a style that allows to fetch form data from the database and display content depending on a simple condition