Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

zadravecm
Not applicable

Manipulate Load script Variable in Extension

Hi,

I would like to manipulate load script inside my extension.

For example, I would like to have a variable with customer Id, that would be calculated inside my extension.

For testing (just to see how this behave) I try this:

In LOAD script:

Set MyVar = 4;

Exit Script when MyVar<>4;

Inside my extension:

app.variable.setNumValue("MyVar", 5);

app.doReload(2,false,false).then(function(e) {

           app.doSave();

});

This gave me an Internal engine error.


And even if it would work, I can see the problem, that after doReload is called the MyVar is set to 4 again.

So my second approach was


If Len(Trim('$(vScriptVariable1)')) = 0 then

Set MyVar = 4;

Else

Set MyVar = 3;

End If

Exit Script when MyVar<>4;

and inside my extension:

app.variable.create({qName : 'vScriptVariable1'});

app.variable.setStringValue("vScriptVariable1","marko");

app.doReload(2,false,false).then(function(e) {

            app.doSave();

});

But it give me the same error.

If I change

app.variable.setStringValue("vScriptVariable1","marko");

to

app.variable.setStringValue(vScriptVariable1,"marko");


error goes away, but nothing happened.


How to do this right?


Marko Zadravec