cancel
Showing results for 
Search instead for 
Did you mean: 

Problem related to variable substitution

Former Member
0 Kudos

Dear all ,

I have a query related to variable substitution :

The requirement is that filename should be in the following format : <b>%<store_code>%_%<Date>%</b>_master.xml .

I have done the configuration for Store_code in the variable substitution from Payload .

But I am facing <b>problem related to Date as the requirement is that we should not take the date from the payload</b> . We used "ADDtimestamp" in the file mode creation but it is generating file with time stamp also which doesn;t serve the purpose .

Can somebody suggest <b>how to take the current date without taking it from payload .</b> <b>Does anyone know something about standard current date which I can assign directly to Var2 .</b>

Thanks in advance

Regards

Prabhat

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

In your mapping, have a user defined function which has a bit of Java to get the current date and time and pass back out to a variable.

Here is a code snippet I got in Google to do this :

import java.text.*;

import java.util.*;

public class Dtest {

public static void main(String args[]) {

SimpleDateFormat df = (SimpleDateFormat)

DateFormat.getDateInstance(DateFormat.SHORT);

System.out.println("The short date format is " + df.toPattern());

Locale loc = Locale.ITALY;

df = (SimpleDateFormat)

DateFormat.getDateInstance(DateFormat.SHORT, loc);

System.out.println("The short date format is " + df.toPattern());

}

}

Cheers

Colin.