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: 
Not applicable

Generic Load

This post is related to my previou post Set Condition in Load Script and I got Rob Wunderlich and 

So basically I have 3 tables as below,

Table_Initial:  

Case_IDInitial_Date
100011/3/2007
100023/28/2010

Table_Followup:  

Case_IDFollowup_Date
10001 1/10/2007
10002 04/06/2010
100024/12/2010

Data_Routing:

There are three types of States, Data Entry (From_State '3' to To_State '4'), Review (From_State '4' to To_State '1001'), Finalize (From_State '1001' to To_State '1002').

Case_ID From_State To_StateRoute_Date
10001341/3/2007 08:30am
10001100110021/8/2007 15:30pm
10001100210031/8/2007 16:40pm
10001341/11/2007 10:15am
1000234 03/29/2010 9:45am
10002433/29/2010 10:10am
10002343/29/2010 14:15pm
1000210011002 04/03/2010 10:15am
100021002100304/04/2010 9:00am
100023404/07/2010 12:15pm
100021002100304/10/2010 9:00am
1000234 04/13/2010 10:30am
1000310021003
1000334

My goal here is to get specific date for each of the state based on Initial or Followup Receive_Date. The challenge is how can I get different rows based on different Initial or Followup Receive_Date, as well as matching the Route_Date to specific states. Especially there are maybe more than 1 Followup Receive_Date for the same Case_ID.

   

Case_IDReceive_DateData Entry DateReview DateFinalize Date
100011/3/20071/3/2007 08:30am1/8/2007 15:30pm1/8/2007 16:40pm
10001 1/10/20071/11/2007 10:15am
100023/28/20103/29/2010 14:15pm 04/03/2010 10:15am04/04/2010 9:00am
10002 04/06/201004/07/2010 12:15pm 04/03/2010 10:15am04/10/2010 9:00am
100024/12/2010 04/13/2010 10:30am

If any of you can share your thoughts or the possible ways to achieve my goal, please let me know.  Please find the attached example sample that may help you to understand my requirement easier.

Thanks in advance,

Becky

1 Solution

Accepted Solutions
sunny_talwar

Slight improvement here (but only slight)

Capture.PNG

View solution in original post

12 Replies
sunny_talwar

Partially working, will continue to look

Capture.PNG

sunny_talwar

Slight improvement here (but only slight)

Capture.PNG

vinieme12
Champion III
Champion III

Hi,

See attached it it helps, a few questions though!

caseIDbyState.JPG

In your data there are 4 events for Case_ID :10002 entering DataEntryStage, but in your o/p there are only three rows for 10002,

The one in red is missing from your o/p table(see below), any reasons why?

Case_IDFrom_StateTo_StateRoute_Date
10001341/3/2007 08:30am
10001100110021/8/2007 15:30pm
10001100210031/8/2007 16:40pm
10001341/11/2007 10:15am
100023403/29/2010 9:45am
10002433/29/2010 10:10am
10002343/29/2010 14:15pm
100021001100204/03/2010 10:15am
100021002100304/04/2010 9:00am
100023404/07/2010 12:15pm
100021002100304/10/2010 9:00am
100023404/13/2010 10:30am
1000310021003
1000334

Also there is no Fromstate_Tostate (1001-1002)  record of the second dataentry state for CaseID:10002 in the data table;

How did we assume the ReviewDate to be the same as previous ReviewDate?

Is it that only when a CaseID is finalized we can assume review date to be same as previous RecordDate else null() ??

Case_IDReceive_DateData Entry DateReview DateFinalize Date
100011/3/20071/3/2007 08:30am1/8/2007 15:30pm1/8/2007 16:40pm
100011/10/20071/11/2007 10:15am
100023/28/20103/29/2010 14:15pm04/03/2010 10:15am04/04/2010 9:00am
1000204/06/201004/07/2010 12:15pm04/03/2010 10:15am04/10/2010 9:00am
100024/12/201004/13/2010 10:30am

Cheers

V

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

No, that won't help. I need an incremental counting for each combination of Case_ID&From_State&To_State. The difference between the two expressions, can be seen below:

Case_IDFrom_StateTo_StateAutoNumber(Case_ID&From_State&To_State)AutoNumber(RowNo(), Case_ID&From_State&To_State)
100023411
100023412
100023413
100023414
Not applicable
Author

Hi Vineeth,

Thanks a lot for spending your time and show the inputs. The attachment is the first step I was looking for. I am looking forward something more here, like Sunny T's solution.

Back to your questions, great questions which is why makes this metric more complicated.

 

So the Initial_Date for 10002 was 01/28/2010. Then the following activities happened. The tricky thing here is it could from State 3 to State 4, as well as from State 4 back to State 3. So you can see  from 3 - 4, then 4-3, then 3-4 again.

 

 

Case_ID

From_State

To_State

Route_Date

10002

3

4

03/29/2010 9:45am

10002

4

3

3/29/2010 10:10am

10002

3

4

3/29/2010 14:15pm

10002

1001

1002

04/03/2010 10:15am

10002

1002

1003

04/04/2010 9:00am

 

Then there are two Follow_Date 04/06/2010 and 04/12/2010, which make the process happened again and again.    

 

1st Follow_up:

 

10002

3

4

04/07/2010 12:15pm

10002

1002

1003

04/10/2010 9:00am

 

 

2nd Follow_up:            

 

10002

3

4

04/13/2010 10:30am

 

 

You are correct and I was adding wrong record into the final result table. The review_date 04/03/2010 shoudn't be there.

Case_ID

Receive_Date

Data Entry Date

Review Date

Finalize Date

10001

1/3/2007

1/3/2007 08:30am

1/8/2007 15:30pm

1/8/2007 16:40pm

10001

1/10/2007

1/11/2007 10:15am

10002

3/28/2010

3/29/2010 14:15pm

04/03/2010 10:15am

04/04/2010 9:00am

10002

04/06/2010

04/07/2010 12:15pm

04/10/2010 9:00am

10002

4/12/2010

04/13/2010 10:30am

 

Please let me know if you have other ideas.

Thanks,

Becky

 

vinieme12
Champion III
Champion III

check the attached

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

Hi Sunny... when I have the "RowNo()" with in AutoNumber fuction, I cannot run the script. I can ran the script after I removed the "RowNo()". But then I cannot get the correct result. I assuming one of the reasons is probably becuase there are lots of data. For the other reasons, I wasn't sure why.

Can you share with me that what's the reason we are using AutoNumber here? To try to avoid the synthetic key or more than that?

Thanks,

Becky

sunny_talwar

Can you share the script you are using today?

Not applicable
Author

Hi Vineeth

Thanks a lot for your time editing the script. Your script is more advanced than I knew...

One thing is the case could transfer from one state to another state. It is not nesserary a case process from Data_Entry to Review. It could be from Finalization to Review. So we don't want to to set the SateKey, 3-4, 1001 - 1002, 1002 - 1003 if I understand you correctly.