Merge File Example (Magic xpa 4.x)
A simple example using the Merge mechanism follows:
- 
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>
- 
Create a Magic xpa program with the following characteristics:
 
- 
Create a new I/O device with the following characteristics:
 
- 
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:
 - 
 
- 
In the Record Suffix, create a new line with the following characteristics:
 
- 
Operation: Form Output
 - 
From: ‘HTML Template’
 - 
I/O: ‘Merged File’
 
- 
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