From fee7b84d1d9df874e8867bdb34550a6b879126a3 Mon Sep 17 00:00:00 2001 From: Jim DeFabia Date: Fri, 20 Jan 2023 12:05:29 -0500 Subject: [PATCH] HPCC-24982 Clarify how to conditionally compile using __TARGET_PLATFORM__ Signed-off-by: Jim DeFabia --- .../ECLR_mods/Basics-Constants.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/EN_US/ECLLanguageReference/ECLR_mods/Basics-Constants.xml b/docs/EN_US/ECLLanguageReference/ECLR_mods/Basics-Constants.xml index a04ce43d03e..3bdea78508b 100644 --- a/docs/EN_US/ECLLanguageReference/ECLR_mods/Basics-Constants.xml +++ b/docs/EN_US/ECLLanguageReference/ECLR_mods/Basics-Constants.xml @@ -256,7 +256,18 @@ MyDec2 := 3.14159265358979323846d // value of MyDec2 is the DECIMAL Example: - IMPORT STD; + // Any modules referenced inside the condition must be declared outside of the condition +// This will avoid syntax errors +prod_thor_dali := _Control.IPAddress.prod_thor_dali; + #IF(_TARGET_PLATFORM_ in ['thorlcr']) + Output('thor'); + prod_thor_dali; + #ELSE + Output('not thor'); + #END + +//Second example +IMPORT STD; STRING14 fGetDateTimeString() := #IF(__ECL_VERSION_MAJOR__ > 5) or ((__ECL_VERSION_MAJOR__ = 5) AND (__ECL_VERSION_MINOR__ >= 2)) STD.Date.SecondsToString(STD.Date.CurrentSeconds(true), '%Y%m%d%H%M%S');