3 Replies Latest reply: Oct 18, 2011 8:01 AM by Hubert DE RAVEL RSS


      Hi. I'm having trouble understanding SetRawInputFieldVector and how it is used to match against values.

      Imagine a two-column table of with columns named KEY and VALUE, and VALUE is declared as an InputField. I then create a straight table with the dimension KEY, and expressions F(KEY) and InputSum(VALUE).

      I can run a macro that gets the values of F(KEY) and puts them into the InputSum(VALUE) column using the API method SetInputFieldValue. However this is extremely slow, so I wanted to use SetRawInputFieldVector.

      However I cannot figure out the order of the values I am putting into SetRawInputFieldVector. I have tried many combinations of the Sort tab in the straight table and Sort tab in the document properties, but I cannot figure out the ordering of the values.

      Here's a macro example of copying values from a straight table

      Set oGraph = ActiveDocument.GetSheetObject("STRAIGHT_TABLE")
      Set oCells = oGraph.GetCells(1,0,1,oGraph.GetNoOfRows())
      Set oField = ActiveDocument.Fields("MYFIELD")
      Set oValues = oField.GetNoValues
      For i = 0 To oCells.Count - 1
      oValues(i).Number = oCells.Item(i).Item(0).Number
      oValues(i).IsNumeric = True
      oField.SetRawInputFieldVector 0,oValues

      In the big picture, I need to pre-calculate columns of values, and wanted to avoid partial reloads since those are document-based whereas I want values calculated per QlikView Server client session. Our calculations are just too complex for real-time computation (they use aggr() and set analysis) despite having <1M records.

      Any suggestions from the QlikView guru community?

      - Matt

        • SetRawInputFieldVector

          Hi Matt,

          I've tried to solve your problem and the only way that it works for me is keeping the original order of the two-column table, apparently, the vector generated by SetRawInputFieldVector is ordered under the original charge order, so, you can't allow the user make interactive sort on the table or show a interactive sort table and execute the script on a hidden table.

          Check out my example, the only point I don't understan was the F(Key), what you mean with the F() function?

          I hope this works for you.

          Best regards.


            • SetRawInputFieldVector


              Thank you for that clear illustration of the SetRawInputFieldVector. My problem is that the ordering of the values seems non-deterministic in my full QlikView document, perhaps because the values are connected to other tables.

              The next step is mine, and I will try to put together my own sample QlikView document to illustrate the problem.

              As an aside, I am not sure that this solution will scale well. I did some testing of the SetInputFieldValue method for setting the InputField values in a macro, and although it worked and was slow, as soon as I got to over ten thousand values then my QlikView memory footprint grew from ~2GB to max out on my computer at 8GB. Therefore the warnings about InputFields and the affect on performance are probably all valid, and using them to store temporary calculations instead of using a partial reload will not work for us.

              My reference to F() just means any function. In actuality we have a complex aggr() function with set analysis that takes a long time to complete. I should have been more specific in my original posting.

              Thank you again for your response!

              - Matt