required a output from tjava

Four Stars

required a output from tjava

Hi,

 

I want to get the output as below using tjava

sep-18

sep-17

jun-18

mar-17

mar-18

mar-19

mar-20

 

i need all the result only in date format

Five Stars

Re: required a output from tjava

What is the input for the same?
---
Don't forget to give kudos when a reply is helpful.
Thanks
Four Stars

Re: required a output from tjava

no input. i have to achieve it with tjava.

for tjava we no need input?

Five Stars

Re: required a output from tjava

Do you want to store the output in variables or display it on Console?

---
Don't forget to give kudos when a reply is helpful.
Thanks
Four Stars

Re: required a output from tjava

is it possible to store the output in excel file?variable also okay.but my requirement is based on the output. i will pass the output values to sql query as parameter

Five Stars

Re: required a output from tjava

Capture1.PNGCapture2.PNG

Please try this way ..You have to insert your data in desired format in .csv file and column data type as string then pass it to tmap with data type as string then in tjavarow(1 intput column :date_output and 1 output column)  you can enter code like below:

op.date_output will be input column(string)
output_row.date_output=TalendDate.parseDateLocale("MMM-yy",op.date_output,"en");

where date_output will be of type date "MMM-yy"

then join it to tLogRow. you will get the output !!

---
Don't forget to give kudos when a reply is helpful.
Thanks
Four Stars

Re: required a output from tjava

Thanks for your reply.

 

i was asking can we print the output in excel. but you have showed in tlogrows.

 

i have already got the desired output in tjava,but i dont know how to pass those values as globalvar or parameter in my sql query.

below is the code which i am using, can you help me to solve this issue.

 

1. Date lastDec =TalendDate.parseDate("yyyy-MM-dd", TalendDate.getDate("yyyy-MM-dd"));
System.out.println("param1: "+TalendDate.TO_CHAR(lastDec, "MMM-yy"));

 

2. Date prevYear1 = TalendDate.ADD_TO_DATE(lastDec, "YYYY", -1);
System.out.println("param3: "+TalendDate.TO_CHAR(prevYear1, "MMM-yy"));

 

3. Date prevYear = TalendDate.ADD_TO_DATE(lastDec, "MM", -3);
System.out.println("param2: "+TalendDate.TO_CHAR(prevYear, "MMM-yy"));

 

code 1 will take the current month and year.based on lastDec remaining will be calculated.

so now i want to know how to pass those values from tjava as globalvar or parameter in my sql query