cancel
Showing results for 
Search instead for 
Did you mean: 

Default value in receiving element

glenn_karlsson2
Participant
0 Kudos

Hi all,

I have a need to map to a structure which have a "tagname" inside the element.

I map for example a phone number to an element and the receiving value should be "TelephoneNumber = 0345335454"

My first thought was to create a phone number datatype with two sub elements, like Tag and Value and in the data type definition somehow default the Tag value to "TelephoneNumber = " so that i didn´t have to map it at all in the message mapping.

Is that even possible?

Or are there any other ways to do it? I would like to be able to not have the need for mapping a value in message mapping (not even a constant), but use a default from the datatype.

kind regards,

Glenn

Accepted Solutions (0)

Answers (5)

Answers (5)

glenn_karlsson2
Participant
0 Kudos

Hi all,

I decided to not dwell on this issue anymore. I used concat on all fields. A few hours of work but that was all.

Thanks for all the input.

kind regards,

Glenn

glenn_karlsson2
Participant
0 Kudos

Hi all,

Apparently I have a problem stating my needs

I want to be able to create a target data strucure that when I map a value to a element I will include a "prefix" to the value, without the need to map the prefix.

I could of course do a concat in the graphical mapping so that I concat "TelephoneNumber = " and the source value "1234567" to create target value "TelephoneNumber = 1234567".

But the way I want it is to just map the actual phone number and get the prefix "for free". To clarify, the "TelephoneNumber = " -part is not the element name, but part of the element value.

Like this: <TelephoneNumber>TelephoneNumber = 1234567</TelephoneNumber>. Is that possible? I would like to be able to create the single elements as their own data type for reuse purposes.

kind regards,

Glenn

anupam_ghosh2
Active Contributor
0 Kudos

Hi Glenn,

I don't think this can be achieved without concatenating individually the field names along with their values. The method you have already explained yourself. In case you need for all fields respective field names to be concatenated with their field values in a generic manner then this is possible using java mapping. The java mapping would traverse the entire source xml and add the required prefix for each of the field.Thus you get everything in target XML as per your requirement. For this you need a mapping.

regards

Anupam

Former Member
0 Kudos

Hi,

In graphics mapping it can be handled easily, Still you donot want to do it.

make java mapping based on the element name. use it in interface mapping.

Regards,

N.Gunaseelan

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

I have a need to map to a structure which have a "tagname" inside the element.

I map for example a phone number to an element and the receiving value should be "TelephoneNumber = 0345335454"

I think you are referring to the attribute of an element e.g


<elementName telephoneNumber=""/>

Here, elementName is the element while telephoneNumber is the attribute. You can create this using a datatype called elementName and then press ctrlshifta to add an attribute, alternatively you can just create the add icon and then choose attribute.

somehow default the Tag value to "TelephoneNumber = " so that i didn´t have to map it at all in the message mapping.

Not sure what you meant here, but if you don't use it in the mapping, then it will default to TelephoneNumber = "". Please clarify.

Hope this helps,

Mark

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>Or are there any other ways to do it? I would like to be able to not have the need for mapping a value in message mapping (not even a constant), but use a default from the datatype.

Use Graphical Variable. You can reuse them in the target structure as much you want for many times. Refer the link provided by the above expert.

Former Member
0 Kudos

Hi.

In PI 7.1 you can use global variable for multiple times. and then concat with the value.

Regards.

Luis Ortiz