12 Replies Latest reply: Jan 31, 2013 3:30 PM by rich calligan RSS

Calling VBScript macro from loadscript

Arvind Mahapatar

Hello All,

 

I have created macro in Edit Module using VBScript.

 

Now I want to call the same macro from EditScript.

Is this possible and if yes how?

  • Re: Calling VBScript macro from loadscript
    Matan Alon

    Try this example:

     

    the script:

     

    T:
    LOAD * INLINE [
        F1
        1
        2
        3
        4
        5
    ];


    T2:
    load *,test(F1) as F2 resident T;

    drop table T

     

    the vbs  (macro):

     

     

    function test (x)

     

    test=x+1

     

    end function

    • Re: Calling VBScript macro from loadscript
      Arvind Mahapatar

      Hello Matan,

      Thanks for you reply.

       

      I tried above script. It gives error

      Error in expression:

      TEST is not a valid function

       

      T2:

      load *,test(F1) as F2 resident T

       

      See I will explain u d functionality i need to achieve.

      Basically after the qvw file gets reloaded, its PDF is to be created automatically for which i have written macro. I have set the action Run Macro on trigger OnPostReload and this works fine when I run the report on qlikview developer.

      But when the same report is reloaded through qlikview server it does not fire the trigger after completion of reload.

      I have also done the settings on server to allow macro execution. On qlikview community i found one more setting by pressing Ctrl+shift+m. I have also done that.

      In spite of all these things macro is not getting executed on server. So i was trying if macros can be executed through edit script. I am using Qlikview 11.00 SR1 version and I dont have publisher.

      Let me know if I have to do any other settings or anything else is required.

      Please help on this matter  ASAP. Its really very urgent.

      Thank u in advance.

      • Re: Calling VBScript macro from loadscript
        Alexander Karlsson

        You can execute macro functions by doing something like this in your load script:
        LET Execute = MyMacroSub();

         

        Where MyMacroSub is a function defined in your macro.

        The hard part is that the macro will execute with the security of the user that runs your QVService, or Publisher if you had that. So this is a HUGE security risk as you would need to assign system access to the account running your services.