BizTalk - Retrieving Partial File name from the Full path in an Orchestration

Asked By Abhishek Iyer on 30-Aug-10 06:09 AM
I need to update a table in Sql server where the file name in the column would be something like "abc.xml". But how to get this in the orchestration as the (FILE.ReceivedFileName) property procures the entire name viz. "C:\Abc\Def\abc.xml"? So, it requires that the entire name be used in the database, which is not to be in my case.
Mohan Raj Aryal replied to Abhishek Iyer on 30-Aug-10 02:07 PM
Once you read the absolute file name with path you can read the name of the file only using some string manipulation function inside expression shape. You can use expression something like: 

myFileName =FILE.ReceivedFileName.Substring(FILE.ReceivedFileName.LastIndexOf("\")+1, FILE.ReceivedFileName.Length);

In this case myFileName is a orchestration string variable. Once you have filename in a variable you can assign this to your destination field using xpath or distinguished field. Once you populate this to the destination schema field of database you can insert this to the SQL server.