Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
manoj23_86
Partner - Contributor II
Partner - Contributor II

Macro to set and chart expression 'Searchable'

Hello,

I have a straight table chart which gets created dynamically. Now I need to turn on 'Searchable' property for these expressions.

Please guide me to get this done.

Here is the code where I am creating this straight table:

Sub CreateDataTableChart

  on error resume next

  SET objOldChart= ActiveDocument.GetSheetObject("DATATAB")

  objOldChart.Close

  SET objChart = ActiveDocument.Sheets("Data").CreateStraightTable

  strFields = ActiveDocument.GetVariable("vFields").GetContent.String

  'arrFields = Split(strFields, ActiveDocument.GetVariable("vDelimit").GetContent.String)

  'Field in Fields variable are always comma separeted

  arrFields = Split(strFields, ",")

  objChart.AddDimension "RECNO"

  For i = 0 to UBound(arrFields)

  strColumnName = "["&arrFields(i)&"]"

  objChart.AddExpression strColumnName

  Next

  objChartProp = objChart.GetProperties

  SET objExpr = objChartProp.Expressions

  objChartProp.GraphLayout.Frame.ObjectID = "DATATAB"

  objChartProp.GraphLayout.WindowTitle.v= "Data Table"

' Uncomment below if you want to give different lable for RECNO

' objChartProp.Dimensions(0).Title.v="Record#"

  For i = 0 to UBound(arrFields)

  objExpr.Item(i).Item(0).Data.ExpressionVisual.Label.v=arrFields(i)

  objExpr.Item(i).Item(0).Data.ExpressionData.UsePartialSum  = false 'No Totals

  'Searchable --------------------------??????????

  Next

  objChartPos=objChart.GetRect

  objChartPos.Top = 10

  objChartPos.Left =400

  objChart.SetProperties objChartProp

  objChart.SetRect objChartPos

  objChart.SetPixWidths 0,w

  objChart.EqualPixWidths 1

End Sub

Thanks,

Manoj

1 Solution

Accepted Solutions
marcus_sommer

Try it with:

objExpr.Item(i).Item(0).Data.ExpressionVisual.Searchable = true

- Marcus

View solution in original post

3 Replies
manoj23_86
Partner - Contributor II
Partner - Contributor II
Author

'Searchable' is property of ExpressionVisual. It is working now.

objExpr.Item(i).Item(0).Data.ExpressionVisual.Searchable=true

Thanks,

Manoj

marcus_sommer

Try it with:

objExpr.Item(i).Item(0).Data.ExpressionVisual.Searchable = true

- Marcus

manoj23_86
Partner - Contributor II
Partner - Contributor II
Author

Yes that worked  ... Thankyou