cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Filename and directory

Former Member
0 Kudos

Hi All,

Filename and directory details are coming from source system.Through dynamic configuration udf we can set the filename and directory.

Whether it is possible to achieve it in single UDF by taking 2 input parameters instead of writing 2 different UDF for filename and directory.

Could you please provide the java UDF for this.

Regards,

Karthiga

Accepted Solutions (1)

Accepted Solutions (1)

Harish
Active Contributor
0 Kudos
Former Member
0 Kudos


Hi Harish,

With single UDF,whether is it possible to set both filename and directory?

Regards,

Karthiga

iaki_vila
Active Contributor
0 Kudos

Hi Karthiga,

Yes it is possible, because you change two times a diferent variable values. The variable has values for the file name, file directory and so on. You only change these values.

Regards.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Karthiga,

Yes, of course. Just use two input arguments e.g var1 and var2. UDF can be simple type

Here is a sample code:


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

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

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

conf.put(fname,var1);

conf.put(dir,var2);

return "";

Regards,

Mark

Former Member
0 Kudos

Hi Mark,

Thanks.Code is working perfectly.

Thanks everyone for your comments.

Regards,

Karthiga

Answers (2)

Answers (2)

pvishnuvardan_reddy
Active Contributor
0 Kudos

HI Karthiga,

Yes, using single udf, we can set both filename and directory.

Can you please refer the links suggested in the above replies.

Regards

iaki_vila
Active Contributor
0 Kudos

Hi Karthiga,

In this thread you have first Justin code to set a dynamic filename and later Bhavesh code to set a dynamic directory name. You can develop your UDF writting first one code and later the other. You only need to set two parameter as the codes have like parameters: dynaname, and instead of "DIRECTORY VALUE" your parameter for the directory.

You can notice the codes are very similar the unique diference is the codes modify diferent value on DynamicConfigurationKey variable. Check the codes, they are easy to understand.

Regards