How Do I Condition Inserting Data into a Predefined Template? (Magic xpa 4.x)
Sometimes you will want data to be inserted only if a certain condition is TRUE. This is done using the MGIF tag. The MGIF tag surrounds the conditional data. For instance:
Here is a list of DVDs we have in stock<!$MGIF_KeywordSpecified> that contain the keyword <!$MG_Keyword><!$MGENDIF>.
If the tag KeywordSpecified is TRUE, then the text
that contain the keyword <!$MG_Keyword>
will be included. Otherwise, the entire phrase will be omitted, and the sentence will read:
Here is a list of DVDs we have in stock.
Within Magic xpa, you will need to specify the data that determines if KeywordSpecified is TRUE. This is done in the Tags Table.
The Tag Name needs to match the MGIF tag. The MGIF tag would read:
<!$MGIF_KeywordSpecified>
The Expression needs to evaluate to a Boolean. In this case, we are checking to see if the user entered any filtering criteria for the list. If such criteria exist, then variable K will not be blank, and the expression will evaluate to TRUE.
The Online and Rich Client Samples projects (program MG02 and RMG02)