cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Did anybody come across this strange behavior of the MAG simulation function?

Either I'm doing something wrong, or it is buggy. Look at this:

- Test data in MIG (there are two positions with two different values for ZEILE):

Then in the MAG simulation, after entering the following XSLT code to this field mapping:

<xsl:value-of select="format-number(number($nodes_in/*),'#')"/>

I also tried with:

<xsl:value-of select="format-number(number($nodes_in/ZEILE),'#')"/>

This error occurs:

(Failed to simulate MAG: A sequence of more than one item is not allowed as the first argument of...)

However, in runtime, the mapping (function) works perfectly!

0 Likes
View Entire Topic
Ryan-Crosby
Active Contributor

Hi Philippe,

Yes, I have experienced this before and it's due to the input being a sequence instead of a single value. A combination of qualified node for E1EDP02 on the source side and mapping to the target would address the problem. Otherwise, you would need to create your mapping function so it generates the sequence in a for-each loop and calls the number() function per entry. The other option would be to try the replace function which does not have the same limitation I believe - that's what I use to remove leading zeroes.

Regards,

Ryan Crosby

philippeaddor
Active Participant
0 Likes

Hi Ryan,

Thank you for your input. Which function do you mean you use which does not have the limitation regarding the sequence? I understand that it's happening due to the sequence, but think it's a bug regardless (since it works as expected in runtime). Probably I should open an OSS note. But for now, qualifying the node does the trick here, but that's not possible where no qualifying node exists (like for E1EDP01).

philippeaddor
Active Participant

I think I just figured it out! It works also without qualifying the node (or for nodes without qualifying node). Simply map the parent node as well. (This is usually not necessary since the mapper implies the mapping of the parent when one of its child nodes is mapped.) The screenshot shows the mapped parent node and the successful simulation of the "remove leading zeros" function.

Thanks for the inspiration! 🙂

Ryan-Crosby
Active Contributor

Ahh yes, a lot of times I don't map the parent because as you mentioned it is implied, but I have certainly found occasions where it becomes necessary. It appears that you found one of those here 🙂 dc01fe2c84194f24b77a64b3dbe421fd I missed the first comment, but the function I use to strip leading zeroes is replace($nodes_in/*, '^0+', '')

philippeaddor
Active Participant

Exactly, I am still unsure when it's needed to map it and when not. The behavior of it is a bit erratic, I feel 😉