cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Configuration of file based on field value (conditional)

Former Member
0 Kudos

Hi,

I have a requirement to have a dynamic filename at receiver file channel.

This filename depends on the value in one of the fields in the payload.

For Eg.

If Value in FIELD is blank then filename should be - Filename1

If Value in FIELD is not blank then filename should be - Filename2

Variable substitution does not help as we have to check the condition on the value of the field and then decide the filename.

Can it be done by Dynamic Configuration Udf ?

What would be the code?

Regards,

Vikas

Accepted Solutions (1)

Accepted Solutions (1)

santosh_k3
Active Participant
0 Kudos

Hi Vikas,

Use this in the UDF,

String str = "";

if(a == "")

{

str = "Filename1" +  ".xml";

}

else

str = "Filename2" +  ".xml";

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

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

conf.put(FileName, str);

return "";

Regards,

Sai

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Mishra,

It can be handle by Dynamic Configuration UDF.  In the udf pass the FIELD as input and write the validation.

Thanks,

Satish.

Former Member
0 Kudos

Satish,

Could you help with the code?

Vikas

udo_martens
Active Contributor
0 Kudos

You can copy and paste it from the link i posted

udo_martens
Active Contributor
0 Kudos