<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: .net SDK  failed to covert System.String to Qlik.Engine.Blob in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1986529#M17409</link>
    <description>&lt;P&gt;A quick follow up on this. A fix will be available in the next minor release of the .NET SDK which is currently targeted for November 2022.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Sep 2022 12:31:30 GMT</pubDate>
    <dc:creator>Øystein_Kolsrud</dc:creator>
    <dc:date>2022-09-28T12:31:30Z</dc:date>
    <item>
      <title>.net SDK  failed to covert System.String to Qlik.Engine.Blob</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1983618#M17383</link>
      <description>&lt;P&gt;Hi, I am creating an Excel add-in, to directly import data from Qlik Sense to Excel. I am using the toolbox Qlik Sense .net SDK.&amp;nbsp;I encountered a fatal error when I tried to retrieve the 'qExpansionState' of a pivot table and here is the error message:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Newtonsoft.Json.JsonSerializationException: 'Error converting value&amp;nbsp; &amp;nbsp; "BDgyMTEwMDAwMDAtLUluY29tZSAvIChMb3NzKSBmcm9tIE9wZXJhdGlvbnMA" to &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;type 'Qlik.Engine.Blob'. Path 'qExpansionState[0].qPos.qElemValues[0]', line 1, position 5788.'&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Inner Exception&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ArgumentException: Could not cast or convert from System.String to Qlik.Engine.Blob.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I can't programmatically manipulate the expansion state of a pivot table until this issue is solved. It will be very kind of you to give me some advice or an alternate solution. Thank you very much.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 11:54:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1983618#M17383</guid>
      <dc:creator>songguozh</dc:creator>
      <dc:date>2022-09-21T11:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: .net SDK  failed to covert System.String to Qlik.Engine.Blob</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1983678#M17384</link>
      <description>&lt;P&gt;How are you accessing that property? A "Blob" is not really a string, but raw binary data I believe:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/August2022/Subsystems/EngineJSONAPI/Content/models-blob.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/August2022/Subsystems/EngineJSONAPI/Content/models-blob.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 13:18:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1983678#M17384</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2022-09-21T13:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: .net SDK  failed to covert System.String to Qlik.Engine.Blob</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1984055#M17389</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Øystein, thank you very much for your reply. What I want to do is getting the expansion state of a pivot table with Qlik Sense .net SDK.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the result with JSON API, the qExpansionState is an array with 6 elements.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot 1.png" style="width: 924px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89640i22FBBFCBC98A3E10/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot 1.png" alt="screenshot 1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Now I am doing the same thing with the following c# code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot 2.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89641i4EF7D509D15C577F/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot 2.png" alt="screenshot 2.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;the result of line 1 is, expstate = null, which means the code didn't retrieve qExpansionState properly. Then I add some additional code to check the conversion.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the result of line 2, which shows qExpansionState as json, and everything looks fine.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot 3.png" style="width: 628px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89643i31E8FDE4A76B513F/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot 3.png" alt="screenshot 3.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;However when I try to convert this json to List&amp;lt;ExpansionData&amp;gt;, an exception is thrown(in line 3).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot 4.png" style="width: 418px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89644i2428AA78929FCB0A/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot 4.png" alt="screenshot 4.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The error comes from the conversion of qElemValues from System.String to Qlik.Engine.Blob. And I think the null value of expState in line1 is also due to the same reason, however the exception is caught and just returns a null value.&lt;/P&gt;
&lt;P&gt;What do you think about this exception? Looking forward to your relply. Many thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 07:35:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1984055#M17389</guid>
      <dc:creator>songguozh</dc:creator>
      <dc:date>2022-09-22T07:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: .net SDK  failed to covert System.String to Qlik.Engine.Blob</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1984534#M17394</link>
      <description>&lt;P&gt;That's very interesting! Looks like&amp;nbsp; you have found a deserializer bug in the SDK! Those "Blob" constructs&amp;nbsp; are quite rare in the engine API and it seems the SDK doesn't deserialize them correctly.&lt;/P&gt;&lt;P&gt;But it's possible to work around this issue by using the AbstractStructure class. Here is an example on how to set the first expansion state entry of a pivot table hypercube:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var pivotTable = app.GetGenericObject(objId);
var props = pivotTable.GetProperties();
var cube = props.Get&amp;lt;HyperCubeDef&amp;gt;("qHyperCubeDef");
var expStates = cube.Get&amp;lt;AbstractStructure[]&amp;gt;("qExpansionState");

var obj = JObject.Parse("{\"qPos\":{\"qDimName\":\"Dim1\",\"qElemNo\":[1],\"qElemValues\":[\"BEIA\"]}}");
var newExpState = new AbstractStructure(obj);
expStates[0] = newExpState;

pivotTable.SetProperties(props);&lt;/LI-CODE&gt;&lt;P&gt;In that case the new ExpansionState instance is created from a string representation of the underlying JSON structure. If you prefer to use object annotation, then you can do like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var obj = JObject.FromObject(new
{
    qPos = new
    {
        qDimName = "Dim1",
        qElemNo = new[] { 1 },
        qElemValues = new[] { "BEIA" }
    }
});
var newExpState = new AbstractStructure(obj);&lt;/LI-CODE&gt;&lt;P&gt;Now I don't know how that "qElemValues" property is encoded. The engine API documentation doesn't document that part, so I'm afraid I can't help you there. But if you want to for instance reset a value to one that you know is correct, then this flow should work.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 06:48:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1984534#M17394</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2022-09-23T06:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: .net SDK  failed to covert System.String to Qlik.Engine.Blob</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1985141#M17397</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Øystein, thank you very much for your solution!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 07:23:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1985141#M17397</guid>
      <dc:creator>songguozh</dc:creator>
      <dc:date>2022-09-26T07:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: .net SDK  failed to covert System.String to Qlik.Engine.Blob</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1986529#M17409</link>
      <description>&lt;P&gt;A quick follow up on this. A fix will be available in the next minor release of the .NET SDK which is currently targeted for November 2022.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 12:31:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/net-SDK-failed-to-covert-System-String-to-Qlik-Engine-Blob/m-p/1986529#M17409</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2022-09-28T12:31:30Z</dc:date>
    </item>
  </channel>
</rss>

