BizTalk Server Orchestration - Arrays in Biztalk

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Orchestration > August 2005 > Arrays in Biztalk





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 Arrays in Biztalk
pez

2005-08-09, 7:49 am

Hi

I have an orchestration where i receive a string that looks something like
this...

item1;item2;item3;item4......and so on.

As I understand it Biztalk doesn't support arrays (?!). How would you
suggest that I solve the following problem. I would like to loop through the
string while there are values in it using ; as a delimiter. Any suggestions?
Thanks
Yossi Dahan

2005-08-09, 7:49 am

pez wrote:
> Hi
>
> I have an orchestration where i receive a string that looks something like
> this...
>
> item1;item2;item3;item4......and so on.
>
> As I understand it Biztalk doesn't support arrays (?!). How would you
> suggest that I solve the following problem. I would like to loop through the
> string while there are values in it using ; as a delimiter. Any suggestions?
> Thanks

I guess your best bet is using a helper class.
create a .net class that will accept the string and parse it to an array
(or any other collection)
you can then expose the current item, items count and current iteration
and use these in the orchestration

Yossi Dahan
pez

2005-08-09, 7:49 am

Seems unbelievable that Biztalk doesn't support arrays. I mean, I can't be
the only one with this problem?

"Yossi Dahan" wrote:

> pez wrote:
> I guess your best bet is using a helper class.
> create a .net class that will accept the string and parse it to an array
> (or any other collection)
> you can then expose the current item, items count and current iteration
> and use these in the orchestration
>
> Yossi Dahan
>

Yossi Dahan

2005-08-09, 7:49 am

pez wrote:[vbcol=seagreen]
> Seems unbelievable that Biztalk doesn't support arrays. I mean, I can't be
> the only one with this problem?
>
> "Yossi Dahan" wrote:
>
>
No, you're not. in fact there have been quite a few posts about it in
the past I think, but that's how it currently.
I've heard the case might be different in 2006, but did not try it yet.

Yossi Dahan
pez

2005-08-09, 7:49 am

I'm afraid I'm not much of a coder. You don't have an example?

"Yossi Dahan" wrote:

> pez wrote:
> No, you're not. in fact there have been quite a few posts about it in
> the past I think, but that's how it currently.
> I've heard the case might be different in 2006, but did not try it yet.
>
> Yossi Dahan
>

Yossi Dahan

2005-08-09, 7:49 am

pez wrote:[vbcol=seagreen]
> I'm afraid I'm not much of a coder. You don't have an example?
>
> "Yossi Dahan" wrote:
>
>
This is a quick code snippet I've written for you
bare in mind this is nothing even close to a production quality, only an
example to the approach.

but you can have a class like:

public class ArrayHelper
{
string[] myArray=null;
public int Length
{
return myArray.Length;
}

public ArrayHelper(string arrayString, char delimiter)
{
myArray=arrayString.Split(delimiter);
}

public string GetItem(int location)
{
return myArray[location];
}
}


then in the orchestration you can initialize it
MyArrayHelper = new ArrayHelper(<your string>,'<your delimiter>');

in the loop condition you can use
loopCounter<=MyArrayHelper.Length

and then inside the loop you can access a single item
MyArrayHelper.GetItem(loopCounter)

you will need to set the variables MyArrayHelper of type ArrayHelper and
loopCounter of type Int.


I hope you will find this useful

Yossi Dahan
pez

2005-08-09, 5:53 pm

I've done what you recommended but now there seems to be another problem.
This is the error I get when I'm testing my solution...

File or assembly name ArrayHelper, or one of its dependencies, was not found.

Exception type: FileNotFoundException
Source: mscorlib
Target Site: System.Type InternalGetFieldType()


Any tips?

Thanks
"Yossi Dahan" wrote:

> pez wrote:
> This is a quick code snippet I've written for you
> bare in mind this is nothing even close to a production quality, only an
> example to the approach.
>
> but you can have a class like:
>
> public class ArrayHelper
> {
> string[] myArray=null;
> public int Length
> {
> return myArray.Length;
> }
>
> public ArrayHelper(string arrayString, char delimiter)
> {
> myArray=arrayString.Split(delimiter);
> }
>
> public string GetItem(int location)
> {
> return myArray[location];
> }
> }
>
>
> then in the orchestration you can initialize it
> MyArrayHelper = new ArrayHelper(<your string>,'<your delimiter>');
>
> in the loop condition you can use
> loopCounter<=MyArrayHelper.Length
>
> and then inside the loop you can access a single item
> MyArrayHelper.GetItem(loopCounter)
>
> you will need to set the variables MyArrayHelper of type ArrayHelper and
> loopCounter of type Int.
>
>
> I hope you will find this useful
>
> Yossi Dahan
>

Yossi Dahan

2005-08-09, 5:53 pm

pez wrote:[vbcol=seagreen]
> I've done what you recommended but now there seems to be another problem.
> This is the error I get when I'm testing my solution...
>
> File or assembly name ArrayHelper, or one of its dependencies, was not found.
>
> Exception type: FileNotFoundException
> Source: mscorlib
> Target Site: System.Type InternalGetFieldType()
>
>
> Any tips?
>
> Thanks
> "Yossi Dahan" wrote:
>
>

You have to make sure you add your assembly with the ArrayHelper to the GAC.
to do so you will need to add a strong name (in the assemblyinfo file
add the path to your key file)

Yossi Dahan
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com