Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

what is subroutines in qlikview? where we use this ?how?

what is subroutines in qlikview? where we use this ?

4 Replies
sujeetsingh
Master III
Master III

Here is a script of Sub routine

Sub DecBin (Number) // Function to convert Dec to Binary

  LET Output = Floor(Number/POW(2,26),1);

  FOR i = 25 to 0 step -1

   LET Remainder = Mod(Number,POW(2,$(i)+1));

   LET Output =  Output & Floor(Remainder/POW(2,$(i)),1);

  NEXT i;

End Sub;

FOR x = 1 to NoOfRows('USERS')

  tmp:

  LOAD userAccountControl as NumberSubmit resident USERS where RecRef = $(x);

  Let tmpNumberSubmit = FieldValue('NumberSubmit',1);

  CALL DecBin($(tmpNumberSubmit));

  BinValues: // store Binary value into a temporary separate table for now

  LOAD

   RecRef AS RecBack,

   $(Output) as BinaryValue

  Resident USERS Where RecRef = $(x);

  DROP TABLE tmp;

NEXT x;

Anonymous
Not applicable
Author

please explain me this script yar

deepakqlikview_123
Specialist
Specialist

subroutine is reusable code in qlikview.After writing subroutine we just need to call it once define no need to write it again and again.

Thanks,

Deepak

ngulliver
Partner - Specialist III
Partner - Specialist III

Hi,

A 'subroutine' is not a term particular to QlikView. This is a term universally used in I.T. Deepak is quite clear in his explanation.

There is a definition in QlikView Help - search for 'SUB'. In QlikView a subroutine is started by the command 'SUB' and closed by the command 'END SUB'. What the subroutine runs is up to you.