Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a method to fetch data from objects. I am using kpilayout and hypercube to extract data from multiple pages. With large datasets, this method started failing with the GetLayout() method timing out. Is there any workaround to this?
My requirement is to extract the records from several tables and return IEnumerable<IEnumerable<string>>.
Below is some of the code that I am using:
using (var kpiLayout = appObject.GetLayout().As<KpiLayout>()) - This is the line that times out
{
//Some logic to find the pagesize used below
var hyperCubeData = appObject.GetHyperCubeData("/qHyperCubeDef", new[] { new NxPage { Top = page * rowPageSize, Height = rowPageSize, Width = hyperCube.Size.cx, Left = 0 } });
if (hyperCubeData != null && hyperCubeData.Any())
{
foreach (var dataPage in hyperCubeData)
{
if (dataPage.Matrix.Any())
{
foreach (var cellRow in dataPage.Matrix)
{
if (cellRow.Any())
{
row = new List<string>();
foreach (var cell in cellRow)
{
row.Add(Convert.ToString(cell.Num) == "NaN" ? cell.Text : Convert.ToString(cell.Num));
}
rows.Add(row);
}
}
}
}
}
}
Right now, I am stuck here.
Also noticed that if the object is loaded once manually through the UI, the timeout stops. Is there anyway to force the layout load?
Thanks,
Anoop
You can change the default timeout by setting the static property:
Qlik.Sense.JsonRpc.RpcConnection.Timeout = n;
where n is the timeout in milliseconds.
-Rob
Rob pointed to the timeout setting, but another approach might be to use the async version of GetLayout instead. That way you can have full control over the timeout yourself.