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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Row Generator condition on Date

I give an input date which is prior to current date,
The row generator has to generate rows dynamically from the inputDate to the currentDate.

Please help..
Labels (2)
4 Replies
Anonymous
Not applicable
Author

Hello
Can you show an example to explain your requirement?
Best regards

shong
Anonymous
Not applicable
Author

I hope i explained it well.
Anonymous
Not applicable
Author

I think you should be using the TalendDat.getRandomDate(minDate,maxDate) function
Where minDate & maxDate are both strings, in this format: YYYY-MM-dd
if context.inputDate2 is a string in the YYYY-MM-dd form
Schema: Value_YYYY_MM_DD
TalendDate.getRandomDate("2007-01-01",TalendDate.getDate("YYYY-MM-DD"))

Schema: Context_YYYY_MM_DD
TalendDate.getRandomDate(context.inputDate2,TalendDate.getDate("YYYY-MM-DD"))

if context.inputDate is a string in the YYYYMMdd form
Schema: Value_YYYYMMDD
TalendDate.getRandomDate(TalendDate.formatDate("yyyy-MM-dd",TalendDate.parseDate("yyyymmdd","20080101")),TalendDate.getDate("CCYY-MM-DD"))

Schema: Context_YYYYMMDD
TalendDate.getRandomDate(TalendDate.formatDate("yyyy-MM-dd",TalendDate.parseDate("yyyymmdd",context.inputDate)),TalendDate.getDate("CCYY-MM-DD"))

*Note: You will get an error (like in picture 5) in tRowGenerator Preview if you use one of the formulas that references the context.inputDate.
*Note: The function works when you run the job (see pic 6, or quoted output below)

