Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
SonPhan
Partner - Creator
Partner - Creator

QS Cycle Structure

Hello Qlik-Experts,

Is it possible to find out exactly which lines do not correspond to a cyclic structure?

SonPhan_0-1635157004907.png

As a small example, I have set up a simulated scenario where staff track their time. Where G = Go and K = Come to work.

In this example, Roman has logged out before he has even started working. This is incorrect information and should therefore be deleted from the data model.
When you concatenate all the CBUCHUNGSZEITPUNKT togetether it should looks like this:
KGKGKGKGKG (meaning starting with K and ending with G)

Hopefully you can help me!

1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

This works:

 

Binary [lib://Documents/Qlik/Sense/Apps/Timestamp.qvf];

Rename Table LANDWEHRZEITERFINTERN_FINAL to LANDWEHRZEITERFINTERN;

Drop Fields 
    [First Check],
    [Final Check]
From LANDWEHRZEITERFINTERN;


LANDWEHRZEITERFINTERN_TMP:
NoConcatenate
Load *,
	if(IPERSONALNR<>peek(IPERSONALNR) and CBUCHUNGSTYP='G','To Be Deleted','OK') as [First Check]//Check if starts with G
Resident LANDWEHRZEITERFINTERN
	Order by IPERSONALNR,DBUCHUNGSZEITPUNKT asc;
Drop Tables LANDWEHRZEITERFINTERN;  

LANDWEHRZEITERFINTERN_FINAL:
NoConcatenate
Load *,
	if([First Check]='To Be Deleted' or IPERSONALNR<>peek(IPERSONALNR) and CBUCHUNGSTYP='K','To Be Deleted','OK') as [Final Check]	//Check if ends with K
Resident LANDWEHRZEITERFINTERN_TMP	
	Order by IPERSONALNR,DBUCHUNGSZEITPUNKT desc;
Drop Field [First Check];
Drop Table LANDWEHRZEITERFINTERN_TMP;

 

 

And the result is:

2021-10-26 15_21_44-Qlik Sense Desktop.png

If you want to exclude "To be Deleted" rows just perform a resident load Where [Final Check]<>'To Be Deleted'

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
micheledenardi
Specialist II
Specialist II

This works:

 

Binary [lib://Documents/Qlik/Sense/Apps/Timestamp.qvf];

Rename Table LANDWEHRZEITERFINTERN_FINAL to LANDWEHRZEITERFINTERN;

Drop Fields 
    [First Check],
    [Final Check]
From LANDWEHRZEITERFINTERN;


LANDWEHRZEITERFINTERN_TMP:
NoConcatenate
Load *,
	if(IPERSONALNR<>peek(IPERSONALNR) and CBUCHUNGSTYP='G','To Be Deleted','OK') as [First Check]//Check if starts with G
Resident LANDWEHRZEITERFINTERN
	Order by IPERSONALNR,DBUCHUNGSZEITPUNKT asc;
Drop Tables LANDWEHRZEITERFINTERN;  

LANDWEHRZEITERFINTERN_FINAL:
NoConcatenate
Load *,
	if([First Check]='To Be Deleted' or IPERSONALNR<>peek(IPERSONALNR) and CBUCHUNGSTYP='K','To Be Deleted','OK') as [Final Check]	//Check if ends with K
Resident LANDWEHRZEITERFINTERN_TMP	
	Order by IPERSONALNR,DBUCHUNGSZEITPUNKT desc;
Drop Field [First Check];
Drop Table LANDWEHRZEITERFINTERN_TMP;

 

 

And the result is:

2021-10-26 15_21_44-Qlik Sense Desktop.png

If you want to exclude "To be Deleted" rows just perform a resident load Where [Final Check]<>'To Be Deleted'

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
SonPhan
Partner - Creator
Partner - Creator
Author

Thank you this works for me!