Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Is there any example that works for SDK.NET

Sorry for the post but I continue to try and try again what you wrote in 'or' Help Qlik Sense for Developers Version: 1.0.2 "but no nothing works without having to make changes !!!

You can post as a trivial application  that working!.

In this case, I added the following code and does not enter into the foreach loop (Test(2) and Test(3))

http://help.qlik.com/sense/en-us/developer/#../Subsystems/NetSdk/Content/HowTos/NetSdk_HowTo_ListObj...

My app contains 2 sheets with the following sheetobject

Sheet (1) "Il mio nuovo foglio"

     SheetObject (1) :  Type:table ID:sFq

     SheetObject (2): Type:piechart ID:FUyeBYF

Sheet (2) "Sheet2"

     SheetObject (1) :  Type:linechart ID:LJHaM

//1) Test -

            foreach (IGenericObject child in ASheet.Children  )

            {

                Console.WriteLine("1) Test -  Type:{0} ID:{1}", child.Info.Type, child.Info.Id);

             }

//2) Test - this code does not enter

            foreach (IPiechart child in ASheet.Children.OfType<IPiechart>())

            {

                Console.WriteLine(" 2) Test - Type:{0} ID:{1}", child.Info.Type, child.Info.Id);

            }

//3) Test -   this code does not enter

            foreach (ILinechart child in ASheet.Children.OfType<ILinechart>())

            {

                Console.WriteLine(" 3) Test - Type:{0} ID:{1}", child.Info.Type, child.Info.Id);

            }

//4) Test -

          foreach (IGenericObject child in ASheet.Children )

           {

                Console.WriteLine(" 4) Test Type:{0} ID:{1}", child.Type, child.Id);

              

            }

Output:

Test: Il mio nuovo foglio

1) Test -  Type:table ID:sFq

1) Test -  Type:piechart ID:FUyeBYF

4) Test Type:GenericObject ID:sFq

4) Test Type:GenericObject ID:FUyeBYF

Test: Sheet2

1) Test -  Type:linechart ID:LJHaM

4) Test Type:GenericObject ID:LJHaM

NB. Delphi solution with OCX

procedure TXXX.GetSheetObjects(var ListObjectID: TStringlist;

  const AObjectType: array of Smallint; ADoc: TQlikDocument; ASheet: Sheet);

var

  i, j: Integer;

  objs: OleVariant; // TSheetObjects;

  obj: SheetObject;

begin

  if ASheet <> nil then

    try

      // ListObjectID:=TStringList.Create;

      if ASheet.Noofsheetobjects > 0 then

      begin

        objs := ASheet.GetSheetObjects;

        For i := VarArrayLowBound(objs, 1) to VarArrayHighBound(objs, 1) do

        begin

          obj := TSheetObjects(objs);

          for j := 0 to High(AObjectType) do

          begin

            if (obj as SheetObject).GetObjectType = AObjectType then

            begin

              ListObjectID.Add((obj as SheetObject).GetObjectID);

              break;

            end;

          end;

        end;

      end;

    except

    end;

end;

PS

Sorry if I insist with questions ... but there is the old function that performs GetSheetObjectbyID

.........."ActiveDocument.GetSheetObject("CH06")"...........



thank you in advance for your patience

Corchi

9 Replies
Not applicable
Author

Hi,
I have tested your code with my application and it works, so I can't help there, but I can see that you create multiple sheets.
Here is an example how you can traverse all sheets to find all pie charts.

foreach (var sheet in application.GetSheets())
{
  foreach (var c in sheet.Children.OfType<IPiechart>())
  {
    Console.WriteLine(c.Info.Id + "#" + c.Info.Type);
  }
}

Regrading geting objects / charts (ActiveDocument.GetSheetObject("CH06")) you can use:

IPiechart piechart = application.GetObject<IPiechart>("CH06");

Best Regards
Lars-Göran Book

Anonymous
Not applicable
Author

sorry but it does not work even your example does not enter the foreach...I have tried the code with your example "Helpdesk Management" and it does not work ... I downloaded and reinstalled again Qlik sense 64bit and Qlik .Net SDK 1.0.2.0

??????????

Not applicable
Author

Hi agian,

I have tested this code with a Qlik Sense Server Version 1.0.2 installation and you can see the output. So could it be that your Helpdesk Management app is corrupt or are there som privilege problems? To verify your privilege you can test if you are able retreive the title of the sheets. You could also create a new app in the client and test if your get some information from it.


ILocation Qliksense102 = Qlik.Engine.Location.FromUri(new Uri("https://rd102.rd.qliktech.com"));
IAppIdentifier foundAppIdentifier = Qliksense102.AppWithName("Helpdesk Management");

IApp application = Qliksense102.App(foundAppIdentifier);
foreach (var sheet in application.GetSheets())
{
  Console.WriteLine(sheet.SheetMetaData.Title);

  foreach (var c in sheet.Children.OfType<ILinechart>())
  {
    Console.WriteLine(c.Info.Id + "#" + c.Info.Type);
  }
}

Output:
Performance
xfvKMP#linechart
Case Details
Dashboard
hRZaKk#linechart

Best regards
Lars-Göran Book

Anonymous
Not applicable
Author

I'm trying to connect to our server qliksense but an error occurs immediately when I run

         "IAppIdentifier foundAppIdentifier = Qliksense102.AppWithName("Helpdesk Management");"


this is the error:

An unhandled exception of type 'Qlik.Sense.Common.Communication.GeneralCommunicationException' occurred in Qlik.Engine.dll

Not applicable
Author

Hi,

OK it seems to be somthing with the configuration of the Qlik Sense Server.

Common problems are :

  • "websocket white list", where you should add your domain (example: mydomain.com) or ip-adress of the .Net SDK clients.
  • firewall ports

Please read the manual and verify your configuration .

Best regards

Lars-Göran Book

Anonymous
Not applicable
Author

not clear to me ??? I state that the firewall is disabled ... What should I put on the white list? also the ip address of my pc? in addition to the domain??

I ask this because browsers can read all everyone app but from VS not works

Not applicable
Author

In the white list you should add your doman for example mydomain.com, if you have computers out side your domain that you want give access to the server you can add their ip-address. After changing the configúration don't forget to restart the proxy.

// Lars-Göran Book

Not applicable
Author

The difference between using the .net SDK and the Sense client is where the code is hosted. The hosting computer always need to be in the proxy's whitelist to allow socket communication. The Sense server that hosts the client is added the the whitelist by default.

// Johan Tejle

Anonymous
Not applicable
Author

ok thanks, I'll try!!!