Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
ba11
Contributor III
Contributor III

DAILY HISTORY

Hello all,

I have this table in my script

ORDER_CHANGES:
LOAD
DATE,
JoinCUST_ORDER_LINE_ID,
IF(STATUS = 'R',1,-1) * IF(DATE = FLOOR($(vCHANGEDT)),AMOUNT_OUTSTANDING,0) AS ORDER_CHANGES.DAILY_MOVEMENT,
IF(STATUS = 'R',1,-1) * IF(DATE < FLOOR($(vCHANGEDT)) AND DATE >= WEEKSTART($(vCHANGEDT)),AMOUNT_OUTSTANDING,0) AS ORDER_CHANGES.WEEKLY_MOVEMENT,
IF(STATUS = 'R',1,-1) * IF(DATE < WEEKSTART($(vCHANGEDT)),AMOUNT_OUTSTANDING,0) AS ORDER_CHANGES.PERIOD_MOVEMENT
RESIDENT TEMP_ORDER_STATUS_CHANGE;

vCHANGEDT = NUM(IF(WEEKDAY(TODAY())='Mon', DAYEND(TODAY()-3),DAYEND(TODAY()-1)))

At the moment the ORDER_CHANGES.DAILY_MOVEMENT only returns values of daily order changes from the previous day, the values are not stored nor accumulated. What I want to do is store the daily movement values in a QVD and accumulate it overtime so I can display it on a trend graph and be able to select by month and year.

I have the general idea of how to go about it but still need guidance, thank you.

Labels (3)
1 Solution

Accepted Solutions
ba11
Contributor III
Contributor III
Author

What I did was store the table in a QVD, and then used concatenate to keep appending unto the table;

//After loading DAILY_HISTORY table

if Alt(FileSize('lib://Data:DataFiles/TestVisualERP_DAILY_HISTORY.qvd'), 0) > 0 THEN

CONCATENATE(DAILY_HISTORY)
LOAD
*
FROM [lib://Data:DataFiles/TestVisualERP_DAILY_HISTORY.qvd](qvd)
;
END IF

**********************************

Can anyone please help with how I can create a backup of the QVD file in case this gets corrupt? At the moment I add another STORE statement after the first one as backup, but I realized whatever happens to the first one will affect the second because every time it loads it overwrites what's already in the file.

Any other way to create a backup that is safe?

View solution in original post

2 Replies
Anil_Babu_Samineni

@ba11 Perhaps this way?

If(IF(STATUS = 'R',1,-1) * IF(DATE = FLOOR($(vCHANGEDT)),AMOUNT_OUTSTANDING,0) = Previous(IF(STATUS = 'R',1,-1) * IF(DATE = FLOOR($(vCHANGEDT)),AMOUNT_OUTSTANDING,0)),

RangeSum(Peek(ORDER_CHANGES.DAILY_MOVEMENT), STATUS),

STATUS) as ORDER_CHANGES.DAILY_MOVEMENT,

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ba11
Contributor III
Contributor III
Author

What I did was store the table in a QVD, and then used concatenate to keep appending unto the table;

//After loading DAILY_HISTORY table

if Alt(FileSize('lib://Data:DataFiles/TestVisualERP_DAILY_HISTORY.qvd'), 0) > 0 THEN

CONCATENATE(DAILY_HISTORY)
LOAD
*
FROM [lib://Data:DataFiles/TestVisualERP_DAILY_HISTORY.qvd](qvd)
;
END IF

**********************************

Can anyone please help with how I can create a backup of the QVD file in case this gets corrupt? At the moment I add another STORE statement after the first one as backup, but I realized whatever happens to the first one will affect the second because every time it loads it overwrites what's already in the file.

Any other way to create a backup that is safe?