Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Has anyone seen any issues with obj.getrowcount when writing VBScript in QV v9? I have some code used to loop through the values in a straight table chart object and I have just sat here running the exact same code on the exact same data set and got two different values.
Isn't completely inconsistent, but sometimes it returns the correct value, sometimes it only returns the first row of the data...
Thanks.
Hi,
I happen to know that at least in table boxes GetRowCount also counts a header row if it is not suppressed; whereas if the column is an inputfield the header row is NOT being counted - see this post: http://community.qlik.com/forums/p/18580/75092.aspx#75092
I also encountered problems with GetRowCount in connection with DynamicDataUpdate and dependent on if I use a MsgBox or not (e. g. with MsgBox correct number 5 vs without MsgBox NOT correct number 2). I have a support case running concerning the latter.
Perhaps that helps you also with your straight table. If you like you can post your example here and I'll have a look at it.
Rgds,
Joachim
Very, very interesting indeed. I have also spotted some issues with GetRowCount in a MsgBox (sometimes correct number of 32 vs sometimes just says 2). Perhaps the same bug is not just MsgBox specific but also affects for loops (which is where I have also debugged and seen this happen).
Is there a way I can keep track of the support case for this?
FYI the file I have is a qvw file originally created in v8.5 but now opened with the VBScript running in v9. When I take the same file and run the code in v8.5 it seems to return the correct value every single time..
All the best,
Matt
Hi Matt,
my examples for the support were all created in QV 9.
Unfortunately ther isn't yet a bug tracking system, but I saved this thread as a favorite so I don't forget to report you as soon as I have an information from support.
Rgds,
Joachim
Many thanks Joachim, if you could update the thread that would be very much appreciated.
i've noticed problems with the getrowcount method, along with several other methods for getting sheet objects' content
the problem is that in version 9, a lot of those methods fail or return incoherent values when used with objects which are not in the currently active sheet
the solution is a real pain : in order to get a straight table content, you have to 1) save the name of the active sheet, 2) activate the sheet containing the table, 3) call the methods, 4) activate the previously active sheet
needless to say, if you have macros triggered by the activate/leave event of some sheet, it will get even more painful
good luck....
I have also seen this behaviour with regard to methods not working unless the object is on the currently active sheet (in the examples I have seen so far they just simply fail to find the object and generate an error at runtime as opposed to returning junk values).
This looks like something different though as, already knowing there was an issue with macros and the active sheet, I make sure that:
1 - all the objects I need for a given sub are on the same sheet
2 - that the sheet is active before I call the macro
Even strictly following this setup I still get random values returned by getrowcount. Qlikview really need to fix this!
a possible workaround is to use the GetTableAsText method to get a string, split it on each carriage return, and loop on the number of lines you get instead of trusting the getrowcount return value
Good idea, thanks
Hi,
I got an answer from support now. In enclosed demo the macro only works if there is a "ActiveDocument.GetApplication.WaitForIdle" after the "for" statement (commented in the module). I don't see why this is necessary because according to API-Guide the WaitForIdle "Holds macro execution until all layout entities have been updated" and I don't see what has to be updated in this line, but I asked the support again to explain what the mysterious WaitForIdle statement is doing there.
Rgds,
Joachim