Pages

Wednesday, November 30, 2016

BizTalk 2013 known issues: Cannot find itinerary designer project template after installing ESB Toolkit 2.2

The itinerary designer for the ​BizTalk ESB Toolkit is now part of the BizTalk Server installation media.

After installing everything if you find 'BizTalk ESB Itinerary Designer' template is still missing from VS


To resolve the issue, please try running: devenv.exe /setup 
(in a command lind of VS2012 directory)

Wednesday, May 18, 2016

some Useful open source tools

Notepad++ text editor
PuTTY is an SSH and telnet client (FTP)
Agent Ransack - Free File Searching Utility
Fiddler free web debugging proxy

Thursday, March 10, 2016

Sharing a Strong Name Key File Across Projects

If we try to share key files using the Visual Studio 2013 function on the signing property page, you'll find that the key file is copied into your project directory.  In a lot of cases this is exactly the desired behavior since it helps to group all of the artifacts that go into building your project into one location.  However, it is a common requirement that the key file not be copied into every project directory and instead referenced from a single common location.  You can still pull this off using Visual Studio 2013:

Step 1: Add the key file to your project using the Add Existing Item menu.

Add an existing item to the project

Step 2: In the add dialog, instead of choosing to add the key directly (which will make a copy into your project directory), hit the arrow next to the Add button and choose to add the key as a link.

Add a link to the key

Step 3: Go to the signing page of the project properties.  Your key file should now be on the drop down list of available keys.

Select the key on the signing page

Since the key is already a part of the project, Visual Studio will not  make a new copy of it.  One thing to notice, Visual Studio will reference your key as a relative path from the project file.  This may be exactly what you want -- but if you'd rather have a hard coded path, you can open up the project file and change the AssemblyOriginatorKeyFile (and the Include path of the Link to your key).
You'll also want to make sure that on the property sheet of the key file, the Build Action is set to None and Copy to Output Directory is set to "Do not copy" -- You don't want to accidentally start distributing your key file as an embedded resource!
Finally, there are a couple of tweaks you can make for asthetics. After setting up signing, some people like to add the key as a solution item, then edit the project files and add a False tag to the None tag including the key.  This presents the key in the Solution Explorer at the solution level rather than in each individual project.
Personally, I like to see the key file that each assembly will be signed with, but I don't want it cluttering the root level of the project's files.  The tweak I make is to edit the project files and change the Link tag to have a Properties prefix.  For instance, we might have:



Properties\App.snk



Thursday, September 24, 2015

Easy Promotion of Context Properties

As you’ll probably know, there are two types of properties in the context of a message: properties based on field values (MessageDataPropertyBase) and properties not based on fields (MessageContextPropertyBased). I’ll call the first ones Message Properties and the other ones Context Properties.

Message Properties based on message fields are automatically written and promoted into message context by BizTalk.
Context Properties not based on message fields can be assigned inside an orchestration using the expression Message(Property) = “value”;
One of the most interesting stuff about Context Properties is that are not tied to a concrete schema, so they can be used regardless the message type. A sample of a system context property is FILE.ReceivedFilename.

The problem of promoting context properties:
When you create a context property, not based on a message field, and you assign a value inside an orchestration, it is written, but not promoted. What does it means? it means that you cannot route the message based on this property.
Some days ago I had the situation where needed exactly this: content based routing based on a custom context property that had a value calculated inside an orchestration.

The trick:
In my case, the pipeline solution is not an option, since I’m routing between orchestrations via Direct Port Binding. Also, coding a custom component to promote a property seems to complex for me…
Somebody told me a good trick to promote context properties inside an orchestration, easy and direct:
Create a CorrelationSet based on the property.
Even if you are not going to use it, when you initialize a CorrelationSet, the Orchestration engine makes the promotion of the properties involved, since correlation is just an special kind of routing.

So now I have some dummy CorrelationSets, that I call Promote_CorrelationSet

nice and easy! :-)

Friday, November 14, 2014

Calling .Net assembly from Biztalk Orchestration: Where to put Config


