Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
rash_611
Partner - Contributor III
Partner - Contributor III

Business Hours calculation through Sub

Hi All,

     i have written the code for calculating business hours between two dates in a SUB. how to call that from model through passing the fields to the SUB. as i need to calculate the business hours for each callno and i have to find this for many number of field combination i have still some more date fields to find. can any one help me on this plz....

4 Replies
tresesco
MVP
MVP

Do you want this sub to be used in load statement? If so, then create function in edit module/macro using vb/java script. Otherwise, sub created in the load script can't be used in load.

rash_611
Partner - Contributor III
Partner - Contributor III
Author

thanks for the reply... i just want to calculate the business hours for many fields how do i do that... if i write macro and call that each time it may impact the performance of the application as data is huge may be around 5k calls per day...

tresesco
MVP
MVP


Have a look at the below example:

Sub Load1( F1, F2)
Final:
Load
$(F1)*100 as Field1,
$(F2)*100 as Field2
Resident data;
End Sub


data:
load * Inline [
A, B, C
1, 2, 3
4, 5, 6
];

Call Load1('A', 'B');
Call Load1('B','C');

Drop Table data;

Hope this helps.

rash_611
Partner - Contributor III
Partner - Contributor III
Author

thanks a lot... it is working fine.