|
Home > Archive > BizTalk Server General > May 2006 > Mapping Issue
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Chris Taylor 2006-04-28, 1:14 pm |
| Ok, so I'm mapping an Order to an custom EDI output. The only thing I'm
stuck with is I've got a field called Order comments that gets passed on
from the web order. In my EDI I have the FTX record which I can have
multiple for an order, each with 2 lines in the notes, each 80 characters
max.
So If I have 161+ characters of notes, that would create at least two FTX
records for a given Comment line of that size.
How do I take the comments (after stripping them of CR/LF) and create
multiple FTX records. So kinda like the opposite of looping..
Thanks in advance.
chris
| |
| WenJun Zhang[msft] 2006-05-01, 7:17 am |
| Hi Chris,
The existing functoids of BizTalk cannot help on creating the new records
on the destination structure. The most convenient is writting your own
XPath expression to do this. Actually this can be done outside of your map.
Please refer to the string functions of XPath:
4.2 String Functions
http://www.w3.org/TR/xpath#section-String-Functions
Best regards,
WenJun Zhang
Microsoft Online Partner Support
This posting is provided "AS IS" with no warranties, and confers no rights.
| |
| Greg Forsythe 2006-05-01, 7:17 am |
| There is a way of splitting your input comment into multiple output records
in a map, its a bit of a hack.
You need 2 scripting functoids.
In the first scripting functoid use inline C# or you chosen script and add
the code to split the comment and output Xml
e.g.
public string splitComment(string comment)
{
int maxLen = 160;
int offset = 0;
int length = notes.Length;
string output = "";
while (length > 0)
{
string str = notes.Substring(offset, System.Math.Min(maxLen,
length));
output += "<FTX>" + str + "</FTX>";
length -= str.Length;
}
return output;
}
Do not connect this functoid to anything - this will generate a warning but
you can ignore this.
In the second functoid use Inline XSLT with the following code:
<xsl:value-of disable-output-escaping="yes"
select="userCSharp:splitComment(/ns0:Document/Comment)"/>
You will need to change the Xpath "/ns0:Document/Comment" to match your
document.
Connect this functoid to the FTX field in the destination schema.
If you have multiple comment fields to map, then you will need multiple
Inline XSLT scripting functoids, the C# scripting functoid can be reused.
Greg
"Chris Taylor" <ctaylor7480@newsgroups.nospam> wrote in message
news:emqyZDtaGHA.4340@TK2MSFTNGP03.phx.gbl...
> Ok, so I'm mapping an Order to an custom EDI output. The only thing I'm
> stuck with is I've got a field called Order comments that gets passed on
> from the web order. In my EDI I have the FTX record which I can have
> multiple for an order, each with 2 lines in the notes, each 80 characters
> max.
>
> So If I have 161+ characters of notes, that would create at least two FTX
> records for a given Comment line of that size.
>
> How do I take the comments (after stripping them of CR/LF) and create
> multiple FTX records. So kinda like the opposite of looping..
>
> Thanks in advance.
>
> chris
>
|
|
|
|
|