Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

GetFieldSelections in Module?

Hiya Guys,

Is it possible to use the function GetFieldSelections within a module?

I have tried this as a test, but it does not work (the Module window opens when triggered, but showing no error):

'*** Update Chart Forecasts depending on current Selection ***'
Sub UpdateForecasts()

     Set varSelectionMonth = GetFieldSelections(DateCourse_MonthNumber,",",12)

     MsgBox varSelectionMonth

End Sub

Does anyone have any ideas?!

Cheers,

Steve.

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

Hi,

At the module, the method .evaluate is very useful.

You can use any expression that you would use at the interface as an argument.

In your case, you can try:

Set varSelectionMonth =ActiveDocument.Evaluate( "GetFieldSelections(DateCourse_MonthNumber,",",12)" )

     MsgBox varSelectionMonth

or

Msgbox (ActiveDocument.Evaluate("GetFieldSelections(DateCourse_MonthNumber,",",12)" )

Hope it helps,

Erich

View solution in original post

4 Replies
Not applicable
Author

try to make a textbox (paste a getselected funciont to it) and then go to module take the value from textbox

erichshiino
Partner - Master
Partner - Master

Hi,

At the module, the method .evaluate is very useful.

You can use any expression that you would use at the interface as an argument.

In your case, you can try:

Set varSelectionMonth =ActiveDocument.Evaluate( "GetFieldSelections(DateCourse_MonthNumber,",",12)" )

     MsgBox varSelectionMonth

or

Msgbox (ActiveDocument.Evaluate("GetFieldSelections(DateCourse_MonthNumber,",",12)" )

Hope it helps,

Erich

Not applicable
Author

this one works fine

Msgbox (ActiveDocument.Evaluate("GetFieldSelections(X)" ))

Not applicable
Author

Thanks Guys!

The ".Evaluate" function is exactly what I was after!

Strangely enough, it was the "Set" keyword which was causing the Module window to open when calling the subroutine.  Without it, this code worked fine:

     varSelectionMonth = ActiveDocument.Evaluate("GetFieldSelections(DateCourse_MonthNumber,',',12)")

     MsgBox (varSelectionMonth)

I'm not entirely sure when/why to use "Set" - QlikView has so many different (illogical!) ways to do things it's appalling!!!

Cheers,

Steve.