BizTalk Server General - XML to Flat File Note Records

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > August 2005 > XML to Flat File Note Records





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]

Author XML to Flat File Note Records
JoelGBrown24

2005-08-25, 6:02 pm

Hello,
We are mapping from an xml description that can be very large to an EDI
like format where you can have up to X number records that are X chars
each. So we need to split up the description in to many records.

Example:

Source:
<ProductDescription>
TRANSFORMER-PAD MOUNTED, SINGLE PHASE, 167 KVA, 22,860 GRD
AY/13,200-240/120 VOLT, LOOP TYPE, AS PER SES SPECIFIC-TION #SES-PD-016
(REV 3) DATED 08/97.
</ProductDescription>

Wanted Output:
PID4ATRANSFORMER-PAD MOUNTED, SINGLE PHASE, 167 KVA, 22,860 GRD
PID4AY/13,200-240/120 VOLT, LOOP TYPE, AS PER SES SPECIFIC-
PID4AATION#SES-PD-016 (REV 3) DATED 08/97.

Now we have writen a C# functiod that counts the words and chars and
builds an XML structure that can be placed in the output, and then we
pass the output of this functiod to a xslt templete disabling the escape
charaters.

Custom Functiod output:
<PID4A><ProductDesc>TRANSFORMER-PAD MOUNTED, SINGLE PHASE, 167 KVA,
22,860 GRD</ProductDesc></PID4A>
<PID4A><ProductDesc>Y/13,200-240/120 VOLT, LOOP TYPE, AS PER SES
SPECIFIC- </ProductDesc></PID4A>
<PID4A><ProductDesc>TATION#SES-PD-016 (REV 3) DATED 08/97.
</ProductDesc></PID4A>

Now our issue is when we use the xslt templete to disable the escape
charaters, then if someone puts an "&" in the note then the map blows up.

My Question is is their a better way to do this? Maybe a combination of
custom functiod and the table looping functiod?

Thank you,
Joel G. Brown
WenJun Zhang[msft]

2005-08-26, 2:50 am

Hi Joel,

I think another approach may be separating the product description
string below and processing it as a flat file. You can define
delimiter based flat file schema for it. In this case, all the fields
will be more controllable within the map and custom functoid should
not necessary.

TRANSFORMER-PAD MOUNTED, SINGLE PHASE, 167 KVA, 22,860 GRD
AY/13,200-240/120 VOLT, LOOP TYPE, AS PER SES SPECIFIC-TION
#SES-PD-016
(REV 3) DATED 08/97.

Thanks.

Best regards,

WenJun Zhang
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no
rights.

JoelGBrown24

2005-08-26, 7:53 am

WenJun Zhang[msft] wrote:

> Hi Joel,
>
> I think another approach may be separating the product description
> string below and processing it as a flat file. You can define
> delimiter based flat file schema for it. In this case, all the fields
> will be more controllable within the map and custom functoid should
> not necessary.
>
> TRANSFORMER-PAD MOUNTED, SINGLE PHASE, 167 KVA, 22,860 GRD
> AY/13,200-240/120 VOLT, LOOP TYPE, AS PER SES SPECIFIC-TION
> #SES-PD-016
> (REV 3) DATED 08/97.
>
> Thanks.
>
> Best regards,
>
> WenJun Zhang
> Microsoft Online Partner Support
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>

Can you provide some more details, This is a free form description, and
the out bound format is a fixed length CRLF delimated file. Please advise.

Regards,
Joel G. Brown
WenJun Zhang[msft]

2005-08-29, 7:49 am

Hi Joel,

I mean you should be able to process the product description part of
the input file directly by defining a flat file schema of it. Then
define another positional flat file schema of the output file, and
modify the fields in map.

For reference to create positional flat file schema, you can look at:

http://www.winterdom.com/dev/bts/BTSFFSchemaTut1.html

Best regards,

WenJun Zhang
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no
rights.

JoelGBrown24

2005-08-29, 5:56 pm

WenJun Zhang[msft] wrote:
> Hi Joel,
>
> I mean you should be able to process the product description part of
> the input file directly by defining a flat file schema of it. Then
> define another positional flat file schema of the output file, and
> modify the fields in map.
>
> For reference to create positional flat file schema, you can look at:
>
> http://www.winterdom.com/dev/bts/BTSFFSchemaTut1.html
>
> Best regards,
>
> WenJun Zhang
> Microsoft Online Partner Support
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>

I have setup a project the way your have stated above. Mapping the
inbound xml document's product descrption to the destination flat file,
not using any functiods and it does not work. How does the biztalk
mapper know when to break the note and put it on to the next line?
WenJun Zhang[msft]

2005-08-30, 8:02 am

Hi Joel,

You need to extract the string from the XML input doc first and then
process it as flat file. The tags must be removed first.

TRANSFORMER-PAD MOUNTED, SINGLE PHASE, 167 KVA, 22,860 GRD
AY/13,200-240/120 VOLT, LOOP TYPE, AS PER SES SPECIFIC-TION
#SES-PD-016
(REV 3) DATED 08/97.

Then you should define some delimiters of it to create the source
flat file schema. Or a more simple way is using string functoids
directly within the map to separate the string into part and add the
PID4A header.

However I cannot figure out the rule to break a line with CRLF from
your sample output? Should some reserved words be TRANSFORMER, GRD,
ATION, etc?

PID4ATRANSFORMER-PAD MOUNTED, SINGLE PHASE, 167 KVA, 22,860 GRD
PID4AY/13,200-240/120 VOLT, LOOP TYPE, AS PER SES SPECIFIC-
PID4AATION#SES-PD-016 (REV 3) DATED 08/97.

Best regards,

WenJun Zhang
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no
rights.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com