Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 Sivalingam
		
			Sivalingam
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello qlikers
I have written a script. But a small area of the script should be run on a Monday only and the generated value needs to be retained for other days.
So, for example, today is Monday and the script should run the complete script. When we have Friday, the script should use the Monday generated value on behalf of "Monday script".
How can I do that?
Thank you in advance!
 Lech_Miszkiewic
		
			Lech_MiszkiewicIt is because now() returns timestamp including date and you compare it to time which doesnt have date in it so in reality you are comparing totally different numerical values..
to understand the issue i suggest you try and put num(now()) in table object next to num(maketime(hour,minute))
time is basically decimal value and integers are days.
In your case try:
Frąc(Now()) >= maketime(4,20) AND Frac(Now()) <= maketime(5) THEN
Also… i am not sure about AND in control statements. Maybe you will need to nest it instead
 SRA
		
			SRA
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
You can schedule a full reload on Monday, and a partial reload on other days.
Check https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes... if you need more info about how you can prepare your script for partial reload.
Regards,
SRA
 Sivalingam
		
			Sivalingam
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Is there any option to do this with variable
 SRA
		
			SRA
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I don't think so, If with some conditions you do not execute some parts of the script then tables created in the code you do not execute will be deleted from the model.
In my opinion, only the partial load will give you the possibility to keep some tables in the model without having to recalculate them.
 SRA
		
			SRA
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
Did you tried the partial reload to cover your requirement ? Was it ok ? Do you need more help on this ?
Regards,
SRA
 Sivalingam
		
			Sivalingam
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi all I found a solution, refer below this might be useful for you.
If today is Monday, I am loading the fields from source file and storing it in another qvd file and using the stored field from that qvd file for the remaining days
IF WeekDay(Today()) = 1 //Run if today = monday
THEN
//Time(Now()) >= '04:20:00' AND Time(Now()) <= '05:00:00' THEN
Plan:
LOAD
//RowNo() as RowID, // Create a unique identifier for each row
Item,
IF(DOC > 7000,0, (Demand-QTY+SafetyStock)) as Plan1,
If(Demand > 0, ((QTY*"Working Days")/Demand), 'No Demand') as DOC_Cal
RESIDENT ItemData;
STORE Plan INTO [lib://dlpunsr002/PlanTrial.qvd] (qvd);
// Drop the original data table if it's no longer needed
DROP TABLE Plan;
EndIf
CalPlan:
LOAD
Item,
Plan1,
DOC_Cal
FROM [lib://dlpunsr002/PlanTrial.qvd] (qvd);
INNER JOIN (ItemData)
LOAD 
Item,
(IF(Plan1<0 , ' ', Plan1)) as Plan,
DOC_Cal
RESIDENT CalPlan;
 Lech_Miszkiewic
		
			Lech_MiszkiewicIf you dont want to use partial reload part run control script statement: https://help.qlik.com/en-US/sense/November2024/Subsystems/Hub/Content/Sense_Hub/ChartLevelScripting/...
On monday part you want needs to be stored (say into QVD) and on Monday you run part of the script which runs and stores to QVD on all other days just skip that part of the script and only load table from stored QVD.
IF ... then ... // monday
transfrom and do whatever needs to be done on monday
store into.... qvd.
Else // all other days
load from QVD
EndIF
 Sivalingam
		
			Sivalingam
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi - can you let me know how I can run this script only on monday and that to in a stipulated time frame
eg - time frame - 4.00am to 5.00am
Time(Now()) >= '04:20:00' AND Time(Now()) <= '05:00:00' THEN --- this is what I tried in the script, but it is not working, can you suggest any alternate method.
 Lech_Miszkiewic
		
			Lech_MiszkiewicIt is because now() returns timestamp including date and you compare it to time which doesnt have date in it so in reality you are comparing totally different numerical values..
to understand the issue i suggest you try and put num(now()) in table object next to num(maketime(hour,minute))
time is basically decimal value and integers are days.
In your case try:
Frąc(Now()) >= maketime(4,20) AND Frac(Now()) <= maketime(5) THEN
Also… i am not sure about AND in control statements. Maybe you will need to nest it instead
