Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 );
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):
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):
This worked, thanks a lot!
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: