Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rename an output file with the name of a variable (dinamic) and the current date

Dear all,

i need to rename an output (csv) file based on a variable that is inside the Job + the current date. An exemple of the output can be "markertId-ddmmyyyy" where markertId is the variable and ddmmyyyy is the date of the day.

 

Thanks for the help

Labels (2)
22 Replies
TRF
Champion II
Champion II

((String)globalMap.get("markertId")) + "-" + TalendDate.formatDate("ddMMyyyy", TalendDate.getCurrentDate())
Anonymous
Not applicable
Author

Thanks for the answer, unfortunately that is the error message that talend displays me (see the attached file)

 


Cattura.PNG
manodwhb
Champion II
Champion II

is this you are looking for ?0683p000009Lwud.png

TRF
Champion II
Champion II

@samfantini please share your tFileOutputDelimited settings for the compilation error.

You were talking about "a variable that is inside the Job".

I thought you were talking about a global variable.

If this is not exact, can you clarify this point?

Are you talking about a global variable, a context variable or a field?

Anonymous
Not applicable
Author

Sorry, I was talking about a field within the Job that takes on value. I would like to put that value in the name of the output csv file followed by the date of the day.

in the 2 pictures below i have highlighted in yellow the name of the field and in the other the settings of the toutputdelimited.

the problem for me is what i have to write in the file name field in the output0683p000009Lwmd.png0683p000009Lwrn.png

TRF
Champion II
Champion II

So you have to iterate over the content to write into the appropriate output file.

The job design should look like this:

0683p000009Lwer.png

tFixedFlowInput is here for the example - it replaces your tFileInputDelimited.

It content is here (just 3 fields for the example):

0683p000009Lwxp.png

tFlowToIterate generates 1 global variable per input field (3 in my case).

Just let it with the default options.

tFixedFlowInput generates a flow from the global variables generated at the previous step.

0683p000009Lwy4.png

As you can see, each field is completed with the associated global variable.

Then the flow is pushed into the tFileOutputDelimited.

The filename is like this:

"C:/Users/safantin/Desktop/" + 
(String)globalMap.get("row79.marketId") + "-" +
TalendDate.formatDate("ddMMyyyy", TalendDate.getCurrentDate()) + ".csv"

Just beware of the "" around each fixed part.

Tick the option "Write after" on the Advanded Settings tab of the tFileOutputDelimited in case of many records with the same value for the marketId field.

That's all.

TRF
Champion II
Champion II

Anonymous
Not applicable
Author

Perfect, but i don't understand the "inline table", because i have many records in my table.

my records seems like this:

 0683p000009Lwhe.png

but i have too many records.

so i would like to know how the second tFixedFlowInput works.


Cattura.PNG
javvaji
Creator II
Creator II

Hi samfantini,

 

As per your comment, are you getting the "markertId" from input data or from any variables like context/global.

Please provide your inputs on this.

 

Thanks,

Bharath.