How to Populate file name from a field value - Proxy To File
My scenario is Proxy to File.
I am getting file name from Proxy to one field Bsed on some condition.
Condition is for on cycle file name is fileon_201501091234.dat and for off cycle file name is fileoff_201501091234.
How to create file name based on that field value.
Whether I need to create UDF or is it possible with value mapping.
Please let me know the Answer.
Thanks In Advance,
VISHNU VARDAN REDDY replied
As the first step, please enable ASMA in receiver file channel.
In mapping level, pass the file name which is coming in the source structure(I assume only one variable which captures either on cycle or off cycle case).
DynamicConfiguration dc = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey dck = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
Map the output of the udf to the root node in the target structure.
If you are getting filenames separately for on cycle & off cycle, then you need to pass these two fields to the udf, and add the below lines extra to the above code:
input = input1.length()>=1?input1:input2;