on 01-11-2012 7:41 PM
Hi PI Experts
I am using File adapter at reciever end. My requirement is to generate file name as "x_mmddyyyy_y.csv". Means, I need to include current system date in between x and y. Please suggest how can get this. will variable substitution helps?
Regards
Siva
Hi Siva,
If ur using fixedlength then go for variablesubstitution otherwise go for dynamic configuration
Thanks,
Enivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
If ur using fixedlength then go for variablesubstitution otherwise go for dynamic configuration
Thanks,
Enivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
"x_mmddyyyy_y.csv". Means, I need to include current system date in between x and y
that is very simple by using "Dynamic Configuration" .
1.Constant(X_) + 2.currentDate(Date)+3.concat 4.Concat5.Constant(_Y)6.Conact7.constant(.csv)+dyn.conf(UDF) -> target rootnode
udf:
String DynamicConfig(String a, Container container) throws StreamTransformationException{
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
conf.put(key,a);
return "";
}
further info:
http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot
thyanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
You can achieve this using adapter specific message attributes scheme.
Use this UDF in any of the mappings in your scenario (which gets executed during runtime)
public String setFileName(Container container){
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
final String DATE_FORMAT_NOW = "MMddyyyy";
String s;
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT_NOW);
java.util.Calendar cal = java.util.Calendar.getInstance();
s=sdf.format(cal.getTime());
filename="x_"+s+"_y.csv";
conf.put(key,filename);
return " ";
}
Please ensure you carry out these steps
1. Receiver communication channel has ASMA and file name ticked
2. "fail if ASMA missing" tick this.
3. UDF has no input as variable.
4. in receiver communication channel -> File access parameters-> File name scheme -
> you can leave this blank.
5. Map this UDF to any dummy element or root element of target XML, just to ensure that the UDF executes during runtime.
You cannot test its working during design time. Once you run the scenario file with desired filename will be generated.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
u can refer this also:
http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You might want to look at the code of this wiki.
http://wiki.sdn.sap.com/wiki/display/Snippets/DynamicfilenameinaFiletoFilepassthroughscenario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use Dynamic Configuration and take date from currentDate function. You may search SCN for information about Dynamic Configuration.
Regards,
Prateek Raj Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.