BizTalk uses its own configuration file called btsntsvc.exe.config which is in the BizTalk program files directory. You can add your configuration sections into this file and then bounce the biztalk host instances to pick up the changes.
HOWEVER, this is not good practice. It's OK to do this when you have only a single BizTalk app server but if you need to scale out suddenly you have multiple config files to maintain.
The recommended approach is to use SSO to store app-specific Config data, since it's BizTalk's Config storage solution and therefore always available. I always use this method and have never had any problems (although there is some overhead associated with development and management).
Ref: http://stackoverflow.com/questions/10107460/call-net-assembly-from-biztalk-orchestration-where-to-put-config

http://seroter.wordpress.com/2007/09/21/biztalk-sso-configuration-data-storage-tool/

http://geekswithblogs.net/paulp/archive/2008/05/16/122205.aspx

http://geekswithblogs.net/paulp/archive/2008/06/09/122746.aspx

http://stackoverflow.com/questions/11744571/store-configurable-values-in-sso/11746059#11746059

Friday, October 25, 2013

How to save password for WCF Adapter in BizTalk binding file

Generally, it is not recommended to store passwords in the binding file and by default BizTalk administration UI clears it out when exporting binding to the xml file. But in development environment where you have automated continuous integration build and deployment not having password in the binding file will prevent application from starting and CI process fail. It can become tedious in staging deployments (TEST, UAT) as well, especially if you have multiple endpoints that use accounts with passwords. In such cases, having password for development account (hopefully not the same as production) in binding file can make life easier.
To do that, export binding file after application is fully configured. Open it and locate section(s) with configuration for the ports/locations of interest. For example for the WCF receive location it will be in:
<ReceiveLocationTransportTypeData><CustomProps>...</CustomProps></ReceiveLocationTransportTypeData>

Find emtpy password tag in this section that will look like:
"& lt;Password vt="1"/& gt;"
Change it to enclose you password value and vt attribute value to "8":
"& lt;Password vt="8"& gt;MyPassword& lt;/Password& gt;"

Save and use this binding for an automated deployment script.

Monday, December 10, 2012

XPath Inside Orchestrations in BizTalk


Working with XPath inside Orchestrations is a powerful and simple feature of BizTalk.

The help guide does a good job describing the process (under Using XPath in Message Assignment).

XPath queries can only be done against a Message and the results can be set to a Message, XML Document or other orchestration variables. XPath queries can also be executed against untyped messages. That is, a Message that is of type System.Xml.XmlDocument.

CRITICAL: BizTalk xpath can be used to both read values and set values inside your Message. To set values in message, we need to be inside a Message Construct shape.

Here are some of the things which we can do with xpath and how to do them:

- Set a single values inside a Message using xpath
   xpath(SingleXML, "//LineTotal") = nLineTotal;

- Extract a single piece of data out of a Message
  sCustomer = xpath(InXML,"string(//Customer)");

- Extract a single node out of a large XML Document and assign it to a message or  variable
 sXPath = System.String.Format("//Item[{0}]",nCount);
 xDoc = xpath(InXML, sXPath);

- Count the number of nodes or occurrences of something inside your message
  nNumberItems = System.Convert.ToInt32(xpath(InXML, "count(//Item)"));

A great resource for xpath functions and expressions is the W3Schools.

Thursday, July 5, 2012

cell phone Screen stays off throughout the call

Last week I drop my Cell Phone (Dell Venue Pro) and broke front glass. I order front glass screen from ebay and fix cell phone at home (Thanks to youtube).

Everything worked fine but I was facing issue related to -Screen stays off while making calls and after receiving calls (the screen turns off n stay that way till call ends). this was very frustrating as cannot do any activity after i dial number or receive call.

Thought something is obscuring the Light sensor or promimity Sensor, because during a call the screen being off is a feature.

You can fix it though in the EM app. You can adjust the sensor readings and the phone will function like normal. (IF NOT  it might be hardware defect). But i would suggest its worth trying.

1) Get the EM app, if you dont have it dial ##634# into the dialer

2) Get into the advanced menu by double tapping the black area and typing in "qwertyuiop"

3) Select "RD test", now enter *#6336# in the box that pops up.

4) Select "Sensors", and the "Proximity Sensor Config"

5) Set the following to these:

LED strength - 1
Diode select - 2
Pulse Count - 43

