5 Replies Latest reply: Sep 20, 2012 5:35 AM by a0284024 RSS

    Get a list of fields and field values from a document on the server

      Are there any API/SDKs that allows to get a list of fields and field values from a Qlikview document that is residing on the Qlikview Server?

       

      The QMS API doesn't seem to allow that. There seems to be an undocumented QVS API that is XML based but I'm not sure how to use that to get the relevant information. Any help?

       

      I've seen that the commercial QVSConnector component does something similar, possibly using the undocumented API however I would like to know how to implement similar functionality myself.

        • Get a list of fields and field values from a document on the server
          Jérémy George

          I do not know but would be very interested if you found a solution.

          • Re: Get a list of fields and field values from a document on the server
            Arnold Ayaoan

            Hi,

             

            I'm facing similar issue.

            Have you found a solution to this.

             

            Thanks,

            Arnold

            • Re: Get a list of fields and field values from a document on the server
              Alexander Karlsson

              I'm not sitting at a computer with vs installed atm so can't try it but have you looked into the GetFieldList & GetFieldContents methods implemented in the QMS interface?

               

              Here is a sample from the SDK:

               

              using System;
              using System.Collections.Generic;
              using System.Linq;
              using QMSAPI;
              
              
              class Program
              {
                  static void Main(string[] args)
                  {
                      try
                      {
                          // create a QMS API client
                          IQMS apiClient = new QMSClient();
              
              
                          //retrieve a time limited service key
                          ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();
              
              
                          ServiceInfo serviceInfo = apiClient.GetServices(ServiceTypes.QlikViewDistributionService).FirstOrDefault();
                          if (serviceInfo != null)
                          {
                              QDSDocumentSessionConfiguration sessionConfig = new QDSDocumentSessionConfiguration();
              
              
                              sessionConfig.QDSID = serviceInfo.ID;
                              sessionConfig.FilePath = @"C:\ProgramData\QlikTech\SourceDocuments\Sales.qvw";
              
              
                              QDSDocumentSession documentSession = apiClient.CreateSession(sessionConfig);
              
              
                              if (documentSession != null && documentSession.OpenDocumentResult == DocumentState.OpenedSuccessfully)
                              {
                                  List<Field> fields = apiClient.GetFieldList(documentSession);
                                  fields.ForEach(f=>Console.WriteLine(f.Name));
              
              
                                  apiClient.CloseSession(documentSession);
                              }
                              else
                              {
                                  Console.WriteLine("Failed to open the document.");
                              }
                          }
                      }
                      catch (Exception ex)
                      {
                          Console.WriteLine("An exception occurred: " + ex.Message);
                      }
                      // wait for user to press any key
                      Console.ReadLine();
                  }
              }