cancel
Showing results for 
Search instead for 
Did you mean: 

RE:Placing a file in one of many directories at run time

Former Member
0 Kudos

Hi all,I posted a question yesterday evening with subject name as "Placing a file in one of many directories at run time".

The link for that qestion is as follows:

[;

For that question I got a UDF as a reply.The UDF is as follows

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

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

String strDirectory = "Dir1"

// here write your condition for dynamic Directory

conf.put(key,strDirectory);

return strDirectory;

Im having an double if condition in my scenario as follows:

if (Integer.parseInt(TableName[0])==8 || Integer.parseInt(TableName[0])==10 || Integer.parseInt(TableName[0])==12 )

{

if(CountryCode.equals("SG") || CountryCode.equals("MY") || CountryCode.equals("PH") || CountryCode.equals("TH") || CountryCode.equals("ID"))

{

}

}

Now my question is where to insert last two statements of UDF(conf.put(key,strDirectory);

return strDirectory;).

Should I use both in if condition or any one in if condition.

Can any one help me out in this case.

Thanks in advance,

Regards,

Prajwal Kumar

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Naluvala

You can do this. It is pretty simple

bstractTrace trace = container.getTrace();

trace.addInfo("In Dynamic Configuration...............................:");

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

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

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

String ourSourceFileName = conf.get(key);

trace.addInfo("Key Filename:"+ourSourceFileName);

String valueOld = "/XD1_interfaces/messages/inbound/ref_payments";

trace.addInfo("Key valueOld:"+valueOld);

conf.put(key1,valueOld);

}

return ourSourceFileName;

Regards

Abhishek

*Please reward points if helpful***

Former Member
0 Kudos

hi

you can put

conf.put(key,strDirectory);

return strDirectory;

after all the IF conditions ie at the bottom of UDF.

You need to set only the dir strDirectory variable inside your IF condition.

rgds

Arun

former_member194786
Active Contributor
0 Kudos

Hi,

You will have to provide the condition and result directory after // here write your condition for dynamic Directory. Provide all the 6 conditions for all the directories and the corresponding paths after this line. It will work.

Regards,

Sanjeev.