Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
m_woolf
Master II
Master II

Select a field in a cyclic group

I want to select a field in a cycic group in code.

I found this code in an existing discussion:

sub set_group_field

      set gp = ActiveDocument.GetGroup("TimeGroup")

      do while gp.GetActiveField.Name <> "By Month"

      gp.Cycle 1

      loop

end sub

When I run the code it errors on the do while line with

Object required: 'gp.GetActiveField'

Any ideas?

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

That may happen if your dimension in the group is actually a calculated dimension.

You can change your code to:

do while activedocument.evaluate("=GetCurrentField([GroupName])") <> "FIELDNAME"

but instead of a simple string you can get the whole expression. Then, you can use

msgbox ( activedocument.evaluate("=GetCurrentField([GroupName])")) , in the first time to check what is going on.

Regards,

Erich

View solution in original post

2 Replies
erichshiino
Partner - Master
Partner - Master

That may happen if your dimension in the group is actually a calculated dimension.

You can change your code to:

do while activedocument.evaluate("=GetCurrentField([GroupName])") <> "FIELDNAME"

but instead of a simple string you can get the whole expression. Then, you can use

msgbox ( activedocument.evaluate("=GetCurrentField([GroupName])")) , in the first time to check what is going on.

Regards,

Erich

danielrozental
Master II
Master II

Your code works fine for me, check that the group name is correct, specially the case letters.