Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
tjava code:
Date lastDec =TalendDate.parseDate("yyyy-MM-dd", TalendDate.getDate("yyyy-MM-dd"));
System.out.println("param1: "+TalendDate.TO_CHAR(lastDec, "MMM-yy"));
Date prevYear = TalendDate.ADD_TO_DATE(lastDec, "MM", -3);
System.out.println("param2: "+TalendDate.TO_CHAR(prevYear, "MMM-yy"));
Date prevYear1 = TalendDate.ADD_TO_DATE(lastDec, "YYYY", -1);
System.out.println("param3: "+TalendDate.TO_CHAR(prevYear1, "MMM-yy"));
Date Year1 = TalendDate.ADD_TO_DATE(lastDec, "YYYY", -1);
System.out.println("param4: "+TalendDate.TO_CHAR(Year1, "MMM-yy"));
Date Year2 = TalendDate.ADD_TO_DATE(Year1, "YYYY", +1);
System.out.println("param5: "+TalendDate.TO_CHAR(Year2, "MMM-yy"));
Date Year3 = TalendDate.ADD_TO_DATE(Year2, "YYYY", +1);
System.out.println("param6: "+TalendDate.TO_CHAR(Year3, "MMM-yy"));
Date Year4 = TalendDate.ADD_TO_DATE(Year3, "YYYY", +1);
System.out.println("param7: "+TalendDate.TO_CHAR(Year4, "MMM-yy"));
OUTPUT:
param1: Jun-18
param2: Mar-18
param3: Jun-17
param4: Jun-17
param5: Jun-18
param6: Jun-19
param7: Jun-20
Quaetions
1. how to pass this output values to excel file.
2. How to pas this output values as context variable to another component
Hi All,
In my case i can print global variable value on console, but i want to print this value into my tOutputExcel component. example: current_file_name
How to do it?
Please help me.
thanks
Pravin
Hi Sir,
In my case i can print global variable value on console, but i want to print this value into my tOutputExcel component. example: current_file_name
How to do it?
Please help me.
thanks
Pravin
Do you want to set the file name? If so, the value needs to be calculated and set in your globalMap in a subjob before the subjob where your Excel component is written to. You can then use the globalMap value to set the file name.
Thanks for reply...
I got the file name using following code
String fileName = ((String)globalMap.get("tFileList_3_CURRENT_FILE"));
context.file_name = fileName;
System.out.println(fileName);
but in output it shows as null value
[statistics] connecting to socket on port 3477
[statistics] connected
we_100_BA10213307.xml
.-----------------+----------+-------------+-----------------.
| tLogRow_2 |
|=----------------+----------+-------------+----------------=|
|date_specialValue|date_date |date_timeZone|current_file_name|
|=----------------+----------+-------------+----------------=|
|NONE |2018-07-30|CET |null |
|NONE |2018-07-30|CET |null |
|NONE |2018-07-30|CET |null |
'-----------------+----------+-------------+-----------------'
we_100_BA10213308.xml
.-----------------+----------+-------------+-----------------.
| tLogRow_2 |
|=----------------+----------+-------------+----------------=|
|date_specialValue|date_date |date_timeZone|current_file_name|
|=----------------+----------+-------------+----------------=|
|NONE |2018-07-30|CET |null |
|NONE |2018-07-30|CET |null |
|NONE |2018-07-30|CET |null |
'-----------------+----------+-------------+-----------------'
WE_100_BA10213313.xml
.-----------------+----------+-------------+-----------------.
| tLogRow_2 |
|=----------------+----------+-------------+----------------=|
|date_specialValue|date_date |date_timeZone|current_file_name|
|=----------------+----------+-------------+----------------=|
|NONE |2018-07-31|CET |null |
|NONE |2018-07-31|CET |null |
|NONE |2018-07-31|CET |null |
'-----------------+----------+-------------+-----------------'
[statistics] disconnected
why it will shown null value???
The filename can be seen in the output, but not in the table data. You will need to show me a screenshot of your job.
Yes. You are right. need to display file name in the table data.
Please find the attached screenshot of my job.
You need to add a tMap between your file component and the tLogRow. Add the context variable to the output of that tMap
Thank You Sir It's Working.....
Not a problem. Glad to help. Can I ask that if a post provides a solution to a problem, that you accept the solution. There is a button under the post that you think provides the solution. This helps our other users easily find solutions to their problems 🙂