Solving the "If-Then-Else" problem in a map - part III

by eliasen 8. marts 2009 21:02

Hi all

So, I have written two previous posts about how to solve the If-Then-Else problem in a map. The first post discussed the way to use built-in functoids to solve the issue. The second post discussed the issues I had creating a custom functoid to do the job.

Well, I now have a new way of doing it, which is not just one functoid, but still it's prettier than what I can do with the built-in functoids.

Basically, as discussed in my post about the issues with the different functoid categories, a functoid that is in the String category cannot accept a logical functoid as input. A scripting functoid can accept a logical functoid as input, but I can't create a custom scripting functoid where I decide what script to appear inside the scripting functoid at design time.

So the solution I am describing in this post is a combination of the two.

This screenshot describes a map that solves the If-Then-Else problem:

IfThenElse

The blue functoid with the crappy icon is programmed by myself. It is a simple functoid, which takes in three parameters, which are all strings. First, it tries to convert the first parameter to a boolean. If this fails, a "false" is assumed. Then, if the boolean was true, the second parameter is returned and if it was false, the third parameter is returned.

Now, since a string functoid cannot take a logical functoid as an input, I use a custom scripting functoid that is very simple:

public string Same(string str)
{
return str;
}

Which is really annoying to have to do, since... well... I take in a string and return the exact same string. Oh well...

You can find my functoid and the project that uses it as file downloads at the bottom of this post. Note, that the functoid library contains a whole bunch of functoids, of which only one is relevant. The library contains all the functoids I built trying to solve the If-Then-Else issue. The only needed functoid will be included in my downloadable functoid library at a later point.

Now, the advantages of this solution is, that it only requires three functoids all together. The best I could do with the built-in functoids were four, and five were sometimes the prettiest solution.

Functoid library: here

Project that uses the functoid: here

--
eliasen

Tags:

Aded functoid that converts a string of substrings into lowercasse with a capital first letter.

by eliasen 4. februar 2009 00:09

Hi all

So, a colleague of mine is integrating with AS/400 and this system seems to be sending all strings as all-uppercase. So a company name might look like this: "JANS SUPERCOMPANY A/S". This really isn't what he wants output in the end, so I have built a functoid and added it to my downloadable collection, which converts the "JANS SUPERCOMPANY A/S" into "Jans Supercompany A/S". It has an optional set of strings that are not to be messed with :-)

Examples of output from the functoid. The second parameter is optional.

First input Second input Output
jan eliasen   Jan Eliasen
jan eliasen A/S JAn JAn Eliasen A/s
JAN ELIASEN A/S Jan,A/S Jan Eliasen A/S
This is a test string for the functoid tHIS,A,fOr,silly tHIS Is A Test String fOr the functoid

As always, you can download the functoid at http://www.eliasen.eu/DownloadSoftware.aspx - where you can also download the documentation.

--
eliasen

Tags:

BizTalk podcast

by eliasen 5. januar 2009 19:26

Hi all

After I gave a BizTalk presentation at Aalborg .NET User Group I got a message from Søren Spelling Lund from Århus .NET User Group who wanted to interview me about BizTalk for a Podcast. Naturally, I accepted, and the result can be found here.

Only in Danish, I am afraid.

--
eliasen

Tags:

eliasen.eu - ValidateXML

by eliasen 23. december 2008 20:38

Hi all

I have added a new program to be downloaded for free from http://www.eliasen.eu/DownloadSoftware.aspx. This time it is a program to help you do two things:

  1. Check an XML file to see if it is well formed
  2. Validate an XML file against an XSD schema

I have had the need for a small utility to do this several times, in case a customer has some XML, and they want to know if the XML is even valid. The check for well formed-ness can be done by simply opening the file in Internet Explorer, but that is just soooo slow for large files. I tried a 70MB XML file once. It took IE a couple of hours to open it and tell me what was wrong with the XML. My utility did it in a few seconds.

So, use it if you want...

--
eliasen

Tags:

MCTS: BizTalk Server 2006 R2

by eliasen 23. december 2008 20:37

Hi all

Today, I took the 70-241 exam in BizTalk 2006 R2.

I passed, and am now MCTS: BizTalk Server 2006 R2 :-)

I have now passed the exams in BizTalk 2000, BizTalk 2004, BizTalk 2006 and BizTalk 2006 R2. Anyone else out there who has done this? :-)

--
eliasen

Tags:

eliasen.eu - Draw

by eliasen 23. december 2008 20:27

Hi all

At Logica we often participate in different events where employees compete to see who rides their bike more often to work, who walks the most steps in a month, and so on. After a month of competition, we end up with a spreadsheet, where I may have walked 180.000 steps, but my colleague Henrik only walked 78.000 steps (He is kind of a wimp :-) )

So lets say that we want to give a prize to one of us, and Henrik should have a chance of 78000/(78000+180000) (30,23%) of winning and I should have a chance of 180000/(78000+180000) (69,77%) of winning. As the number of points and the number of contestants get bigger, this becomes increasingly difficult to manage.

Therefore, I have written a small winforms program, that helps you manage this. You can add as many contestants as you like, and give them points. If you are only interested in a "normal" draw, you can just give all contestants one point.

Screen shot:

eliasen.eu.draw.screenshot

The program not only does the draw, it will also:

  • Give you an overview of the contestants, their points and their chance of winning, which is dynamically updated each time a contestant is added
  • Give you the opportunity to simulate any number of draws, to ensure that the program is random. When doing the simulation, the percentage of wins by each contestant is shown next to the chance of winning, so they can be compared.

