Qlik Community

Qlik Healthcare User Group

A private group is for healthcare organizations, partners, and Qlik healthcare staff to collaborate and share insights.

Highlighted
rohitraturi
New Contributor II

Unable to understand the following code

Corrected_Fact:
NOCONCATENATE
LOAD *
RESIDENT [Master Fact]
WHERE match(Corrected, 'Y');

DROP FIELDS [Posting Date] FROM Corrected_Fact;

LEFT JOIN(Corrected_Fact)
LOAD DISTINCT
[Corrected Date]
, [Corrected Date] AS [Posting Date]
RESIDENT Corrected_Fact;

DROP Fields [Corrected Date];
DROP Fields Corrected FROM [Master Fact];

// Unable to understand from here

LEFT JOIN ([Master Fact])
LOAD 'N' AS Corrected
Autogenerate 1;

CONCATENATE([Master Fact])
LOAD *
RESIDENT Corrected_Fact;

DROP TABLES Corrected_Fact;

 

I have this code in one of the apps. I am unable to understand the code entirely. It will be a great help if someone can explain to me what exactly the code is doing.

Thanks in advance.

Tags (1)
1 Solution

Accepted Solutions
wandererroch
New Contributor III

Re: Unable to understand the following code

The script looks like an attempt to replace  a posting date for rows where a correction is indicated and then remove the indicator.

 

I think the code does the following:

Makes a copy of the master fact where a correction is indicated.

in the copy replaces the posting date with the 'corrected' posting date.

writes 'N' to the Corrected field in the master fact table for everything and then writes the proper values of posting date into the master fact from the copy. the 'N' in all rows indicates there are no un-applied corrections.

 

Does that make sense?

2 Replies
wandererroch
New Contributor III

Re: Unable to understand the following code

The script looks like an attempt to replace  a posting date for rows where a correction is indicated and then remove the indicator.

 

I think the code does the following:

Makes a copy of the master fact where a correction is indicated.

in the copy replaces the posting date with the 'corrected' posting date.

writes 'N' to the Corrected field in the master fact table for everything and then writes the proper values of posting date into the master fact from the copy. the 'N' in all rows indicates there are no un-applied corrections.

 

Does that make sense?

rohitraturi
New Contributor II

Re: Unable to understand the following code

Thanks. It helped.