if statement in choice field for dynamic printing
Hi!
Me again :-)
In my database, I have a choice field for usage rights (I'm a photographer). The rights are Yes, No and Limited.
When printing the contract using dynamic printing, I need to convert the simple Yes, No and Limited to a full sentence.
Inside the horrible standard Ninox print tool, I used
{if index(text(Rights), "Yes") >= 0 then
"This my my Yes text."}
{if index(text(Rights), "No") >= 0 then
"This my my No text."}
{if index(text(Rights), "Limited") >= 0 then
"This my my Limited text."}
How do I do this in dynamic printing?
Thanks!
Johanna
3 replies
-
The easy way is to just add it to your JSON.
usageRights: switch text(Rights) do case "Yes": "This my my Yes text." case "No": "This my my No text." case "Limited": "This my my Limited text." end
-
Cause I haven't done this before, I thought I would figure it out in Carbone.
It could look something like:
{d.rights:ifEQ(Yes):show('Yes Text'):or(.rights):ifEQ(No):show('No Text'):elseShow('Limited Text')}
The JSON key is called rights and it would get either Yes, No, or Limited.
It is very handy to have Carbone Studio to do the iterations while I tested the coding.
Content aside
- Status Answered
- 2 wk agoLast active
- 3Replies
- 24Views
-
2
Following