(I've posted this bug on the bug tracker: http://www.talendforge.org/bugs/view.php?id=4928)
Starting job Test at 18:08 27/08/2008.
connecting to socket on port 3487
connected
.----------------+--------------+------------------+----------------.
| tLogRow_1 |
|=---------------+--------------+------------------+---------------=|
|Value_YYYY_MM_DD|Value_YYYYMMDD|Context_YYYY_MM_DD|Context_YYYYMMDD|
|=---------------+--------------+------------------+---------------=|
|07-02-2008 |01-31-2008 |06-24-2008 |03-27-2008 |
|01-08-2008 |05-06-2008 |05-03-2008 |08-14-2008 |
|04-27-2008 |03-20-2008 |08-12-2008 |03-09-2008 |
|03-01-2007 |01-09-2008 |06-30-2008 |02-05-2008 |
|08-23-2007 |05-13-2008 |03-02-2008 |01-16-2008 |
|03-29-2007 |08-16-2008 |04-25-2008 |07-06-2008 |
|07-14-2007 |03-17-2008 |06-22-2008 |04-28-2008 |
|07-20-2007 |04-11-2008 |05-06-2008 |05-28-2008 |
|05-01-2007 |01-22-2008 |07-24-2008 |02-29-2008 |
|05-15-2008 |04-19-2008 |03-05-2008 |06-24-2008 |
|05-16-2008 |03-30-2008 |03-30-2008 |07-11-2008 |
|07-23-2007 |07-27-2008 |07-19-2008 |04-17-2008 |
|03-15-2008 |03-08-2008 |06-18-2008 |03-29-2008 |
|06-24-2007 |07-28-2008 |07-14-2008 |02-18-2008 |
|09-01-2007 |01-10-2008 |03-23-2008 |06-27-2008 |
|07-27-2008 |08-11-2008 |06-21-2008 |05-03-2008 |
|06-28-2007 |02-14-2008 |05-12-2008 |04-26-2008 |
|09-10-2007 |07-06-2008 |04-27-2008 |04-24-2008 |
|08-17-2007 |04-09-2008 |06-17-2008 |07-26-2008 |
|02-17-2008 |06-12-2008 |06-23-2008 |03-31-2008 |
|04-07-2008 |03-16-2008 |06-04-2008 |04-16-2008 |
|04-18-2007 |02-22-2008 |05-09-2008 |04-17-2008 |
|06-29-2008 |04-11-2008 |07-29-2008 |02-28-2008 |
|11-29-2007 |03-18-2008 |06-29-2008 |07-21-2008 |
|03-26-2007 |03-29-2008 |04-11-2008 |07-26-2008 |
|12-01-2007 |03-05-2008 |05-28-2008 |02-27-2008 |
|03-29-2008 |01-13-2008 |07-07-2008 |01-08-2008 |
|06-21-2007 |07-21-2008 |07-14-2008 |07-01-2008 |
|03-18-2008 |01-23-2008 |04-19-2008 |03-30-2008 |
|04-16-2007 |08-14-2008 |04-21-2008 |02-11-2008 |
|07-19-2008 |01-04-2008 |06-29-2008 |04-27-2008 |
|10-10-2007 |03-05-2008 |06-19-2008 |03-25-2008 |
|07-31-2007 |07-28-2008 |04-01-2008 |05-13-2008 |
|02-21-2007 |08-02-2008 |05-23-2008 |06-08-2008 |
|01-01-2008 |03-27-2008 |05-10-2008 |01-09-2008 |
|02-23-2007 |08-09-2008 |04-09-2008 |06-20-2008 |
|01-12-2007 |04-29-2008 |06-06-2008 |02-24-2008 |
|04-26-2007 |04-09-2008 |08-19-2008 |04-23-2008 |
|03-14-2008 |05-07-2008 |08-04-2008 |07-07-2008 |
|08-19-2008 |03-22-2008 |07-03-2008 |08-17-2008 |
|03-29-2008 |05-26-2008 |08-24-2008 |04-01-2008 |
|05-30-2008 |03-10-2008 |08-01-2008 |07-12-2008 |
|01-26-2007 |03-23-2008 |04-30-2008 |01-29-2008 |
|03-11-2008 |02-04-2008 |04-30-2008 |04-20-2008 |
|05-16-2008 |03-28-2008 |03-28-2008 |04-20-2008 |
|03-27-2007 |08-10-2008 |05-29-2008 |07-22-2008 |
|05-18-2008 |04-13-2008 |05-29-2008 |06-20-2008 |
|07-30-2007 |05-20-2008 |08-27-2008 |06-26-2008 |
|04-05-2007 |07-04-2008 |04-29-2008 |03-21-2008 |
|06-06-2007 |03-29-2008 |05-03-2008 |02-05-2008 |
|07-24-2008 |05-29-2008 |06-26-2008 |05-29-2008 |
|12-30-2007 |01-24-2008 |06-02-2008 |04-26-2008 |
|03-01-2007 |02-26-2008 |04-05-2008 |05-14-2008 |
|01-07-2008 |05-03-2008 |03-12-2008 |03-27-2008 |
|01-08-2008 |06-28-2008 |03-30-2008 |07-18-2008 |
|08-26-2008 |04-07-2008 |06-08-2008 |02-13-2008 |
|09-02-2007 |06-29-2008 |03-17-2008 |03-29-2008 |
|02-13-2007 |03-07-2008 |04-17-2008 |08-10-2008 |
|12-17-2007 |04-06-2008 |07-08-2008 |07-17-2008 |
|07-20-2007 |06-29-2008 |05-19-2008 |07-31-2008 |
|01-18-2008 |03-30-2008 |05-26-2008 |08-13-2008 |
|05-16-2008 |08-20-2008 |06-12-2008 |01-18-2008 |
|08-03-2008 |02-03-2008 |03-07-2008 |06-06-2008 |
|02-27-2007 |06-02-2008 |06-02-2008 |06-04-2008 |
|01-18-2008 |03-03-2008 |08-12-2008 |04-07-2008 |
|10-30-2007 |05-11-2008 |05-05-2008 |06-17-2008 |
|09-24-2007 |05-31-2008 |04-21-2008 |01-06-2008 |
|07-06-2007 |06-09-2008 |05-13-2008 |01-03-2008 |
|11-21-2007 |01-06-2008 |04-04-2008 |01-26-2008 |
|05-05-2008 |02-08-2008 |06-30-2008 |06-21-2008 |
|05-25-2007 |02-25-2008 |03-06-2008 |07-22-2008 |
|06-02-2007 |08-09-2008 |07-15-2008 |02-10-2008 |
|05-09-2008 |06-15-2008 |03-03-2008 |05-29-2008 |
|10-28-2007 |05-02-2008 |08-19-2008 |02-03-2008 |
|07-25-2007 |04-28-2008 |07-28-2008 |07-26-2008 |
|01-06-2008 |04-20-2008 |03-02-2008 |03-10-2008 |
|06-01-2008 |08-08-2008 |07-26-2008 |01-10-2008 |
|05-17-2008 |05-09-2008 |08-12-2008 |06-07-2008 |
|11-22-2007 |02-10-2008 |05-02-2008 |06-15-2008 |
|11-26-2007 |03-13-2008 |06-11-2008 |04-03-2008 |
|12-01-2007 |07-13-2008 |04-05-2008 |08-19-2008 |
|07-18-2007 |08-14-2008 |04-08-2008 |01-18-2008 |
|03-31-2008 |01-17-2008 |04-04-2008 |08-16-2008 |
|03-19-2007 |05-11-2008 |03-04-2008 |04-06-2008 |
|10-22-2007 |01-11-2008 |05-01-2008 |07-21-2008 |
|03-03-2007 |08-19-2008 |04-13-2008 |01-11-2008 |
|03-19-2007 |04-18-2008 |04-02-2008 |07-15-2008 |
|04-02-2008 |01-13-2008 |07-09-2008 |07-19-2008 |
|02-21-2007 |05-17-2008 |04-04-2008 |08-13-2008 |
|08-21-2007 |01-09-2008 |07-14-2008 |07-12-2008 |
|09-11-2007 |03-11-2008 |05-13-2008 |06-08-2008 |
|07-07-2008 |01-29-2008 |06-01-2008 |05-23-2008 |
|07-27-2007 |05-28-2008 |06-18-2008 |06-10-2008 |
|03-03-2008 |06-20-2008 |06-25-2008 |02-24-2008 |
|04-16-2007 |01-03-2008 |07-04-2008 |02-01-2008 |
|06-19-2008 |07-16-2008 |07-08-2008 |04-06-2008 |
|12-21-2007 |03-11-2008 |04-01-2008 |05-28-2008 |
|05-29-2007 |04-26-2008 |05-26-2008 |06-16-2008 |
|04-21-2007 |02-07-2008 |07-30-2008 |03-01-2008 |
|05-26-2008 |03-26-2008 |04-22-2008 |03-24-2008 |
'----------------+--------------+------------------+----------------'
531 milliseconds
disconnected
Job Test ended at 18:08 27/08/2008.
Anonymous
Not applicable
Author

Note: if you want the randomness to include random times, you would need to update the date pattern in your tRowGenerator schema
You can find a table of information about pattern elements here: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html