Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

cancel
Showing results for 
Search instead for 
Did you mean: 
Mathijs
Partner
Partner

[SDK] GetTablesAndKeys not working

Hi,

With the SDK I'm trying to retrieve an overview of all tables and fields in the datamodel of an App. I'm using the GetTablesAndKeys function, but can't get it to work. I keep getting a "Invalid method parameters" exception.

I've looked in the forums and the documentation but can't find what I'm doing wrong. Anyone got any thoughts on this? Thanks in advance!

 

 

var appId = location.AppWithId("c8a75f27-bebf-49b3-b2f0-af963497d864");
var app = location.App(appId);
app.GetTablesAndKeys(
    new Size() { cx = 1000, cy = 1000 }
    , new Size() { cx = 0, cy = 0 }
    , 30
    , true
    , false );

 

Mathijs_0-1627387139431.png

 

1 Solution

Accepted Solutions
yko
Employee
Employee

I think you are running into an issue relating to using a new SDK version for an older version of the engine. There was an optional boolean argument added to the method GetTablesAndKeys, and the SDK will send the default value for this argument (which is false) if nothing is specified for it. Workarounds are either to use an older version of the SDK, or build the Request object yourself and use the generic SendAsync method like this:

var size1000 = new Size { cx = 1000, cy = 1000 };
var arguments = new object[] { size1000, size1000, 30, true, true };
var tablesAndKeys = app.Session.SendAsync(new Request(app.Handle, "GetTablesAndKeys", null, arguments)).Wait();

A longer explanation for the origin of this version compatibility problem can be found here (the topic of that thread is a different method, but the underlying problem is the same):

https://community.qlik.com/t5/Integration-Extension-APIs/Bug-or-Feature-QS-NET-SDK-ExportDataAsync/m...

View solution in original post

2 Replies
yko
Employee
Employee

I think you are running into an issue relating to using a new SDK version for an older version of the engine. There was an optional boolean argument added to the method GetTablesAndKeys, and the SDK will send the default value for this argument (which is false) if nothing is specified for it. Workarounds are either to use an older version of the SDK, or build the Request object yourself and use the generic SendAsync method like this:

var size1000 = new Size { cx = 1000, cy = 1000 };
var arguments = new object[] { size1000, size1000, 30, true, true };
var tablesAndKeys = app.Session.SendAsync(new Request(app.Handle, "GetTablesAndKeys", null, arguments)).Wait();

A longer explanation for the origin of this version compatibility problem can be found here (the topic of that thread is a different method, but the underlying problem is the same):

https://community.qlik.com/t5/Integration-Extension-APIs/Bug-or-Feature-QS-NET-SDK-ExportDataAsync/m...

View solution in original post

Mathijs
Partner
Partner
Author

This worked, thanks a lot!