Getting Output filename and extension same as the incoming filename and extension
I need to create a SFTP send port where I should get the output file name and extension same as that of the incoming filename
I had set the filename in the send port as "%SourceFileName%" but this did not work.
I have also assigned the input filename (without extension) in a variable in orchestartion. Is there any way i could get the output filename and extension same as that of the incoming message?
Any help would be much appreciated
-
Edited by
ReKi111
5 hours 7 minutes ago
February 11th, 2015 12:14pm
Hi,
The %SourceFileName% macro maps to the context property BTS.ReceiveFileName that travels with your message in the context. So in order for this macro to work in a send port the message that is going out needs to have this BTS.ReceiveFileName property on
the context. You probably creating a new message in your orchestration and sending that out. The new message does not have the property on its context which makes it fail. Use a message assignment shape in your orchestration to set the context property for
the message going out:
MyMessage(BTS.ReceiveFileName) = OrigMessage(BTS.ReceiveFileName);
Then %SourceFileName% macro will work at send port.
Rachit
February 11th, 2015 12:38pm
Few things:
- You can only get the original file name from the File Adapter or FTP Adapter.
- They will populate the FILE.ReceivedFileName property
with the full path so you will have to extract just the file name.
- You have to preserve this value through the entire process, including all in between Orchestrations.
- On the final outbound message, you have re-set, does not have to be Promoted, FILE.ReceivedFileName again to make it available through the %SourceFileName% macro.
MyOutgoingMessage(FILE.ReceivedFileName) = MyOriginalFilenameVariable;
Note: The property name is FILE.Receive
dFileName.
-
Edited by
Johns-305 [boatseller]
17 hours 15 minutes ago
-
Proposed as answer by
M.R.Ashwin PrabhuMVP
17 hours 1 minutes ago
February 11th, 2015 1:12pm
In addition to what others have said here, in your Orchestration in Message assignment shape (while constructing the outbound message) use the following code directly.
msgOut(FILE.ReceivedFileName) = System.IO.Path.GetFileNameWithoutExtension(msgIn(FILE.ReceivedFileName));
February 11th, 2015 1:29pm
Hi Reki,
By Default file Adapter will not promote the ReceivedFile Name property(It will be added to context only).
Promote ReceivedFile Name property in your receive pipleline then user %SourceFileName% macro in send pipeline .
It will give you the result.
Thanks &Regards,
Ammu.
February 11th, 2015 3:09pm
Promote ReceivedFile Name property in your receive pipleline then user %SourceFileName% macro in send pipeline .
For clarity, FILE.ReceivedFileName does
not have to be Promoted to be used with the %SourceFileName% macro. It simply must exist on the Context.
February 11th, 2015 4:09pm
the adapter used at send port is SFTP. I have got the filename using FILE.ReceivedFileName, how do i proceed further?
February 12th, 2015 1:35am
the adapter used at send port is SFTP. I have got the filename using FILE.ReceivedFileName, how do i proceed further?
February 12th, 2015 1:36am