Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
erich_shiino
Honored Contributor

Re: GetFieldSelections in Module?

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

4 Replies
Not applicable

Re: GetFieldSelections in Module?

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

erich_shiino
Honored Contributor

Re: GetFieldSelections in Module?

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

Re: GetFieldSelections in Module?

this one works fine

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

Not applicable

Re: GetFieldSelections in Module?

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.