Nested Conditional Statements in DIAdem Report Text Comments

Updated Oct 2, 2024

Environment

Software

  • DIAdem

In this article, you will find a step-by-step guide on how to utilize nested conditional statements within text comments in DIAdem Report. This method allows you to dynamically check for the existence of specific properties and channels within a Channel Group, enhancing the clarity of your data presentation.
 

  1. Open the DIAdem software and ensure that the default Example_data is loaded in the Data Portal.
2024-10-02_15h42_37.png
  1. Navigate to the Report tab and select the Text Comment option.
2024-10-02_15h44_17.png
  1. Insert the following code into the text comment to dynamically display messages based on your data structure:
    • @@iif(Data.Root.ChannelGroups("Example").Properties.Exists("Name"),iif(Data.Root.ChannelGroups("Example").Properties("Index").Value = 1,iif(Data.Root.ChannelGroups("Example").Channels.Exists("Time"),"Exist","Not Available_3"),"Not Applicable_2"),"Not Applicable_1")@@
    • Code Explanation:
      • The code uses nested iif functions, which are conditional statements that evaluate conditions in sequence.
      • The outer iif checks if the property "Name" exists within the "Example" channel group.
      • If "Name" exists, the next iif checks if the "Index" property has a value of 1.
      • If true, it checks if the "Time" channel exists. If it does, the output is "Exist". If not, the output is "Not Available_3."
      • If the "Index" is not 1, it outputs "Not Applicable_2."
      • If "Name" does not exist, the code outputs "Not Applicable_1."
2024-10-02_15h49_43.png
  1. Click the Preview button to verify the result of the inserted code.
    2024-10-02_15h58_09.png

 

Examples of Results:

If all conditions meet: The output will display "Exist," indicating that the "Name" property exists, the "Index" property equals 1, and the "Time" channel is present.

2024-10-02_13h30_51.png

If a condition does not meet (e.g., if the "Index" property is False): The output will display "Not Applicable_2," indicating that while the "Name" property exists, the "Index" property does not equal 1.
2024-10-02_16h05_59.png