Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
alex_nerush
Partner - Creator II
Partner - Creator II

How to add dimensions and expressions for an extension object?

Is it possible to add dimensions and/or expressions for an extension object using JavaScript?

14 Replies
alex_nerush
Partner - Creator II
Partner - Creator II
Author

After couple of hours googling community and digging into the QlikView Ajax library i've found solution and would like to share ideas here.

So, to add dimension and/or expression from Extension's JavaScript code you can write following code:

Qva.AddExtension('MyExtension', function(){

     // extension's code is ommited

    // to add dimension:

    this.Layout.SetProperty("Chart.Dimension.Add", "", false)

    this.Layout.SetProperty("Chart.Dimension.0.Field", "MyDimensionField", true);

   // to add expression

  this.Layout.SetProperty("Chart.Expression.Add", "", false)

   this.Layout.SetProperty("Chart.Expression.0.0.Definition", "SUM(MyValueField)", true)

});

But there is a new question: how to determine the number of dimensions and expressions?

Not applicable

Hi Alex,

do you found a solution of your problem?

I've tried to use your code, it works very well.

Have you tried to remove a dimension or expression?

Have a nice day,

Mattia

alex_nerush
Partner - Creator II
Partner - Creator II
Author

Hi Mattia, i've tried only to add  dimensions and expressions.

Not applicable

Hi Alex,

thank's for your very fast reply.

Do you think it's possible to remove dimensions/expression like in VbScript?

I've not found any document online that explain well the Javascript code to manage the QlikView Document.

Also your property: this.Layout.SetProperty("Chart.Dimension.Add", "", false)

doesn't return any result in Google or in some QlikView Api.

Where do you find it?

Thank's

Mattia

alex_nerush
Partner - Creator II
Partner - Creator II
Author

Please, try following:

to delete dimension:

Chart.Dimension.0.Remove

0 - dimension's index, starting from zero.

to delete expression

Chart.Expression.0.Remove

0 - expression's index, starting from zero.

actually, it's not documented featutes.

Not applicable

Hi Alex,

i've tried to execute this pieces of codes:

_this.Layout.SetProperty("Chart.Dimension.0.Remove", "", false);

_this.Layout.SetProperty("Chart.Expression.0.Remove", "", false);

But nothing happen. No errors, but no Dimensions/Expressions removes.

Why, in your opinion, anybody write a document of the Javascript fetures?

It would be very important have a list of all possible method to call to interact with the QlikView Object.

Mattia

Alexander_Thor
Employee
Employee

Keep in mind that once you deploy your document through QVS you can't interact with the object like that.

You can't persist changes back to the core application once it's deployed or create hypercubes at runtime without "shared objects".

Not applicable

So it's impossible to have a complete conversion from VbScript to Javascript?

I can't read a list box possible values, add/remove dimensions and expressions?

Do you know if it's possible to put a QlikView object (like a pivot chart or bar chart) in my extension?

Thank's

Mattia

Alexander_Thor
Employee
Employee

Well, you can't add or remove dimensions with macros in the AJAX client either

Sure you can read list box values.

It might be easier if you try to explain what you are trying to accomplish.