Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Biztalk mapper logic
- This topic has 2 replies, 1 voice, and was last updated 5 years, 4 months ago by
biztalkgurus.
-
AuthorPosts
-
-
October 17, 2005 at 3:05 PM #12065
I’m not sure I can even do this with Biztalk, but I wanted to convert a flat
file to a different format. The incoming flat file looks like this:60508000932015180208012100000000000115130001390000013900
60508001032010041207748730000000000029530001590000015900
60508001032010041207621610000000000029530001590000015900Position 10 – 18 is the Account number, 27 – 42 is the check number, 43 – 50
is the amount paid, and 51 – 58 is amount applied. I need to check if the
account number and check number match the previous record. If they match, I
need to change the line to begin with a 4 instead of 6, add the amount paid
to the previous record and replace the check number and amount paid with
blank spaces. It should look like this:60508000932015180208012100000000000115130001390000013900
60508001032010041207748730000000000029530003180000015900
4050800103201004120762161
00015900If anyone has ideas on how to do this, please let me know.
Thanks,
Greg -
October 20, 2005 at 5:08 AM #12066
Hello.
I’m assuming the records will always be in order and it is either 1 record or two.
In the past, we use the code below to compare the current value with the past value. It would return true (for them being the same) or false (if different).
You can use a scripting functoid with code like this to return true or false:
string sPastValue = \”\”;
string bReturn = \”\”;public string M1(string param1)
{
if (sPastValue!= param1)
{
sPastValue = param1;
bReturn = \”true\”;
}
else
bReturn = \”false\”;return bReturn;
}
This will let you know what type of mapping you need for the record. Then you can use conditional logic to map or add as needed. For the addition, I might try to use the Index functoid along with a counter in the above script to extract out the two values to add together.
Another option would be to use pure custom XSLT. I would think this would be doing using position() and position()-1 to check values and add them.
I would start in this order and work piece by piece:
Map the whole record as normal using the mapper using a looping functoid
Get the 6 replaced with a 4 on the correct row by using conditional logic
Get the sum to workMapper logic is hard to explain in a message and I find playing around with it is something the best way to figure it out.
Hope this helps.
-
November 12, 2020 at 5:13 AM #49802
biztalkgurus
The Dirty Girls Social Club by Alisa Valdés-Rodríguez : 9781250765864
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.