IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

XML to Excel- variable number of columns Options · View
Davy
Posted: Wednesday, June 23, 2021 2:09:35 PM
Rank: Newbie

Joined: 6/23/2021
Posts: 1
Hello everybody

I'm new to Altova Mapforce, and I'm trying to map an xml file to excel.
The problem I'm facing is that I have a number of statusses, which need to map onto columns in the excel file.
However, not every customer uses the same statusses, so the number of columns and the column headers should be dynamic, depending on the customer.
Unfortunately, it seems like I have to define a column range in advance, and add the column header, but there is no way of conditionally adding the column to the excel output or not.

Is there any way that this would be possible, so that I can output the right columns (and only those columns) to the excel file, depending on a customer id?

Thanks in advance!
that
Posted: Wednesday, June 23, 2021 3:18:39 PM
Rank: Advanced Member

Joined: 6/16/2006
Posts: 486
Location: AT
Davy wrote:
Unfortunately, it seems like I have to define a column range in advance, and add the column header, but there is no way of conditionally adding the column to the excel output or not.


There is, if you keep the option "Show a single Cells item for all columns" selected. However you can't mix fixed columns with dynamic ones - it's all or nothing.

In the "Show a single Cells item for all columns" mode, you can map a sequence of data items to the Cells node, and MapForce will create one column for each item. You can do the same with a sequence of strings to create your column headers. You can use "variable" components and the "Duplicate Input" function for the variable's "value" node to prepare such sequences easily.
wriley
Posted: Thursday, June 24, 2021 5:56:34 PM
Rank: Member

Joined: 2/3/2016
Posts: 17
Location: Plymouth, Michigan
Davy,

I can see where to duplicate inputs, and control the column number, but I don't see any connection for 'Column Name'

Would you be able to supply a screenshot of how that looks for getting column headers in from strings?
K101
Posted: Monday, June 28, 2021 12:13:32 PM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 558
You have to switch the column mode. As that described, you can show columns in two ways: "Show a single Cells item for all columns," or "Show separate items for columns". The latter mode is what gives you letter-named columns A, B, C, etc., and the former gives you "Column Name" and "Column Number." This is described in the documentation topic, "Selecting Ranges of Cells".
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.