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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

Call Subroutine based on file name

I need to call a specific subroutine based on the name of the file. Somthing like this:

If (DocumentName()= 'Model', 'CALL BASE', 'CALL MI')

Looking for help on how to write the script

Thanks,

Zag

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

In the script it should be like this I guess:

IF DocumentName() = 'Model' THEN

    CALL BASE

ELSE

    CALL MI

END IF

But if the logic needs to work inside a LOAD statement it must be like this:

(I guess this is not what you are looking for)

LOAD

    If( DocumentName() = 'Model', BASE() , MI() ) AS aCalc

....

;

The BASE and MI must then be Functions implemented in VBScript which can be called directly from a LOAD SCRIPT without a problem.

View solution in original post

2 Replies
petter
Partner - Champion III
Partner - Champion III

In the script it should be like this I guess:

IF DocumentName() = 'Model' THEN

    CALL BASE

ELSE

    CALL MI

END IF

But if the logic needs to work inside a LOAD statement it must be like this:

(I guess this is not what you are looking for)

LOAD

    If( DocumentName() = 'Model', BASE() , MI() ) AS aCalc

....

;

The BASE and MI must then be Functions implemented in VBScript which can be called directly from a LOAD SCRIPT without a problem.

zagzebski
Creator
Creator
Author

So simple. Thanks!

Steve