Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it possible to add dimensions and/or expressions for an extension object using JavaScript?
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?
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
Hi Mattia, i've tried only to add dimensions and expressions.
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
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.
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
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".
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
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.