Tuesday, December 30, 2008

More options in Native Format Builder

INTRODUCTION:
This wizard helps you in creating XSDs for your sample files. This is used to create a native schema file from formats such as:- comma-separated value (CSV), fixed-length file, data type description (DTD), and Cobol Copybook.

SCENARIO:
Suppose you need to create a schema file for a pipe-delimeter or $ delimeter sample file. If you closely look into the options provided under Step 5 of 7 (If you select Delimited Radio button in Step1 of 7) in Native Format Builder, you will see only 5 options available i.e. Single Space, Comma, Semicolon, White space (any number of tab, space) and Tab.
Then how to create a pipe-delimeter or $ delimeter schema file??

SOLUTION:
Goto options provided under Step 5 of 7 (If you select Delimited Radio button in Step1 of 7) in Native Format Builder.
In the Fields ->Delimited by drop down option, double click. A pointer will appear. Now instead of using drop down option manually type the |(pipe).

Then finish off the wizard. Your work is done..So simple.
The pipe delimited file schema file is ready to use.

Keep learning and stay connected to SOA.

WISHING ALL THE BLOG READERS A VERY HAPPY NEW YEAR 2009.

Friday, December 26, 2008

Magikkk of 'Translate'

Ahhh...Writing blog after a longtime. During this time, got an oppurtunity to diagonise BPEL...so now thinking of sharing some of my knowledge and experiences with all.

INTRODUCTION:
Here I am going to discuss a very small function of XSLT:- TRANSLATE.
Translate function returns inputString with occurrences of characters in fromString replaced by the character at the corresponding position in toString. This function takes 3 parameters.

SYNTAX: translate(inputString as string,fromString as string,toString as string)

SCENARIO:
If we deal in currency values, often we see that the value is separated by commas. For example, Value1=2,000,000/Value2=3,000/Value3=30,000

Now suppose you need to store this value in the database. To acheive this you need to remove all the commas from the incoming value. For this purpose we have to use the TRANSLATE function.

SOLUTION:
For the above scenario, use Translate as:
translate(inputString as string,fromString as string,toString as string)

Here,
inputString as string= Your input XPath, for instance, /ns0:Order/ns0:Lines/ns0:UnitPrice/ns0:Money
fromString as string=","
toString as string=""

Now use a conversion function 'Number' to convert the string in number. Thats it and you are done.
Hope I have cleared my point.

Keep learning with me and MERRY CHRISTMAS to all the readers.