Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Message Assignment – Split a delimited string to retrieve a value
- This topic has 6 replies, 1 voice, and was last updated 4 years, 1 month ago by khalis.
-
AuthorPosts
-
-
March 23, 2009 at 6:59 AM #21950
I have an EDI file that my orchestration is retrieving from the message box (i.e. in xml). I’d like to get one of the values from the ISA header – specifically ISA09 and ISA10.
I can get entire string (into the Message Assignment shape) which looks like this.
ISA*00* *00* *01*FIRST *01*98765LCSAPT*090318*1420*U*00401*000442082*0*T*^~
How can I split this to get the two values? ‘090318’ and ‘1420’? I seem to not be able to use String.Split, so I may be doing something wrong there.
Thanks.
-
March 23, 2009 at 12:15 PM #21957
Write a component which will do this for you. Maybe make one method which takes the position you want returned.
-
March 23, 2009 at 2:40 PM #21962
Can you promote the fields and get them that way?
Like:
stringISA09 = YourInstance(YourNamespace.PropertySchema.ISA09)
-
March 26, 2009 at 7:11 AM #21990
I think that a component will need to be the answer. The ISA fields are in the header of the original message, so can’t be promoted in a schema (so far as I know) – otherwise, no problem.
Fundamentally , this is a question about how to write C# in the Message Assignment and Expression Shapes. Does anyone know of a tutorial that addresses this? My fumbling around with ‘guessing’ what is available and not in these shapes is very frustrating.
Thanks for the help.
-
March 26, 2009 at 2:12 PM #22013
If your original schema is an Envelope and the content get splitted to secveral messages, the promoted property from the “Header” is available in each message’s Message Context. See the SDK for the dissassembler/assembler sample.
But if you like to continue the C# road here is a sample:
string header = “ISA*00* *00* *01*FIRST *01*98765LCSAPT*090318*1420*U*00401*000442082*0*T*^~”;
string [] arr = header.Split(‘*’);
string first = arr[9];
string second = arr[10];Compile this into an assembly, reference this assembly from your biztalk project and you are ready to use it from an expression shape. When using in runtime it has to be in the GAC, and for that reason strong named.
Kind Regards
Martin Bring
-
-
-
November 12, 2020 at 2:27 AM #49794biztalkgurus
The Prettiest by Brigit Young • 9781626729230
-
November 26, 2020 at 10:21 PM #51460khalis
Good ost
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.