Download a file zip with using variable DATE

Two Stars

Download a file zip with using variable DATE

Hi everyone,

I have to download a zip file from 

 

https://leidata.gleif.org/api/v1/concatenated-files/lei2/20180622/zip 

 

but I want to use a date variable to download every day 

 

I use tFileFetch and with direct link works.

 

Can somebody help me?

 

Thanks 


Accepted Solutions
Two Stars

Re: Download a file zip with using variable DATE

solved:

 

""+context.theDate +".zip"


All Replies
Forteen Stars TRF
Forteen Stars

Re: Download a file zip with using variable DATE

You can try this:

"https://leidata.gleif.org/api/v1/concatenated-files/lei2/" + 
  TalendDate.formatDate("yyyyMMdd",TalendDate.getCurrentDate()) +
  "/zip"

 


TRF
Two Stars

Re: Download a file zip with using variable DATE

 

I gave this error:

Execution failed : Job compile errors
At least job "test" has a compile errors, please fix and export again.
Error Line: 559
Detail Message: Syntax error on token "yyyyMMdd", invalid AssignmentOperator
There may be some other errors caused by JVM compatibility. Make sure your JVM setup is similar to the studio.

 

I put this on URI "https://leidata.gleif.org/api/v1/concatenated-files/lei2/"+TalendDate.formatDate("yyyyMMdd",TalendDa...()) +"/zip"

 

and If it's possible to create a variable that  user can put the date?

 

Thanks 

Forteen Stars TRF
Forteen Stars

Re: Download a file zip with using variable DATE

Share your tFileFtech settings.

If you want the user to enter the date when the job starts (that's it?), define a context variable (theDate for example) with datatype, tick the option "active prompt on variable" and enter a prompt value for the message.

Then change the expression by the following:

"https://leidata.gleif.org/api/v1/concatenated-files/lei2/" + 
  context.theDate +
  "/zip"

  


TRF
Two Stars

Re: Download a file zip with using variable DATE

Ok thanks, now I can put the date and download the file, the only things that I think I make wrong is the name of file to save. 

I want to be named like the variable theDate.zip.

 

Thanks again

Forteen Stars TRF
Forteen Stars

Re: Download a file zip with using variable DATE

Great!

Thanks to mark your case as solved.


TRF
Two Stars

Re: Download a file zip with using variable DATE

The only things that doesnt work is the name of the file, Is it possible to make it variable like theDate?

 

Thanks 

 

 

Two Stars

Re: Download a file zip with using variable DATE

solved:

 

""+context.theDate +".zip"

Forteen Stars TRF
Forteen Stars

Re: Download a file zip with using variable DATE

@bramb83this is not very fairplay to accept your own answer instead of the one from the guy whom had help you


TRF