Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

DTL <if>

条件を評価し、真の場合の操作または偽の場合の操作を実行します。

Synopsis

<if condition="1">   <true>     ...   </true>   <false>     ...   </false> </if>

属性

属性 説明
condition 必須項目。この条件式が真の場合、<true> 要素内のコードが実行されます。偽の場合は、<false> 要素内のコードが実行されます。この式では、含まれる <transform> 要素で指定されたスクリプト言語 (basic または objectscript) を使用する必要があります。言語を指定しない場合は、デフォルトの "objectscript" が使用されます。MVBasic はサポートされません。 整数値 1 (真の場合) または 0 (偽の場合) を求める式。

要素

要素 目的
<annotation> オプション。<if> 要素について記述するテキスト文字列。
<true> オプション。条件が真の場合、<true> 要素内のアクティビティが実行されます。
<false> オプション。条件が偽の場合、<false> 要素内のアクティビティが実行されます。

説明

<if> 要素は式を評価し、その値に応じて、2 つのアクティビティ・セット (式の結果が真の場合のアクティビティと偽の場合のアクティビティ) のいずれかを実行します。

<if> 要素には、<true> 要素と <false> 要素を含めることができます。これらの要素は、式の結果が真の場合および偽の場合に実行されるアクションをそれぞれ定義します。

<true> 要素と <false> 要素を両方指定する場合、<if> 要素ではどちらを先に配置してもかまいません。

条件が真で <true> 要素がない場合、または条件が偽で <false> 要素がない場合、その <if> 要素では何も実行されません。

以下の例は、DTL データ変換内の <if> 要素を示しています。この例の <if> アクティビティでは、ソース属性 PID:2.4 の値をテストする条件が指定されています。この値が文字列 'A' の場合は、<true> 文で、'A' の代わりに、値 '001' が属性に割り当てられます。

<transform targetClass='EnsLib.HL7.Message'
           targetDocType='2.3.1:MDM_T02'
           sourceClass='EnsLib.HL7.Message'
           sourceDocType='2.3.1:MDM_T02'
           create='new'
           language='objectscript'>
 <assign property='target.{MSH}' value='source.{MSH}' action='set'/>
 <assign property='target.{MSH:3}' value='"SOFTMAX"' action='set'/>
 <assign property='target.{MSH:4}' value='"001"' action='set'/>
 <assign property='target.{MSH:5}' value='"STARTCOM"' action='set'/>
 <assign property='target.{MSH:6}' value='"001"' action='set'/>
 <assign property='target.{EVN}' value='source.{EVN}' action='set'/>
 <assign property='target.{EVN:1}' value='"T02"' action='set'/>
 <assign property='target.{PID}' value='source.{PID}' action='set'/>
 <if condition='source.{PID:2.4}="A"'>
   <true>
     <assign property='target.{PID:2.4}' value='"001"' action='set'/>
   </true>
 </if>
 <assign property='target.{PID:3().4}' value='"001"' action='set'/>
 <assign property='target.{PID:18.4}' value='"001"' action='set'/>
 <assign property='target.{PID:21.4}' value='"001"' action='set'/>
 <assign property='target.{TXA}' value='source.{TXA}' action='set'/>
 <assign property='target.{TXA:5.10}' value='"001"' action='set'/>
 <assign property='target.{TXA:5.15}' value='"001"' action='set'/>
 <assign property='target.{TXA:9.10}' value='"001"' action='set'/>
 <assign property='target.{TXA:9.15}' value='"001"' action='set'/>
 <assign property='target.{TXA:10.10}' value='"001"' action='set'/>
 <assign property='target.{TXA:10.15}' value='"001"' action='set'/>
 <assign property='target.{TXA:11.10}' value='"001"' action='set'/>
 <assign property='target.{TXA:11.15}' value='"001"' action='set'/>
 <assign property='target.{TXA:12.2}' value='"SOFTMAX"' action='set'/>
 <assign property='target.{TXA:22.10}' value='"001"' action='set'/>
 <assign property='target.{TXA:22.15}' value='"001"' action='set'/>
 <assign property='target.{TXA:23.10}' value='"001"' action='set'/>
 <assign property='target.{TXA:23.15}' value='"001"' action='set'/>
 <assign property='target.{OBX()}' value='source.{OBX()}' action='set'/>
</transform>
FeedbackOpens in a new tab