Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jayaramp
Contributor II
Contributor II

Step through Field Values without using arrays in VBScript

Hi there,

Below is the code we could get in API Guide, in order to loop through values in a field "Month".

Sub MonthValues

set ArrayVal=ActiveDocument.Fields("Month").GetPossibleValues

for i=0 to ArrayVal.Count-1

    msgbox(ArrayVal.Item(i).Text)

next

End Sub

I would like to know if there is another way to get similar functionality, without using arrays in the code.

Above code works like a charm in Subroutines, but doesn't in User Defined Function (UDF); if the UDF is used in the Script. In my case I need to use the UDF in Load Script.

Thanks for you help in advance,

JP

3 Replies
Gysbert_Wassenaar

for i =1 to fieldvaluecount('Month')

     //do stuff

next


talk is cheap, supply exceeds demand
jayaramp
Contributor II
Contributor II
Author

That's understood, could you help with code in msgbox please.

And, this is in VBScript or Macros of QlikView, not in Script.

Gysbert_Wassenaar

Above code works like a charm in Subroutines, but doesn't in User Defined Function (UDF); if the UDF is used in the Script. In my case I need to use the UDF in Load Script

And, this is in VBScript or Macros of QlikView, not in Script.

Can you please make up your mind about what you want?

In the UI use vbscript with arrays. In the script use a for loop with fieldvaluecount. Check the help file for how to use the MsgBox function in the script.


talk is cheap, supply exceeds demand