Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
AlexUsov
Contributor
Contributor

How to extract QVD data using .NET

Is there any way to extract data from QVD file using .NET?

I need to get at least XML header to describe the fields in the table, the layout of the subsequent information and other meta-data

 

Thanks in advance.

Labels (3)
4 Replies
PiEye
Contributor III
Contributor III

If you open a QVD in a text editor, you can see that the XML information is at the start of the file and easily readable. In C# .net, you can use xmlreader in a loop to parse the elements, stopping at the last element <\QvdTableHeader> 

See below c#

using System;
using System.IO;
using System.Xml;

public class Sample {

  private const String filename = "tesstQVD.qvd"

  public static void Main() {

     XmlTextReader reader = null;

     try {

        // Load the reader with the data file and ignore all white space nodes.
        reader = new XmlTextReader(filename);
        reader.WhitespaceHandling = WhitespaceHandling.None;

        var flag = true;

        while (reader.Read() & flag) {
           switch (reader.NodeType) {
             case XmlNodeType.Element:
               Console.Write("<{0}>"reader.Name);
               vlastXMLNodereader.Name;
               break;
             case XmlNodeType.Text:
               Console.Write(reader.Value + "\r\n");
               break;
              case XmlNodeType.EndElement:
                if (reader.Name=="QvdTableHeader")
                    {
                        Console.Write("END OF QVD meta data xml");
                        flag = false;
                    }
                break;
             default:
                break;
           }
        }
     }

     finally {
        if (reader!=null)
          reader.Close();
     }
  }
// End class
AlexUsov
Contributor
Contributor
Author

Thank you @PiEye !

Your answer was very helpful, but that's not what I was looking for. This is my mistake in posing the question. I need to programmatically get QVD file from our QlikView servers and only then read the metadata.

Do you have information on how to do this?
Any answer would be appreciated.

Thanks in advance.

PiEye
Contributor III
Contributor III

Hi Alex!

Looks like I tackled the second bit, but not the first!

In this case you will need to find the path where the QVD's are stored, then loop through them and use the rest of my code above

If you change   the value in

private const String filename = "tesstQVD.qvd"; 

To the path  and filename of each QVD, it should then read the data from it.

Pi

IllegalGoose
Contributor
Contributor


@AlexUsov   wrote:         publix.org

Is there any way to extract data from QVD file using .NET?

I need to get at least XML header to describe the fields in the table, the layout of the subsequent information and other meta-data

 

Thanks in advance.


Thank you so much for sharing such a useful information.