Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
Not applicable

Macro or default selection

Hi all,

When we apply macro to select say say two products A and B.

In the current selection it comes as (A|B). but i want it as A,B just like normal selection .

Also if i have a value like age . I apply macro for  selection in age as (""2 years""|""4 years"")

It comes in current selections as ("2 years"|"4 years"). Is there a way to replace this bar in macro script by , and ger rid of these brackets, inverted comas etc?

Thanks

Khushboo

1 Solution

Accepted Solutions
MVP
MVP

Re: Macro or default selection

If you do a more elaborate VBScript coding you can get your comma:

Sub SelectMyValues

  Set f = ActiveDocument.Fields("Year")

  Set fv = f.GetNoValues  'empty array

  fv.Add

  fv.Add

  fv(0).Number = 2015

  fv(0).IsNumeric = true

  fv(1).Number = 2010

  fv(1).IsNumeric = true

  If Not( f.SelectValues(fv) ) Then

  ' do some error handling

  End If

End Sub

View solution in original post

5 Replies
MVP
MVP

Re: Macro or default selection

If you do a more elaborate VBScript coding you can get your comma:

Sub SelectMyValues

  Set f = ActiveDocument.Fields("Year")

  Set fv = f.GetNoValues  'empty array

  fv.Add

  fv.Add

  fv(0).Number = 2015

  fv(0).IsNumeric = true

  fv(1).Number = 2010

  fv(1).IsNumeric = true

  If Not( f.SelectValues(fv) ) Then

  ' do some error handling

  End If

End Sub

View solution in original post

Not applicable

Re: Macro or default selection

if i have to test for string rather than numberic values?

Can you modify macro for string ?

MVP
MVP

Re: Macro or default selection

You change

fv(0).Number = 2015 into fv(0).Text = "2015"

and

fv(0).IsNumeric = false

Not applicable

Re: Macro or default selection

Thanks Petter 🙂

Not applicable

Re: Macro or default selection

Petter,

If we have more than 2 values to select .

fv(2).Number = 2011

fv(3).Number = 2012



Like this?