6) Hit set and then you are good to go!

FYI might needs to have this put in again everytime we reboot the phone, most other cell phones saves it.

ALTERNATE FIX: Fixed it by doing a calibration on the same prox sensor settings screen, but with my hand over the sensor to calibrate it to darkness. Then the sensor output started reading something other than 1023 (around 320 when light and 840 when dark) and it started working fine. all in one reading should be other than 1023. for me Pulse Count - 1 worked.

Saturday, May 5, 2012

Not Using "http://namespace#root" as BizTalk Message Type

Not Using "http://namespace#root" as BizTalk Message Type


This has come up twice for me in the past week: once while reading the tech review comments on my own book (due out in April), and again while I was tech reviewing another BizTalk book (due out in July).  That is, we presumptively say that the BizTalk “message type” always equals http://namespace#root when that’s not necessarily true.  Let’s look at two cases demonstrated here.
This first simple case looks at a situation where an XML schema actually has no namespace.  Consider this schema
Perfectly fine schema, no target namespace.  I’ve gone ahead and created another schema (with namespace) and mapped the no-namespace schema to the namespace schema.  After I deploy this solution and create the necessary ports to both pick up and drop off the message, I can stop the send port and observe the context properties of the inbound message.
Notice that my message type is set to ReturnRequest which is the name of the root node of my schema.  Obviously, no namespace is required here.  If I throw my map on the send port, I can also see that the source schema is successfully found and used when mapping to my destination format.
So, for case #1, you can have schemas with no namespace, and the message type for that message traveling through BizTalk is in no worse shape.

Friday, September 30, 2011

Get Localize DAte format

[pass parameters date, language and country and output local datetime]

public static string How2GetLocalizedDate(string INdate, string INlanguage, string INcountry)
 {
  if ((!string.IsNullOrEmpty(INdate)) && ((!string.IsNullOrEmpty(INlanguage))) && (!string.IsNullOrEmpty(INcountry)))
 {
    DateTime dt = DateTime.Parse(INdate);
    // Sets the CurrentCulture property to U.S. English.
    Thread.CurrentThread.CurrentCulture = new CultureInfo(INlanguage + "-" + INcountry);
    // Displays dt, formatted using the ShortDatePattern
    // and the CurrentThread.CurrentCulture.
    return dt.ToLongDateString();
  }
else
{
   return "";
 }
}

Monday, August 8, 2011

The dependent tool 'svcutil.exe' is not found

I compile a new WCF application and upon running gave the error
(WCF Test Client)(debug-startnewInstastance)

"The dependent tool 'svcutil.exe' is not found. "

To solve this problem install the Windows SDK .Net 3.5 Here the link to download it from. Install that and the WCF Test Client should run without error

IF Windows SDK .net 3.5 i already installed on system then
Verify and copy nd paste 'svcutil.exe' at path C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin.Now it should run fine.I suppose that 'svcutil.exe' was erased from machine while installing higher versions of framework. – 

Wednesday, July 20, 2011

Double Integer

Convert integer into double (100) (100.0)
use of N1, N2

public string retDoubleInteger(string Integer)
{
    return (Convert.ToDouble(Integer).ToString("N1"));
}

-----------------------------------------------------------------------------------------------------------
Convert (datetimetype) Date to yyyy/MM/dd (stringtype)format takes care of null or empty dates

public string serviceFormatDate(string inputDate)
   {
       if (!string.IsNullOrEmpty(inputDate))
   {
          System.DateTime date = System.DateTime.Parse(inputDate);
          inputDate = date.ToString("yyyy/MM/dd");
   }
   else
    {
         inputDate = " ";
    }
return inputDate;
}

----------------------------------------------------------------------------------------------------------
String Replace (all is "well") (all is well)

public static string CleanStringanything(string pur)
        {
            return pur.Replace("\"", "");
        }

----------------------------------------------------------------------------------------------------------
Flag status (true)(0)

public string FlagStatus(string strFlagStatus)
{
    if (strFlagStatus== "true")
       {
           return "0";
       }
   else
      {
            return "1";
       }
}

-----------------------------------------------------------------------------------------------------------
Multiple IF conditions return

