Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
QVUser1
Partner - Contributor III
Partner - Contributor III

Create Missing Data in Script

Hi Team,

I  Have a Table having M.Date,Matnr,Location ,Qty  which is a Transactional Data . If any manfurating Data is missing for that particular MATNR and Location new row should be created in Data stating 'Not Produced', .

Below is the data for Reference:

Input Data:

QVUser1_0-1625971006797.png

Output Data:

QVUser1_1-1625971057691.png

 

2 Replies
Kushal_Chawda

@QVUser1  may be this

Data:
LOAD * Inline [
Manufacturing Date,MATNR, LOCATION,QTY
05/01/2021,1234,ABC,50
06/01/2021,1234,ABC,60
08/01/2021,1234,ABC,70
09/01/2021,2345,BSD,59
11/01/2021,2345,BSD, 69];

Join(Data)
LOAD MATNR, 
     LOCATION,
     date(min_date +IterNo()-1) as [Manufacturing Date]
while min_date +IterNo()-1 <= max_date;
LOAD MATNR, 
    LOCATION,
    min([Manufacturing Date]) as min_date,
    max([Manufacturing Date]) as max_date
Resident Data
Group by MATNR, 
    LOCATION;

Final:
NoConcatenate
LOAD [Manufacturing Date],
     MATNR, 
     LOCATION,
     if(len(trim(QTY))=0,'Not Produced',QTY) as QTY
Resident Data;

DROP Table Data;

 

You may need to use Peek function along with order by statement if you have more columns in your table to get the previous value if current values is NULL. See the attached document for the same

 

QVUser1
Partner - Contributor III
Partner - Contributor III
Author

Thanks For the Above Reply .

But I See Some Data is Duplicating and Creating' -'  value in the data.

I am Calling the key from link table where the data is duplicating and creating this null value