天天看點

If-then-Else Statements--RTF文檔

幫助原文是這樣寫的:

BI Publisher supports the common programming construct "if-then-else". This is extremely useful when you need to test a condition and conditionally show a result. For example:

IF X=0 THEN
 Y=2
ELSE
 Y=3
END IF
           

You can also nest these statements as follows:

IF X=0 THEN
 Y=2
ELSE
 IF X=1 THEN
   Y=10
 ELSE Y=100
END IF
           

Use the following syntax to construct an if-then-else statement in your RTF template:

<?xdofx:if element_condition then result1 else result2 end if?>
           

For example, the following statement tests the AMOUNT element value. If the value is greater than 1000, show the word "Higher"; if it is less than 1000, show the word "Lower"; if it is equal to 1000, show "Equal":

<?xdofx:if AMOUNT > 1000 then 'Higher'
  else
  if AMOUNT < 1000 then 'Lower'
   else
   'Equal'
end if?>
           
我給大家加個例子:
           
stime: <?stime?> 


F: <?for-each:WIND_DATA1_ROW?>


dayday : <?dayday?>


wdpower123 : <?xdofx:if wdpower=-1 then '無采樣資料' else wdpower end if?>


{這裡特别說明:這個就是if,else的用法了:如果wdpower這個變量裡的值是-1,則顯示'無采樣資料' ,else否則,顯示變量wdpower裡的資料}


fs:<?fs?>


E:<?end for-each?>


 


 

          
stime日時間(小時) 瞬時最大功率 整點風速
F dayday點 wdpower123 fs E
  看一下結果:
If-then-Else Statements--RTF文檔
            else wdpower end if?>

繼續閱讀