public static string StatID(string strStatID)
        {
            if (string.Equals(strStatID, "pur"))
            {
                return "A";
            }
            if (string.Equals(strStatID, "sha"))
            {
                return "B";
            }
            if (string.Equals(strStatID, "krt"))
            {
                return "C";
            }
            if (string.Equals(strStatID, "arp"))
            {
                return "D";
            }
            if (string.Equals(strStatID, "mon"))
            {
                return "E";
            }
            return "NOTVALID";
        }
-----------------------------------------------------------------------------------------------------------
Return nd split (5a), (5)(a)

public string ExtractNum(string numcode)
{
           string[] numbers = Regex.Split(numcode, @"\D+");
           string RetNum = "";
foreach (string value in numbers)
{
   if (!string.IsNullOrEmpty(value))
   {
int i = int.Parse(value);
                                RetNum = RetNum + i;
   }
}
return RetNum;
}

--    --    --
public string RetString(string numCD)
{
    return  Regex.Replace(numCD, @"\d", "");
}

------------------------------------------------------------------------------------------------------------
Sometihng abt conversions of date

public string FDate(string inputDate)
    {
      System.DateTime date = System.DateTime.Parse(inputDate);
      return date.ToString("yyyy-MM-dd");
     }
-------------------------------------------------------------------------------------------------------------

same thing we did before

public string ExtractNum(string Dizycode)
{
           string[] numbers = Regex.Split(Dizycode, @"\D+");
           string RetNum = "";
foreach (string value in numbers)
{
   if (!string.IsNullOrEmpty(value))
   {
int i = int.Parse(value);
                                RetNum = RetNum + i;
   }
}
return RetNum;
}

