Salesforce

Merge File Example (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

Merge File Example (Magic xpa 2.x)

A simple example using the Merge mechanism follows:

  1. Create an HTML file with the following information, and save it in a location easy to find, for example: ‘c:\in_merge.htm’:

<!$MGREPEAT>

<!$MG_number> <!$MGIF_IsEven>Even<!$MGELSE>Odd<!$MGENDIF>

<!$MGENDREPEAT>

  1. Create a Magic xpa program with the following characteristics:

  • Task Type: Batch

  • End Task Condition: Counter(0)=10

  • Evaluate Condition: After updating record

  1. Create a new I/O device with the following characteristics:

  • Name: ‘Merged File’. You can enter any name.

  • Media: File

  • Exp/Var: Location and name for the resulting file; for example: ‘c:\out_merge.txt’

  1. Create a form with the following characteristics:

  • Name: ‘HTML Template’. You can enter any name.

  • Class: 1

  • Interface Type: Merge

  • HTML File: Location and name for the HTML file that you created: ‘c:\in_merge.htm’

  • Tags Table: create two entries that will match the two HTML tag in our Template file:

    • Tag Name: number replace with the Expression: Counter (0)

    • Tag Name: IsEven replace with the Expression: Counter (0) MOD 2=0

  1. In the Record Suffix, create a new line with the following characteristics:

  • Operation: Form Output

  • From: ‘HTML Template’

  • I/O: ‘Merged File’

  1. Save the program, check it and execute it. If you open the resulting ‘c:\out_merge.txt’ file you should see the following lines:

1 Odd

2 Even

3 Odd

4 Even

5 Odd

6 Even

7 Odd

8 Even

9 Odd

10 Even

Reference
Attachment 
Attachment