cancel
Showing results for 
Search instead for 
Did you mean: 

Use sustring of FileName in Condition editor

Former Member
0 Kudos

Hi All,

I want to give some condition based on the substring of a file Name.

Example, in the file name is "header1234.txt" the characters from 7 to 10 represent a company code and the corresponding receiver should be determined based on this string.

I can use the complete file name when I select Context object in the editor and choose the object as File Name, but am unable to get a substring of that. I have a Xpath expression underneath the Context object, but it is disabled.

Any pointers are welcome.

Thanks

Jaishankar

P.S: I tired to put substring(Interface.FileName,7,4) in the Xpath manually, but the expression goes away just like that when i close the editor and open it again.

Edited by: Jaishankar on Oct 1, 2008 1:12 PM

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Assuming this feature is not supported. If some one has already done this please let me know. Your inputs would be of great help.

Thanks

Jaishankar

former_member192892
Active Contributor
0 Kudos

Enhanced receiver determination would do the trick.. You'll have to write a UDF to get the company code from file name. Also you'll need to set Adapter Spec Message Attributes for File Name.

The UDF will assign value to the service node in the target used for enhanced recv det.

Former Member
0 Kudos

You can use the Set Adapter Specific Message Attributes checkbox on the sender file adapter and check filename.

You can then access the filename in your mapping, substring it and put the resultant value into a destination field. You can then use this in your XPATH expression in the receiver determination.

Regards,

Pete

Former Member
0 Kudos

Hi Pete,

Thanks.

1. Xpatch/context object works on source/input payload and not on target payload.

2. I can use enhanced receiver determination and do this in Mapping, but I dont want to do that.

3. Let us consider a sample scenario, where my BPM receives 2 input file files. File 1 is header123.txt and file 2 is item123.txt

The correlation I need to use here is 123.

Thanks

Jaishankar

Former Member
0 Kudos

Try the x-path:

substring(substring-before(filename,"."),string-length(substring-before(filename,".")))

Former Member
0 Kudos

Hi Yaghya Nana,

Have you tried this expression? The problem I have is I can not get the file name in the Xpath expression editor.

Thanks

Jaishankar

Former Member
0 Kudos

Bumping up...