Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scripting Functoid - String manipulation (From one input node to multiple output nodes)

152 views
Skip to first unread message

Mani

unread,
Jul 21, 2009, 8:48:08 AM7/21/09
to
Hi,

I am a newbie to biztalk server.

In my inbound document, I have an element which has many values like
name, address1, address2, city, state with newline character as
delimeter. I have to split this values and set it to my outbound
document as different elements as name, add1, add2, city, state. I
tried using scripting functoid to split the string values, but I am
not sure how would I map those splitted values to different elements
in the outbound document.

Please help me.

Thanks.
Mani

Wolfgang Kluge

unread,
Jul 24, 2009, 4:58:40 PM7/24/09
to
"Mani" <psm...@gmail.com> schrieb im Newsbeitrag
news:3f88e2ca-f17b-4a49...@j32g2000yqh.googlegroups.com...


Hi Mani,
not sure if I've understood your problem...

If your inbound document has one(1) value and you need to split this value
into many elements of your outbound document, then there are several
solutions.
One of the simpliest is to use a scripting functoid for each outbound
element.

For example:
You have a inbond field named "Full name" and you want to split the value
and write them into 2 elements named "first name" and "last name".

Full name
- Scripting functoid 1: fullName.Split(' ')[0]
- first name
- Scripting functoid 2: fullName.Split(' ')[1]
- last name


Both functoids get their value from "Full Name". Functoid 1 sets its value
to "first name" and functoid 2 to "last name"...
By the way: fullName.Split() is no good style ;)

Greets, Wolfgang Kluge
http://gehirnwindung.de/
http://klugesoftware.de/

Mani

unread,
Jul 27, 2009, 8:59:36 AM7/27/09
to
On Jul 24, 4:58 pm, "Wolfgang Kluge"
<wolfg...@removeifnospamklugeSoftware.de> wrote:
> "Mani" <psma...@gmail.com> schrieb im Newsbeitragnews:3f88e2ca-f17b-4a49...@j32g2000yqh.googlegroups.com...
> Greets, Wolfgang Klugehttp://gehirnwindung.de/http://klugesoftware.de/- Hide quoted text -
>
> - Show quoted text -

Hi Kluge,

Thank you very much for your reply.

Yes, you got the problem correct. That's what I am trying to do and
for time being
I had already implemented the way which you have explained here, but I
am sure that's
not the correct approach and there should be a better way to do it.
Currently
we are receiving only two lines of data in the inbound field but in
future we will be
getting 4 to 5 lines of data in the inbound field and placing a
scripting functoid for
each line of data is not good. Please let me know if there is any
better approach to
handle this problem.

Thanks,
Mani

Wolfgang Kluge

unread,
Jul 27, 2009, 11:32:23 AM7/27/09
to
"Mani" <psm...@gmail.com> wrote in message
news:b30ab5e3-39c7-4e90...@o13g2000vbl.googlegroups.com...

>

Hi Mani,

there is a better approach, though. But I'm afraid that you want somewhat
else ;) Anyhow. Here are my suggestions.

You can cache the result of the split-function. Simply add a scripting
functoid to the mapper and add a variable definition (outside of the
function block). For example:

//"global" Scripting functoid
string[] _names = null;


Add a link from your FullName-node to each following functoid to read a name
part from.

//single scripting functoid
string GetNamePart(string fullName, int index){
if( _names == null ){
_names = fullName.Split(' ');
}
return _names[index];
}


If you always use the same function name and parameters, the function is
created only once. I think (but didn't know exactly) this is so, even if you
have differenences inside the function itself.

Another approach is to use table looping functoid, but you still have to
provide a scription functoid for every output value.
The last solution I know is to write and use your own custom functoid (but
that's only an enhancment for the first solution with its scripting
functoids).

Depending of what schemas you have exactly, there could be a somewhat better
approach, e.g. to write a scripting functoid with your own xslt-code where
you can use xsl:for-each and xsl:sort the entries or something like that.


A very much better solution (and this is my explicit recommendation) is to
divide the values inside the schema (if possible)...

Keep in mind, that the biztalk mapper goes from output to input. Every
linked output node results in a xslt-command. The input is only secondary
(if at all).
--
Regards, Wolfgang
Blog: http://gehirnwindung.de/
Company: http://klugesoftware.de/

Mani

unread,
Jul 27, 2009, 11:46:29 AM7/27/09
to
On Jul 27, 11:32 am, "Wolfgang Kluge"
<wolfg...@removeIfNoSpamklugesoftware.de> wrote:
> "Mani" <psma...@gmail.com> wrote in message
> Company:http://klugesoftware.de/- Hide quoted text -

>
> - Show quoted text -

Hi Kluge,

Thank you very much for your suggestions.

Thanks,
Mani

0 new messages