public string RetString(string DizyCD)
        {
            Regex r = new Regex("(?:[^a-z0-9 ]|(?<=['\"])s)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
            DizyCD = r.Replace(DizyCD, String.Empty);
            return Regex.Replace(DizyCD, @"\d", "");
        }
-------------------------------------------------------------------------------------------------------------
replace phone ((265)) to (265)
public static string CleanPhoneNumber(string hone)
        {
            return Regex.Replace(hone, @"[\(\)\-\.\s]", "");
        }

------------------------------------------------------------------------------------------------------------
striped off leading zero (0241)(241)
public string reformData(string Data)
{
if (string.IsNullOrEmpty(Data)) return Data;
else if (Data.StartsWith("0")) return Data.Substring(1, Data.Length-1);
else return Data;
}
-------------------------------------------------------------------------------------------------------------
add fix alpha (0245)(E0245)
public string retstrStat(string strStat)
 {
   if (!System.String.IsNullOrEmpty(strStat))
      {
        return "E"+strStat;
      }
  else
    {
       return "";
   }

Tuesday, July 19, 2011

Selecting the flat file disassembling schema dynamically

COMING SOON

Configuring BizTalk Orchestrations to handle un-typed messages

Found one of useful article thought of sharing
A typical orchestration in BizTalk deals with several kinds of messages. A message in BizTalk is always strongly typed. It is usually associated to some schema defined in the project. A Receive/Send shape in an orchestration is tied to a message declared in the Orchestration View. In the case of an un-typed message, the message type is set to 'System.Xml.XmlDocument', instead of a schema type. The class "XmlDocument" is a super class for all XML messages, and hence it can hold any type of XML message and subsequently any type of orchestration message. To summarize, an un-typed message is one whose message type is set to "XmlDocument" in an orchestration
Consider that we are integrating several small messages into a StoreFront application. This application deals with several kinds of messages like "Car", "Music" and "Book". These messages need to be integrated into a "StoreFront" message. So, a designed orchestration would receive several different types of messages. The orchestration in the article is shown below:

In the above orchestration, the "Send" and "Receive" shapes can handle any type of message. It is because the "Receive" shape is associated with a message which is of type "XmlDocument".

The Decision shape separates out the different kinds of messages.

// Message Type consists of TargetNamespace#SchemaRootElementName
InputMessage(BTS.MessageType) ==
// Message Type consists of TargetNamespace#SchemaRootElementName
InputMessage(BTS.MessageType) ==
// Message Type consists of TargetNamespace#SchemaRootElementName
InputMessage(BTS.MessageType) ==
Notice the commonality in the above schemas. A quick explanation of one of the schemas is as follows:
The schema "Car.xsd" has the following properties:
RegID - The registration ID.



Make - The make of the car.
Model - The year of manufacture.
Operation - Can be either "BUY" or "SELL".
ExpectedPrice - The expected price.
The "InputMessage" message is specified in the Receive shape:

The "OutputMessage" message is specified in the Send shape:
The Message Assignment shape has the following lines of code:

Biztalk Port File Name Macros

If you ever wanted to know how to use any other file name macros other than %MessageID% here they are:

%datetime%

Coordinated Universal Time (UTC) date time in the format YYYY-MM-DDThhmmss (for example, 1997-07-12T103508).

%datetime_bts2000%

UTC date time in the format YYYYMMDDhhmmsss, where sss means seconds and milliseconds (for example, 199707121035234 means 1997/07/12, 10:35:23 and 400 milliseconds).

%datetime.tz%

Local date time plus time zone from GMT in the format YYYY-MM-DDThhmmssTZD, (for example, 1997-07-12T103508+800).

%DestinationParty%

Name of the destination party. The value comes from message the context property BTS.DestinationParty.

%DestinationPartyID%

Identifier of the destination party (GUID). The value comes from the message context property BTS.DestinationPartyID.

%DestinationPartyQualifier%

Qualifier of the destination party. The value comes from the message context property BTS.DestinationPartyQualifier.

%MessageID%

Globally unique identifier (GUID) of the message in BizTalk Server. The value comes directly from the message context property BTS.MessageID.

%SourceFileName%

Name of the file from where the File adapter read the message. The file name includes extension and excludes the file path, for example, foo.xml. When substituting this property, the File adapter extracts the file name from the absolute file path stored in the FILE.ReceivedFileName context property. If the context property does not have a value, for example, if message was received on an adapter other than File adapter, then the macro will not be substituted and will remain in the file name as is (for example, C:\Drop\%SourceFileName%).

%SourceParty%

Name of the source party from which the File adapter received the message.

%SourcePartyID%

Identifier of the source party (GUID). The value comes from the message context property BTS.SourcePartyID.

%SourcePartyQualifier%

Qualifier of the source party from which the File adapter received the message.

%time%

UTC time in the format hhmmss.

%time.tz%

Local time plus time zone from GMT in the format hhmmssTZD (for example, 124525+530).

Customize filename dynamically in Orchestration

In many cases it can be useful to know the exact name of your output file that will be sent from your Orchestration using the File Adapter. This can be difficult if you are using the %MessageId%.xml macro to write the file since this it set after the message is sent from the Orchestration.

Delivery Notification can help you determine if your message was sent successfully but it can not give you the file name.

BizTalk 2004 has two ways to dynamically name your files from inside the Orchestration. The two ways to accomplish this are either to use a Dynamic Send Port or to use the %SourceFileName% macro on the Send Port.

Dynamic Send Port

Dynamitic Send Ports are powerful and useful if you need to send your files to many different locations on the file system like sometime to C:\data\ and other times c:\root\. The downside is you need to have all this information inside your message or hard code it in the Orchestration. So, it can be difficult to change.

Source File Name Macro

This is my preferred approach to Output File Naming. This does not require your data or the Orchestration to have any idea as to the directory you want to write your file to. This requires using the %SourceFileName% macro to set the output file name inside the Send Port.

Don’t want the same name as your input file you say? Now, here is the trick. Just change the File.ReceivedFileName property inside the Orchestration to be anything you want! This can be done by creating a new message and changing the context property. The code inside a Message Assignment shape would look like this:

// Create a new message

OutMessage = InMessage;

// Set the ReceivedFileName context property

OutMessage(FILE.ReceivedFileName) = "SetInOrch.xml";

It is not required to demote this value into your message. So, this method works with the Pass Through Send Pipeline because this context value is used by the File Adapter and not the pipeline.

CRITICAL: The %SourceFileName% macro does not need an additional extension (like .xml or .txt) after it like the %MessageId% macro.

---------------------------------------------------------
msgPerson2 = msgPerson;

fileName = msgPerson2(FILE.ReceivedFileName);
fileName = System.IO.Path.GetFileName(fileName.Replace(".txt",".xml"));
msgPerson2(FILE.ReceivedFileName) = "output_" + fileName;
---------------------------------------------------------

Sunday, July 17, 2011

Promoting reoccuring elements

Found one useful article written by eliasen: Well, I suppose we have all been there – in order to get the business process running, a specific element from a schema needs to be promoted in order to route on it, correlate on it, and so on.

Unfortunately, elements that can occur more than once can not be promoted. This, off course, makes perfectly sense, since the property can only hold one value, and how would BizTalk know which one of the many occurring elements to take the value from at runtime? So we agree with the limitation, but hope for a nice solution. :-)

If you try to promote a reoccurring element, you get this error when adding it to the list of promoted properties

“This node can occur potentially multiple times in the instance document. Only nodes which are guaranteed to be unique can be promoted.”

Right. Now, some people have found the editor for the XPath describing the element that one wants to promote. If you have promoted some element, you can click on it like this

Then you can click on the dot at the right of the line, and get into the editor like this

Now, wouldn’t it be lovely, if you could just change this expression to include for instance an index on the reoccurring element? In my example from this screenshot, the “ReoccuringRecord” record can occur multiple times. So it would be nice, if I could just change the XPath to be like this:

/*[local-name()='ExampleRoot' and namespace-uri()='http://PromotingReoccuringElement.ExampleSchema']/*[local-name()='ReoccuringRecord' and namespace-uri()=''][1]/*[local-name()=’ElementWhereNumber1IsPromoted’ and namespace-uri()='']

By setting the “[1]” into the XPath, I state that I will be needing the first occurrence of the ReoccuringRecord and therefore, this XPath expression will always give me exactly one node. Unfortunately, the engine can not see this, so the error will be the same, only difference being that this error doesn’t occur until compile time:

Node "ElementWhereNumber1IsPromoted" - The promoted property field or one of its parents has Max Occurs greater than 1. Only nodes that are guaranteed to be unique can be promoted as property fields.

Bummer!

So how do we get this working? If I really need to promote a value that occurs in an element that might occur multiple times, I see four options:

  1. Map to a schema on receive port
  2. Custom pipeline component
  3. Orchestration to do it and then publish to MessageBox
  4. Call pipeline from orchestration
I will go these options in more detail here:

Option 1: Map to a schema on receive port.

When a map is executed on a receive port, some extra magic functionality is performed by BizTalk. After the map has been executed, the message is sent through some code that promotes properties that are specified inside the destination schema. If you execute a map inside an orchestration, this doesn’t happen.

So you can create a schema that has an extra field, in which you place the value that needs to be promoted. This element must not be able to occur multiple times. Promote this new field, and after the map on the receive port has been executed, you have your value promoted.

Option 2: Custom Pipeline Component.

It isn’t that difficult to create a custom pipeline component, that can promote a field for you. Your Execute method might look just like this:

public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(IPipelineContext pContext, Microsoft.BizTalk.Message.Interop.IBaseMessage pInMsg)
{
    pInMsg.Context.Promote("MyProp", "http://ReoccuringElement.PropertySchema", "MyValue");
    return pInMsg;
 }

Of course, you will probably want to load the body stream of the IBaseMessage somehow, in order to find the value inside the body to promote and then replace "MyValue" with the value form within the XML.

Just use the pipeline component inside a custom receive pipeline, and you are all set.

Option 3: Orchestration to do it and then publish to MessageBox

Create a intermediate orchestration, that gets the input message. Then, it should create a new message of the same type in a message assignment shape like this:
NewMessage = InputMessage;
NewMessage(*) = InputMessage(*);
NewMessage(MyNewProperty) = xpath(InputMessage, xpathexpression);

Then, use a direct bound port to publish the message to the MessageBox. In order for the new property to follow the message, you need to initialize a correlation set on the send shape that is based on this new property.

Let other orchestrations and send ports subscribe to this message and let then do their work.

Option 4: Call pipeline from orchestration

The last option is to call a receive pipeline from within your orchestration. This requires a new schema, that has a field for the value to be promoted, just as in option 1. Inside your orchestration, map the input message to this new schema, and call a receive pipeline with this new message as a parameter. Remember to promote the field in this new schema. There is an article on MSDN about calling a pipeline from within an orchestration, which can be found at http://msdn2.microsoft.com/en-us/library/aa562035.aspx

Upsides and downsides

In order to choose which way to go in a specific solution, several things need to be considered.

Basically, I'd go for option 1 almost anytime. This is because it is best practices to map anything incoming into a canonical schema anyway. So instead of promoting values inside all your partners schemas - schemas they might change, you should promote from within your own canonical schema.
Reasons not to choose option 1 include: The canonical schema also has a reoccurring element, so it hasn't provided extra functionality with regards to getting this specific value promoted. Or perhaps, we aren't using canonical schemas, because there was no time for this when the project was started.
If we can't go for number 1, I'd go for number 3. Number 2 requires programming of a pipeline component, which can be a bottleneck, unless done correct. Also, the pipeline component is a whole new component to maintain, document and test. Number 4 requires a new schema and therefore also a map to be built. If I am ready to do this, I'd go for number 1 instead.
If I don't like number 3, for unknown reasons, I'd go for option 2 - the custom pipeline component. Allthough it is custom code, and must be done right, and testet and everything... I still feel that creating a new schema and map in order to call the pipeline in option 4 is overkill, since I'd go for option number 1 instead, which would also require the new schema and map.
I hope this explains some details about this issue, and that it helps someone in the future.

Saturday, July 9, 2011

Flat File Messages with Positional Records

Positional records within a flat file instance message contain individual fields (items of data) that are each of a predefined length. The fields are parsed according to these lengths.

The character used to fill the unused portion of each field, known as the pad character.

Field Padding: Pad characters are used in fields within both delimited and positional records when the data contained within the field smaller than the number of characters or bytes reserved for the field. These characters occupy the portion of the field not required by the data, if any. Pad characters are specified on a field-by-field basis using the Pad Character and Pad Character Type properties of the corresponding Field Element and Field Attribute nodes. If no pad character is specified for a particular field, the default pad character, space (" "), is used for that field

For inbound instance messages, regardless of whether a particular record is positional or delimited, the flat file disassembler discards leading or trailing instances for the specified or default pad character for a particular field as the instance message is translated into its equivalent XML form. Whether it is leading or trailing instances of the relevant pad character that are discarded depends on whether the Justification property of corresponding Field Element and Field Attribute node is set to Right or Left, respectively.

For outbound instance messages, the flat file assembler will insert the appropriate number of the specified or default pad character into fields so that the length of the field is correct. The pad characters will be inserted before or after the data characters based on whether the Justification property of the corresponding Field Element and Field Attribute node is set to Right or Left, respectively.

When the field to be padded in an outbound instance message is contained within a positional record, the Positional Offset and Positional Length properties of the corresponding Field Element or Field Attribute node, combined with the number of data characters that the field must contain, determine whether any pad characters are required, and if so, how many. When the field to be padded in an outbound instance message is contained within a delimited record, pad characters are only inserted when the value of the Minimum
Length with Pad Character property of the corresponding Field Element or Field Attribute node exceeds the number of data characters.

Wednesday, July 6, 2011

Extract Digits nd Char out of string with Regular expression

Extract Digits out of string with Regular expression

public string ExtractNum(string xnumberx)
{
        string[] numbers = Regex.Split(xnumberx, @"\D+");
        string RetNum = "";
foreach (string value in numbers)
   {
      if (!string.IsNullOrEmpty(value))
             {
                int i = int.Parse(value);
                RetNum = RetNum + i;
             }
    }
       return RetNum;
}

Extract Char out of string with Regular expression

public string RetString(string strspcex)
   {
      return Regex.Replace(strspcex, @"\d", "");
   }

Clean Telephone Number with Regular expression

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;

namespace GOSI.Motion
{
    public class StringUtils
    {
       public static string CleanTelephoneNumber(string inputString)
           {
               return Regex.Replace(inputString, @"[\(\)\-\.\s]", "");
           }
    }
}