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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Mathijs
Partner - Contributor II
Partner - Contributor II

[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
Øystein_Kolsrud
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

3 Replies
Øystein_Kolsrud
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...

Mathijs
Partner - Contributor II
Partner - Contributor II
Author

This worked, thanks a lot!

Øystein_Kolsrud
Employee
Employee

The latest version of the .NET SDK (version v15.6.0) contains an improvement to the handling of default values for optional value type arguments. This improvement has the effect that when you omit the use of such values, or assign the default value to them, then those values will not be sent to the engine. This is analogous to how the handling of null-values for non-value types behave. This means that type of cross-version incompatibility issue encountered in this thread should no longer be an issue. The release is available on NuGet:

https://www.nuget.org/packages/QlikSense.NetSDK/15.6.0

Further information about what's new can be found in the release notes:

https://help.qlik.com/en-US/sense-developer/November2021/Subsystems/NetSDKAPIref/Content/ReleaseNote...