Qlik Community

Ask a Question

QlikView Integrations

Discussion Board for collaboration on QlikView Integration.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

select a date value in QlikView

Hey together,

I am using some OCX Code to make a selection in my QlikView-Application, it is working so far for me. But now I have discover some problems, I have try to select some date value e.g. 2011-01-03, this selection won't be work by my code, is there some workaround???

//clear selection on my QlikView-App

qvDoc.ClearAll();

//I have declared some object with holds the information about the selection, that must be selected
for (int i = 0; i < selection.Count; i++)

{

     Field qvField = qvDoc.GetField(QLIKVIEWFIELD);

          IArrayOfFieldValue selectedFields = qvField.GetNoValues();

          for (int j = 0; j < selection.selectionValue.Count; j++)

          {

                        selectedFields.Add();

                        selectedFields.Text = @selection.selectionValue.ToString();

          }

         qvField.SelectValues(selectedFields);

}


1 Solution

Accepted Solutions
Not applicable
Author

DateTime dateTime;

Double number;

Int32 number2;

for (int i = 0; i < selection.Count; i++)

{

     Field qvField = qvDoc.GetField(QLIKVIEWFIELD);

     IArrayOfFieldValue selectedFields = qvField.GetNoValues();

     for (int j = 0; j < selection.selectionValue.Count; j++)

     {

         selectedFields.Add();

         string val = @selection.selectionValue.ToString();

   if (DateTime.TryParse(val, out dateTime))

         {

            selectedFields.Number = Convert.ToDouble(qvDoc.Evaluate("=num('" + val  + "')"));

           selectedFields.IsNumeric = true;

   }

         else if (Int32.TryParse(val, out number2))

         {

             selectedFields.Number = number2;

             selectedFields.IsNumeric = true;

         }

         else if (Double.TryParse(val, out number))

         {

            selectedFields.Number = number;

            selectedFields.IsNumeric = true;

         }                    

         else

         {

            selectedFields.Text = val;

            selectedFields.IsNumeric = false;

         }

     }

     qvField.SelectValues(selectedFields);

}

View solution in original post

4 Replies
fdelacal
Specialist
Specialist

Try to do the num(2011-01-03) in other field.

This is better to see for qlikview.

Hope that helps you

Not applicable
Author

Facundo de la cal, good idea, but it doesn't work for me.

Here I havwe a try with a number, the selection of a number is also not working

if(Double.TryParse(selection.selectionValue.ToString(), out number))
{

                            ausgewaehlteFelder.Number = number;

}

Not applicable
Author

I play a little bit with the OCX API, something that I recognized was. That I am can select one Date value or number from a certain field.

Field qvField = qvDok.GetField(SOME_QLIKVIEW_FIELD);

qvField.Select("2011-03-01");

This is a little strange I think, maybe there is some bug in the API?

Not applicable
Author

DateTime dateTime;

Double number;

Int32 number2;

for (int i = 0; i < selection.Count; i++)

{

     Field qvField = qvDoc.GetField(QLIKVIEWFIELD);

     IArrayOfFieldValue selectedFields = qvField.GetNoValues();

     for (int j = 0; j < selection.selectionValue.Count; j++)

     {

         selectedFields.Add();

         string val = @selection.selectionValue.ToString();

   if (DateTime.TryParse(val, out dateTime))

         {

            selectedFields.Number = Convert.ToDouble(qvDoc.Evaluate("=num('" + val  + "')"));

           selectedFields.IsNumeric = true;

   }

         else if (Int32.TryParse(val, out number2))

         {

             selectedFields.Number = number2;

             selectedFields.IsNumeric = true;

         }

         else if (Double.TryParse(val, out number))

         {

            selectedFields.Number = number;

            selectedFields.IsNumeric = true;

         }                    

         else

         {

            selectedFields.Text = val;

            selectedFields.IsNumeric = false;

         }

     }

     qvField.SelectValues(selectedFields);

}

View solution in original post