HTML Tag attributes

Dear community,

I have a question concerning the XML Tag attributes and their representation in the data mapper. A little elaboration is needed on our XML structure.

We transfer our data using an XML structure with labels. Each tag has a code name (for instance: ) and from this tag we extract data to put on paper.

But… there are certain kinds of labels which are coded, this is done through XML attributes. We need to extract these codes to check whether the description has to be printed or not. Here is a visual representation:

Some times, the description has to be printed, but then there are times where it has to be removed. We do(did in PP7) this using checks on the code, like so: if the code is equal to ASD1, ASD2 or ASD3, print the Description.

The representation of these structure in PP7 was very clear to use. you simply added /@Code or /@Description to the tag, and it’s done. In OL Connect however, these attributes are stored as values without mentioning the parent tag, and each new code and description gets a number added to it which makes the data model look like this (if this was the 35th time that a tag had attributes.

L10001
Code35
Description35

This gets very confusing after a while (believe me) and it would be best if the data model differentiated between tags. Possible representations could be ‘L10001-Code’ or ‘L10001Code’ or maybe ‘L10001_Code’.

The question at hand is: Is this possible in anyway at the time or does someone have a good alternative?

Thank you in advance,

Sincerely
Jelte

Hi Jelte.

It looks like you are trying to extract everything in the master record when a detail table might be more beneficial.

Remember, data in Connect is hierarchical. By moving the extraction of the codes in a detail table, you would have one detail entry per code, with each entry having a Name (e.g. L10001), a Code (e.g. ASD1) and a Description. In your template, you can use a simple script condition that selects whether the description is printed or not based on the value of Code.

To extract data in a detail table, use a Loop step to go over all the XML code elements and use an Extraction step to extract the name, code and description in a table named “record.detail”. This will create a sub-table named detail under the master record, with each XML code element becoming a new entry in that sub-table.

Hi fortiny,

Thank you for the reply, but I think I haven’t explained the situation properly, I apologise.

The problem at hand is not restricted to one ‘label’ tag. It is possible for a lot of different labels to have a Code and a Description, this is a better respresentation of our setup:

Value1

Value2

The problem here is that this would be represented in the datamapper as follows:

L65432 :
Code : XAS
Description : A certain valuea
L11265 :
Code1 : FDs
Description1 : A certain valueb
L10001 Value1
L12498 :
Code2 : ASD1
Description2 : A certain valuec
L15678 :
Code3 : FDss
Description3 : A certain valued
L37654 : Value 2
L11010 :
Code3 : ASD4
Description3 : A certain valuee

When you have more than 50 labels with a Code and a Description, this gets very messy and hard to distinguish one with another.

for now, renaming all codes and descriptions manually is the only solution I found.

Regards,

Jelte

The detail table trick still works with the data you provided. Add an extraction step within a “for each” loop and extract the attributes and text value. You will end up with this kind of nested datamapper structure:

__record__
__Name____Value__
detail:
record.detail
TagCodeDescriptionValue
L65432XASA certain valuea
L11265FDsA certain valueb
L10001 Value1
L12498ASD1A certain valuec
L15678FDssA certain valued
L37654 Value2
L11010ASD4 A certain valuee

Your master record contains a single entry which is your detail table. The detail table contains all the tag information extracted from the XML, one entry per line.

You mentioned in your original post that wether the description is printed or not depends on the code. This can be done either in the data mapper as a condition in the loop or in the template by customizing the text.