Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
chadliagabsi
Creator II
Creator II

insert previous value in the blank

Hello,

I need to insert previous value of (DATE_FIN) in the blank of DATE_DEB and DATE_FIN.

I try this expression and it doesn't work:

    if(MATRICULE=previous(MATRICULE)and MOTIF<>Previous(MOTIF) and IsNull(DATE_DEB) and IsNull(DATE_FIN),Previous(date(DATE_FIN,'DD/MM/YYYY')),0) as DATE_DEB

you find in attached my test case.

Thanks for helping.

test_community.png

1 Solution

Accepted Solutions
YoussefBelloum
Champion
Champion

try this:

test :

LOAD * INLINE [   

    MATRICULE, NOM,MOTIF ,DATE_DEB, DATE_FIN,

     1, DUPOND, RECRUTEMENT, 15/06/2015,17/08/2017

     1, DUPOND,  AVANCEMENT, 18/08/2017,31/01/2018

      1, DUPOND, 'FIN CONTRAT','' , ''

];

test2:

LOAD RowNo() as id,

NOM,

MATRICULE,

MOTIF,

if(len(Trim(DATE_DEB))=0,Previous(DATE_FIN),DATE_DEB) as DATE_DEB,

if(len(Trim(DATE_FIN))=0,Previous(DATE_FIN),DATE_FIN) as DATE_FIN

RESIDENT test

order by MATRICULE;

DROP Table test;

previous_screen.png

View solution in original post

3 Replies
YoussefBelloum
Champion
Champion

Hi,

You can't do it on the front end using a table box, you should use a straight table.

is it ok for you ?

chadliagabsi
Creator II
Creator II
Author

Hello Youssef,

I do it in my script I have attached my script .

YoussefBelloum
Champion
Champion

try this:

test :

LOAD * INLINE [   

    MATRICULE, NOM,MOTIF ,DATE_DEB, DATE_FIN,

     1, DUPOND, RECRUTEMENT, 15/06/2015,17/08/2017

     1, DUPOND,  AVANCEMENT, 18/08/2017,31/01/2018

      1, DUPOND, 'FIN CONTRAT','' , ''

];

test2:

LOAD RowNo() as id,

NOM,

MATRICULE,

MOTIF,

if(len(Trim(DATE_DEB))=0,Previous(DATE_FIN),DATE_DEB) as DATE_DEB,

if(len(Trim(DATE_FIN))=0,Previous(DATE_FIN),DATE_FIN) as DATE_FIN

RESIDENT test

order by MATRICULE;

DROP Table test;

previous_screen.png