I will gladly take comments, bug reports, suggestions, postcards, et cetera :-)

The documentation can be found at http://www.eliasen.eu/DownloadSoftware.aspx#documentation and the program can be downloaded at http://www.eliasen.eu/DownloadSoftware.aspx#winform.

I hope this comes in handy to someone.

--
eliasen

Tags:

Baal top listener :-)

by eliasen 23. december 2008 20:27

Hi all

I am using http://www.last.fm to keep track of what I listen to, and to get inspired to listen to some new music that I didn't know I liked.

You can find my profile at http://www.last.fm/user/eliasen and you can find information about an excellent Danish band Baal at http://www.last.fm/music/Baal. Please note, though, that I listen to the Danish band Baal, and not the Japanese band that unfortunately shares the band name Baal with the Danish band.

Anyway, the point of this blog post is, that it seems that I am currently the top listener of Baal:

baal_top_listener

:-)

This means that I listen to more Baal than all that listen to either the Danish or the Japanese band...

I know... Get a life, damn it! :-)

Baal have a web site at http://www.baalworld.com - try it! :-)

--
eliasen

Tags:

Using BizTalk to integrate to Excel spreadsheets - Part III

by eliasen 23. december 2008 20:26

Hi all

It is time for the third posting in my series about using BizTalk to integrate to Excel spreadsheets. My first two postings are here (Installation) and here (The schema generation wizard).

This third posting is a talk about the runtime, and how it works.

The setup

To start out, I have done a simple test, and you can find my project

.

It has a simple spreadsheet and a schema for this spreadsheet (both are described in my previous post) and the setup basically just has a FILE Receive Location and a send port with a filter that takes everything from the Receive Port the Receive Location belongs to. My aim is to see how fast the Spread Disassembler is.

First, a short description of my setup:

My BizTalk installation is in a Microsoft Virtual PC 2007 virtual machine.

The host machine is a Hewlett Packard 8710w laptop with an Intel Core Duo T7700 2,4GHz CPU, 2GB of RAM and Windows XP Professional Service Pack 3 and completely updated as of 7'th December 2008.

The guest system is a virtual machine which has one 2,4GHz CPU, 1GB RAM and Microsoft Windows Server 2003 R2 Enterprise Edition SP2 - also completely updated as of 7'th December 2008.

The test

I created 999 copies of the same spreadsheet and moved them into a folder watched by the receive location. They were read, transformed into XML, and output into the output folder in 3:19 minutes. This is an average of 5 spreadsheets per second.

This took me by surprise - I had expected it to be faster. So I decided to do things more academic than looking at the time stamps of the output files. After all, there are PLENTY of functionality that could be the time consumer. So I created a BAM Activity and View, tracking when my Receive Port starts and when it ends.

A table showing the average processing time can be seen here:

Number of messages in test Average processing time per message Messages per minute
5 0,0227 seconds 2643
63 0,0337 seconds 1780
127 0,0584 seconds 1027
1966 0,2714 221

So it is pretty clear, that performance drops drastically when the load increases. I do not blame this on the Spread Disassembler, though. Since this is a virtual PC, with SQL Server on the same box as BizTalk, the mere I/O operations when writing all the output files to the hard drive conflicts with the I/O operations of BizTalk using the MessageBox. I find this a much more likely issue for the drop in performance than that the disassembler should get slower just because more messages come in.

So, to sum up, it seems that the Spread Disassembler can take a pretty heavy load - Up to 2643 messages per minute (44 messages per second). This is given less than ideal operating and hardware conditions, but optimal conditions with regards to the BizTalk Server not doing anything else at the time.

Maybe in a later post I will take a look at more complex spreadsheets/schemas and also test the performance of the assembler.

--
eliasen

Tags:

Blog went down the nasty way...

by eliasen 23. december 2008 20:23

Hi all

The company hosting the eliasen.dk domain went bancrupt last friday (19'th December 2008), and I only just found out this morning (Monday the 22'nd December).

So basically, everything since my last backup (27'th November 2008) is gone!

Right now, I am trying to setup the blog on the new server and trying to see if I can repost the blog posts I have written since the 27'th November.

--
eliasen

Tags:

Added functoid to read from app.cofig

by eliasen 27. november 2008 20:20

Hi all

A new functoid has been added to the collection of functoids that an be downloaded at http://www.eliasen.eu/Downloadsoftware.aspx.

The functoid simply takes one parameter, which is used as a key against BizTalks app.config (The BTSNTSvc.exe.config file in BizTalks installation folder) to read an application setting from the appSettings group.

So given a .config file like this:

<appSettings>
<add key="eliasen" value="eliasenValue" />
</appSettings>

and the parameter "eliasen" to the functoid, it will return "eliasenValue". If the key cannot be found, an empty string is returned.

And the documentation has also been updated - look at http://www.eliasen.eu/DownloadSoftware.aspx

--
eliasen

Tags:

About the author

Jan Eliasen is 37 years old, divorced and has 2 sons, Andreas (July 2004) and Emil (July 2006).

Jan has a masters degree in computer science and is currently employed at Logica Denmark as an IT architect.

Jan is a 6 times Microsoft MVP in BizTalk Server (not currently an MVP) and proud co-author of the BizTalk 2010 Unleashed book.

BizTalk Server 2010 Unleashed


Buy from Amazon

Microsoft MVP


6 times: July 2004, July 2008, July 2009, July 2010, July 2011, and July 2012. Not currently an MVP.

MCTS

Image to show

Month List

Page List