Can't able to read the String values from .h5 file

Hi Team,

We are writing the data to .h5 file i.e Creating an attributes with int,double and String values and so we are able to write and see the data in .h5 file which is fine.

And while reading the same attributes we are able to read only int and double values but not able to read the string values.we are getting null into local variable.

The following is the Code for reference.

// Writing the attribue into .h5 file

HDFql.Execute(“CREATE FILE WriteHDFql.h5”);

            // Use Created h5 file.
            HDFql.Execute("USE FILE WriteHDFql.h5");

            HDFql.Execute("CREATE GROUP Group ORDER TRACKED");
           
            // create an HDF5 dataset named "dataset" of data type Compound of one dimension(size 1)
            HDFql.Execute("CREATE DATASET Group /dataset AS COMPOUND(real AS INT, imagi AS INT)(1) ENABLE ZLIB");

           
            HDFql.Execute("CREATE ATTRIBUTE Group/dataset/Sample_data AS VARCHAR VALUES(\"ABC\")");

HDFql.Execute(“CLOSE FILE”);

// To Read the attribute value from WriteHDFql.h5

string[] strArray = new string[1];

        HDFql.Execute("SELECT FROM WriteHDFql.h5 Group/dataset/Sample_data INTO MEMORY " + HDFql.VariableTransientRegister(strArray));

        HDFql.Execute("CLOSE FILE");

We are getting null value into local variable ‘strArray’ and we want to get the value of attribute.

Could you please help us to get the solution for this.

Thanks in advance.

Hi @leelakrishna.k,

Currently, HDFql input/output redirecting options of variable-length data types (including VARCHAR) do not support (user-defined) variables in C#. This limitation has been solved in the upcoming release of HDFql version 2.5.0.

For the time being, please use HDFql cursor to read datasets/attributes of data type VARCHAR. Example:

string value;

HDFql.Execute("SELECT FROM WriteHDFql.h5 Group/dataset/Sample_data");

HDFql.CursorFirst();

value = HDFql.CursorGetChar();

System.Console.WriteLine("The value is " + value);

Hope it helps!