Since Variable values are substituted at run-time, not only can a variable contain data, but it can contain an HTML snippet.
For example it can contain inline styling in order to dynamically apply different styling at run-time.
One example is to show or hide a section of HTML based on business logic.
The code in the Email Data User-Exit will be like the following:
1: 2: 3: 4: 5: 6: |
IF l_hide = 'X'. ls_variables-var_code = 'SHOW_HIDE'. ls_variables-value = ' style="display:none;"'. ls_variables-row_num = l_row_num. APPEND ls_variables TO ch_variables. ENDIF. |
Within the HTML Block, the variable is used as follows:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: |
<tr&SHOW_HIDE&> <td style="border-bottom:3px solid #9BBB59;"> <p style="font-family:'Segoe UI',Helvetica,sans-serif;width:100%;color:#545454;font-weight:bold;font-size:12px; margin-top:0px;margin-bottom:0px;"> Confirmed Date </p> </td> <td style="border-bottom:3px solid #9BBB59;"align="center"> <p style="font-family:'Segoe UI',Helvetica,sans-serif;width:100%;color:#545454;font-weight:bold;font-size:12px; margin-top:0px;margin-bottom:0px;"> Qty </p> </td> </tr> |
Either the variable will be blank, in which case the table row will be displayed, or it will contain styling, in which case the table row will be hidden.