Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
LorisLombardo87
Partner - Contributor III
Partner - Contributor III

getLayout without data page

Hi everyone,

in my extension i'm trying to get the information of master item, I can correctly get what i want but it is a bit slow. given i'm more interested in things like id, title, calculation condition and other metadata more then actual data at this point, I was wondering if there is a way to get  the layout of an object without the data page in the hyper cube to speed up the process?

any thoughts?

Thanks,
Loris

 

Labels (2)
4 Replies
Øystein_Kolsrud
Employee
Employee

At least some of that information you can get through the properties instead. Would that be an option for you?

Otherwise, in my experience calculating the data page is typically not the most expensive part. The headers and cube size and things like that are typically what is most computationally expensive because they need the data of the full table. There is no way to compute only parts of a layout, but one option is to take the things you are interested in (the expression for the title and calculation condition for instance) and put them in a the properties of a session object and then get the layout for that instead.

LorisLombardo87
Partner - Contributor III
Partner - Contributor III
Author

recreating the object starting from its props might be an option.

for now i've tried this

 

const props = await obj.getProperties();
                if (props.qHyperCubeDef) {
                    props.qHyperCubeDef.qInitialDataFetch = [{
                        qTop: 0,
                        qLeft: 0,
                        qHeight: 0,  // No rows
                        qWidth: 0    // No columns
                    }];
                }
                await obj.setProperties(props);
                layout = await obj.getLayout();
 
do you think it can work ?
 
thanks,
Loris
Øystein_Kolsrud
Employee
Employee

You can probably just do like this:

 

props.qHyperCubeDef.qInitialDataFetch = [];

 

But I'm not sure how much effect this will have with regards to performance.  I'm sure there are exceptions, but in my experience the most expensive parts of the hypercube layout are typically things like "qSize" and the "qGrandTotalRow" that returns values computed across the entire table.

Also, if you change the properties like that, then you will affect the behavior of the object in the app which might not be what you want. What I suggest is that you create a session object where you just include the parts you need. I'm not a JavaScript-wiz, but in C# it could look something like this:

var obj = app.GetGenericObject(objId);

var props = obj.GetProperties();
var title = props.Get<StringExpressionContainer>("title");
var calcCond = props.Get<HyperCubeDef>("qHyperCubeDef").CalcCond.v;

var props2 = new GenericObjectProperties { Info = new NxInfo { Type = "mytype" } };
props2.Set("title", title);
props2.Set("calcCondition", new ValueExpressionContainer("=" + calcCond));

var sessionObj = app.CreateGenericSessionObject(props2);
Console.WriteLine(sessionObj.GetLayout());
app.DestroyGenericSessionObject(sessionObj.Id);

The "GetLayout" call performed on that session object will be much cheaper than the one for the original object because it focuses strictly on the parts you are interested in.

LorisLombardo87
Partner - Contributor III
Partner - Contributor III
Author

yes i think that might be a good option, thanks Øystein