Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi All, i wanted to know if there is a function which can output the time taken to run the script from start to finish. this is something which is displayed when script is running (below is screen grab), just want to store this somehow.. thanks in advance

 
					
				
		
Hi
I think there is no function to calculate script run time instead to find the out we need to call subroutines
Try below code use includes .
// Declare the variables
SET vStartTime=;
SET vEndTime=;
SET vTimeTake=;
// Start Load time
// Call before load time
Sub StartLoad
// Assing now to Variable
Let vStartTime = num(now());
End Sub;
// Sub to calculate time in Load
// Sub timeCalculate(vStartTime,vEndTime,vTableName,vMessage)
Sub timeCalculate(vTableName,vMessage)
// Calculate the End Time
Let vEndTime = num(now());
// Initlize the time taken
SET vTimeTake=;
// Calculate the time Taken
LET vTimeTake = Date(($(vEndTime) - $(vStartTime)),'hh:mm:ss');
// LOG Table Writing
Log:
Load
now(1) as TimeStamp,
'$(vTableName)' as TableName,
'$(vTimeTake)' as LoadTime,
'$(vMessage)' as LogMessage
AutoGenerate 1;
// Initlize the variables
SET vStartTime=;
SET vEndTime=;
SET vTimeTake=;
End Sub;
Sub LogWrite
// Store and Reload Log File
Store Log into log.txt (txt);
DROP Table Log;
End Sub
 
					
				
		
 santiago_respan
		
			santiago_respanHi!
You could configure your app to generate the log file for every execution, in there you will find start/end time and more execution details.
You can do it from "Document properties > General tab" and the "Generate logfile" box must be checked.
Let me know if this helps.
Kindest regards,
 
					
				
		
I would say, take two variable at script level, say:
Variable at Staring point of script: Let VStart = now();
your code.....
Variable at Endingpoint of script: Let VEnd = now();
and now do like: Vend - Vstart
 
					
				
		
Hi
I think there is no function to calculate script run time instead to find the out we need to call subroutines
Try below code use includes .
// Declare the variables
SET vStartTime=;
SET vEndTime=;
SET vTimeTake=;
// Start Load time
// Call before load time
Sub StartLoad
// Assing now to Variable
Let vStartTime = num(now());
End Sub;
// Sub to calculate time in Load
// Sub timeCalculate(vStartTime,vEndTime,vTableName,vMessage)
Sub timeCalculate(vTableName,vMessage)
// Calculate the End Time
Let vEndTime = num(now());
// Initlize the time taken
SET vTimeTake=;
// Calculate the time Taken
LET vTimeTake = Date(($(vEndTime) - $(vStartTime)),'hh:mm:ss');
// LOG Table Writing
Log:
Load
now(1) as TimeStamp,
'$(vTableName)' as TableName,
'$(vTimeTake)' as LoadTime,
'$(vMessage)' as LogMessage
AutoGenerate 1;
// Initlize the variables
SET vStartTime=;
SET vEndTime=;
SET vTimeTake=;
End Sub;
Sub LogWrite
// Store and Reload Log File
Store Log into log.txt (txt);
DROP Table Log;
End Sub
 
					
				
		
 roger_stone
		
			roger_stone
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		At the start of the script:
LET varTimer = NOW();
.... your script ....
Then put these two lines at the end of the script (before any exit script statement)
LET varTimer=TIME(NOW() - varTimer);
TRACE Taken $(varTimer) to run;
 
					
				
		
Thanks everyone..
 
					
				
		
 rwunderlich
		
			rwunderlich
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If you set a start time at the beginning of the script:
LET vScriptStart = now(1);
You can add a text box to your app with the expression:
=interval(ReloadTime() - vScriptStart, 'hh:mm:ss')
-Rob
