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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
NNot_defined1674577304
Contributor II
Contributor II

Need to set Date parameter/context variable for directory to s3 bucket

Hi , Trying to create a job that would copy files from source folder to s3 bucket location. They copy file job is complete but it’s copying all files. I need to have a selection of dates like startDate and endDate in Tac so It can auto import files of chosen dates .Please suggest

Labels (4)
6 Replies
Anonymous
Not applicable

Hi

Are these files on local folder where the job is executed? or copy the files from one S3 bucket to another bucket?

 

Regards

Shong

NNot_defined1674577304
Contributor II
Contributor II
Author

Not local . they are in a source path will land to s3 bucket

Anonymous
Not applicable

If the files are on S3 bucket, you can tS3List to iterate each files, there is a global variable eg: ((java.util.Date)globalMap.get("tS3List_1_CURRENT_LASTMODIFIED")) that stores the last modified date of the file, consider using this global variable to filter the files, and only copy these selected files to another S3 bucket.

 

 

 

NNot_defined1674577304
Contributor II
Contributor II
Author

Where do I use this variable ? In tfilelist filemask? Do I have to ad any contexts ? I

NNot_defined1674577304
Contributor II
Contributor II
Author

Where do I use this variable ? In tfilelist filemask? Do I have to ad any contexts ? Also I need to have selection of any date range

Anonymous
Not applicable

You can use this variable on a tJava and check if the date is between a date range. eg:

tS3list--iterate--tJava1---runIf--tS3Copy--oncomponentok--tJava2

on tJava1:

java.util.Date currentLastModifiedDate=((java.util.Date)globalMap.get("tS3List_1_CURRENT_LASTMODIFIED"));

if(currentLastModifiedDate.getTime()>=context.startDate.getTime()&&currentLastModifiedDate.getTime()<=context.endDate.getTime()){

context.isCopy=true;

}

 

// startDate and endDate are context variables, Date type.

// isCopy is a context variable, boolean type, the default value is false;

 

Set the condition of runIf connector as:

context.isCopy

 

on tJava2:

context.isCopy=false;