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: 
d4nilomiranda
Partner - Contributor II
Partner - Contributor II

how to repeat value for ID less than and equal to ID_DOC?

I have a table like the one below:

danilo19192_0-1672183319554.png

 

 


it has a sequential ID_MOV, and an ID_DOC that is repeated because it occurs in several stages, I have a flag 1 and it is necessary that all values below this flag in the same ID_DOC have the number 1. The values with ID_MOV smaller than the flag.

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Temp:

load 

ID_DOC

,ID_MOV

,flag

From SomeSource;

NOCONCATENATE

Main:

Load

ID_DOC

,ID_MOV

,if(ID_DOC=Previous(ID_DOC),Peek(flag_new),flag) as flag_new

Resident Temp

Order by ID_DOC,ID_MOV ASC;

Drop table Temp;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
vinieme12
Champion III
Champion III

Temp:

load 

ID_DOC

,ID_MOV

,flag

From SomeSource;

NOCONCATENATE

Main:

Load

ID_DOC

,ID_MOV

,if(ID_DOC=Previous(ID_DOC),Peek(flag_new),flag) as flag_new

Resident Temp

Order by ID_DOC,ID_MOV ASC;

Drop table Temp;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
d4nilomiranda
Partner - Contributor II
Partner - Contributor II
Author

Thanks man!