Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
jonastemin
Contributor II
Contributor II

Executing Jscript function during load statement

Hi,

I'm trying to execute a Jscript function during a load script but it looks like the command is not executed at all.

I have the following Jscript function:

support.jpg

The functions works correctly when executing using "Run Macro" button.

I looked at previous forum posts and this command should work;

support2.png

How do a call a Jscript function from a load script?

Are there security settings that prevents this from working?

Thanks,

Jonas

15 Replies
marcus_sommer

In general you could use macro-functions within the load-script but they mustn't contain any reference to ActiveDocument because it didn't exists at this time. Only after the script is finished ActiveDocument is available.

- Marcus

jonastemin
Contributor II
Contributor II
Author

‌Okay, I see. But is there a way to use the variable sPath in the Jscript function?


Is there another syntax in order to read the variable in the Jscript?


or

Can I use something like LET vExecFunction = post($(sPath))  and update the Jscript equivently? Tried this in the past but couldn't get it to work

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You should be able to do that. Just be sure to quote the parameter.

LET vExecFunction = post('$(sPath)');


Also if running QV Nov2017, you'll need turn off BNF mode by adding this as the first line of your script.

///$bnf off


-Rob

jonastemin
Contributor II
Contributor II
Author

Thanks, I got it working now when running Qlikview Desktop, both on local computer and Qlikview server.

However, in QMC the function is not executing.

I'm running Qlikview server 12.10.20400.0 so I have not set BNF mode to off.

Are there any settings in the QMC or document that I need to set?

Ricardo_Gerhard
Employee
Employee

Take a look on this procedure:

Cause

The new BNF script reload mode in QlikView November 2017 initial release doesn't allow the Macro function name in the script.
This is a bug that RD will fix in the future release, hopefully in Patch 1. 

Resolution

Disable the BNF script reload mode either from the script, or fromthe settings.ini file.

Instructions of disabling BNF reload module:

  1. Disabling BNF reload mode for the entire server: Update the Settings.ini by adding the line EnableBnfReload=0
  2. Disabling BNF reload mode for individual apps: Add the ///$bnf off tag at the top of the script (The tag must be in the first 50 characters of the script).
Ricardo Gerhard
OEM Solution Architect
LATAM
jonastemin
Contributor II
Contributor II
Author

I don't believe I use Qlikview November 2017. I run version 12.10.20400.0.

Ricardo_Gerhard
Employee
Employee

This is an information from Qlik in another problem.

Try, could be helpful and fix.

Ricardo Gerhard
OEM Solution Architect
LATAM
jonastemin
Contributor II
Contributor II
Author

Added the EnableBnfReload=0 but it didn't help. Restarted the server to make sure settings were updated.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

You're right, The option to execute Load Scripts in strict BNF mode is new to QlikView 12.20 (and Qlik Sense of the same date) or later and does not apply to earlier versions.