Home Page › Forums › BizTalk 2004 – BizTalk 2010 › How to take leading zeros from a string in BizTalk mapper
- This topic has 6 replies, 1 voice, and was last updated 9 years, 1 month ago by
community-content.
-
AuthorPosts
-
-
April 21, 2009 at 12:36 PM #22182
Hi I have a scenerio where from a source schema element which is a string has “001” I need to remove the Zeros and map to the destination element as “1” and if it has “010” then it should be set as “10”, the destination element is also string. How do I acheive this in BizTalk Mapper.
For the above scenerio I tried by writing VB code and I have assigned the string like this
cmd.Parameters(
“@String”).Value = inputstring.PadLeft(3, “0”c).ToUpper()
but its not working
Does anyone have an idea about this.
Thanks in Advance
-
April 21, 2009 at 1:10 PM #22184
How about using the Math Add functoid and add zero to this value
-
April 26, 2009 at 4:41 AM #22218
Hi, – he wants to remove leading zeroes, not to add. [:)]
-
May 19, 2009 at 12:46 PM #22409
[quote user="Zx7R"]
Hi, – he wants to remove leading zeroes, not to add.

[/quote]
The Math Add functoid will convert the string into a number add zero (number is unchanged) and outputs the number as a string without leading zeros.
This approach is easier than the custom functoid if you have a lot numbers in a message you need to convert. With the scripting functoid approach you will need a scripting functoid for each number, each with a different method name. Likewise, in an orchestration you could end up with a lot of xpath statements/distinguished fields to manage.
-
-
May 19, 2009 at 8:55 AM #22403
Great, this works nice[<:o)]
-
July 8, 2010 at 7:13 AM #25170
Great Solution yaar, its working fine
-
-
April 26, 2009 at 4:40 AM #22217
Hi,
1. You can use inline code in scripting functoid, and to replace every leading zeroes by empty string, and all that in a loop.
2. If you don’t wish use functoid – create a class and pass the string as a parameter in an orchestration, and all logic will sit in your external assembly.
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.