cancel
Showing results for 
Search instead for 
Did you mean: 

how to determine the size of a flat file attachment in a mail sender cc?

Former Member
0 Kudos

Hi

I use PI 7.11

I have a scenario where a flat file attachment is being picked up by a MailSender adapter and if the size of the attached flat file is larger that 500 bytes the receiver is A and if the attachment is less that 500 bytes the receiver is B.

I have checked the Context Object list in the Conditions section of Receiver Determination, and it seems, that only the file adapter allows for validation on the file size.

I contemplated an extended receiver determination but the attachment is a flat file which just needs to be passed thru without being converted to an XML document, so my source document is not of XML format.

An other but not very nice way would be to use an intermediate folder to drop the attachment in and from there use a file sender adapter and thus get access to the filesize attribute in my receiver determination, but I would like to avoid this.

Any suggestions?

BR MIkael

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

few details;

Thanks,

Bhupesh

Former Member
0 Kudos

UDF code

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","SourceFileSize");

fileSize = conf.get(key);

Thanks,

Bhupesh

Former Member
0 Kudos

Hi Bhupesh

Thanks for a very quick reply! However my scenario is MailSender to FileReceiver and I do not have a Message Mapping as I only perfom a simple passthru of a flat file, so UDF is out of the question.

Mikael

Former Member
0 Kudos

to get it done.. you might need to change the scenario and add message mapping..

and logic to get Filesize..

just think if you donu2019t have logic in-between how you gona achieve this with just passthru.. the second option is you have to get thi file size through sender in one of field and it will with direct passthru..without mapping or logic..

Thanks,

Bhupesh

Former Member
0 Kudos

Hi

I have decided to make a module, where I plan to place the size of the attachment in the Dynamic Configuration variable "ProcessStep", but to my surprise, it seems that all the context objects in the receiver determination condition section are of type String and hence it is not possible to make a condition where I test for whether the value is smaller than say 500!? Only equal, NOT equal and LIKE are available (EX seems to be disabled as this probably only works in an xpath.

Would one way be to use the xpath expression like this ns1:Main\ProcessStep < 500 where ns1: http://sap.com/xi/XI/System?

MIkael