Skip to main content

☑️ Conditional Field Tags

Blandine Aucante avatar
Written by Blandine Aucante
Updated over a week ago

If you’ve already explored report tags in our first article, you're ready for the next step... 🥁... conditional tags!!! It’s the cherry on top 🎂

These tags allow you to choose which fields to display in your report exports based on the data entered. In other words, you can make certain information appear only if a specific criterion is met ✅ Everything you need to make your exported reports even more flexible and personalized!

👀 Hop hop hop: If you’ve never heard of tags or conditional reports, make sure to read these articles first before moving on to the next level with conditional tags 💪

⏮️ Quick reminder about tags!

Just a reminder, you can find all the tags directly in the report creation and editing tab on your computer! The tags automatically adjust to the title of your fields, so no need to stress: it’s all automatic 😎

Then, simply add them to your export template so they automatically retrieve the data filled in your report, such as file numbers, dates, types of incidents, or other information. Nothing simpler!


💡 The principle of the IF and END-IF tags:

To display a field only if certain conditions are met, use the conditional tags ##IF and END-IF##:

  • Start the condition with:

    ##IF FIELDNAME$visible##

  • Insert the field and content you want to display (text, image, table, etc.) + the tag you want to display: ##FIELDNAME##

  • Then, end with: ##END-IF##

The information between these tags will only be displayed if the condition is met!

⚠️ The 2 rules to keep in mind:

→ There must be as many IF as there are END-IF for the export to

→ Conditions are NOT applicable on Excel exports: only on Word.

➡️ Case 1: My field has a display condition in Kraaft

Here, you want the export to respect the display condition defined in Kraaft for a specific field. For example, in this Site Condition Report report model, we have:

  • A reference field named "I observe damage"

  • Three fields whose display depends on the "I observe damage" field via a condition

If the condition linked to "I observe damage" is checked, the associated fields (like "Date," "Where?," and "Description") will be displayed in the Kraaft report!

📌 How to apply display conditions to your export?

Condition in Kraaft

Tags in the model

##IF date$visible ##
##date##
##END-IF##

##IF where$visible ##
##where##
##END-IF##

##IF description$visible ##

##description##
##END-IF##

By adding these tag blocks into the export model, the logic is:

  1. If "I observe damage" is ✅: the three fields ("Date," "Where?," and "Description") will appear in the export.

  2. If "I observe damage" is NOT checked : these three fields will be completely ignored and not appear in the export.

To understand better, the tag ##IF date$visible## means that if the date field is visible (because the "I observe damage" field is checked), everything between these two tags will appear in the report 😁

In other words, you can insert your field tag between these two tags to display its value, but also add whatever you want: text, a table, emojis, etc. 📋

📝 What does the final export look like?

1. Example where "I observe damage" is ✅

Here’s what it looks like in the default Kraaft report:

And here’s what a report template looks like when you want to hide entire rows of the table!

The tag ###IF date$visible## (line 2) and ##END-IF## (line 4) allows to display the content of line 3, where a text "Date:" and the field value with the tag ##date## are filled in.

→ And the final result:

2. Example where "I observe damage" is NOT checked

Here’s the result in the default Kraaft report:

And here’s what our customized model looks like:


➡️ Case 2: My field has no display condition in Kraaft

No problem! You can still add a display condition to ensure the field only appears if it’s filled out, even if no condition is set in Kraaft :)

This allows you to add formatting (titles, fixed information, illustrations) depending on the fields filled out in the report: for example, you want to display a title "Details" followed by your ##comment##! Thanks to the $filled## tag, you’ll see the text "Clarifications" only if the comment field is filled out in the Kraaft report 📝

Example:

Field in Kraaft:

Tags in the model

##IF comment$filled##

Details : ##comment##

##END-IF##

Report Model :

  • ##IF commentaire$filled## : Check if the "Comment" field has been filled. If yes, then the comment and the text below will be displayed

  • Details: ##commentaire## → displays the content of the "Comment" field

  • ##END-IF## : If the field is empty, everything between the ##IF and END-IF## tags will be ignored and not displayed

Final Results:

Result with the field filled:

Result with the field empty:


Summary of the two cases:

  • Case 1: If the field has a display condition in Kraaft, use the $visible tag so the export respects the conditions defined in Kraaft (display only if the condition is met)

  • Case 2: If the field has no display condition in Kraaft, use the $filled tag to display the field only if it’s filled out, handy 😉

🔍 Want to go further?

If you want to further customize your Kraaft reports, here are some articles that might interest you:

  • ✳️ Excel Report Templates

  • 🎨 Customize the Report Template

  • 📝 Reports with conditions

  • 💬 Using Conversation Tags in a Report

  • 📋📝 Duplicate your report types

If you have any questions or need help, don’t hesitate to contact us:

📞 01 84 60 64 68

Did this answer your question?