Example: Mapping Database Data to Excel 2007+
The mapping file used in this example is available as Excel-mapping.mfd in the <Documents>\Altova\MapForce2022\MapForceExamples\Tutorial\ folder. The third mapping of the three is discussed here.
The aim of the mapping is as follows:
•Extract from the "altova" database only persons whose department primary key is equal to 4 (that is, those who are in the IT department).
•Write the extracted records to a default Excel 2007+ component.
Excel-mapping.mfd (sample 3)
The mapping is configured as follows:
1.The database "altova" was added to the mapping area from the <Documents>\Altova\MapForce2022\MapForceExamples\Tutorial\ folder, using the Insert | Database menu command, and following the wizard for a Microsoft Access database.
2.The default Excel 2007+ component was added using the Insert | Excel 2007+ file menu command, and then skipping the option to supply a sample file.
3.The first worksheet (Sheet1) was renamed by clicking the button adjacent to it and then entering "Altova" as worksheet name.
4.The Rows 1, n=dyn range was configured by clicking the button adjacent to it. The cell range options were defined as follows:
5.Other options were defined as follows:
oThe value of the PrimaryKey is compared to the value "4", supplied by the Constant component, using the equal function.
oThe filter component passes on the First and Last fields if the Boolean condition is true (that is, if the department primary key is "4").
oThe on-true item is connected to the Rows 1, n=dyn item in the Excel file.
The result of the mapping is that four persons of the IT department are shown in the Excel workbook.