3 Replies Latest reply: Aug 10, 2010 7:22 PM by pavani86 RSS

    Button actions from QV 8.5 to QV9

    shanikia

      Hi all,

      We had a request to create a menu for the charts in a document that would have the feel of hyperlinks. In QlikView 8.5 we used a macro that checked the number of charts vs number of buttons and if different re-created the buttons on the "Menu" sheet. How can I do this in QV9 using Actions?

      Here is the QV 8.5 macro:

      Sub CreateButtons
      'delete all buttons on AnalysisCharts sheet
      set s=ActiveDocument.Sheets("AnalysisCharts")
      buttons=s.GetButtons
      for i=lbound(buttons) to ubound(buttons)
      if right(buttons(i).GetObjectID,3) > 300 then buttons(i).Close
      next

      'create button for each entry in charts tablebox for ChartButtons table
      set ButtonTable = ActiveDocument.GetSheetObject( "TB06" )
      btncntr = ButtonTable.GetRowCount - 1

      rem create new shortcut button - clear except locked
      lastposTop = 300
      lastposLeft = 1100
      for btncntr = 1 to ButtonTable.GetRowCount - 1
      set newbutton = s.CreateButton
      set prop = newbutton.GetProperties
      'set button text = cntr & chart name
      prop.Text.v = btncntr & ". " & ButtonTable.GetCell(btncntr,2).text
      prop.Type = 2
      prop.BtnStyle = 0
      prop.Macro = "ShowChart"
      prop.BkgAlpha = 0
      prop.TextColor.PrimaryCol.Col = RGB(64,128,128)
      set fr = prop.Frame
      fr.ObjectId = ButtonTable.GetCell(btncntr,0).text
      fr.Font.Bold = true
      fr.Font.AntiAlias = 1
      set pos = fr.Rect
      pos.Height = 35
      pos.Width = 225
      pos.Top = lastposTop + 100
      pos.Left = lastposLeft
      if pos.Top = 1300 then
      lastposTop = 300
      lastposLeft = pos.Left + 1100
      else
      lastposTop = pos.Top
      end if
      newbutton.SetProperties prop
      next
      End Sub

      The above bold lines show lines with obsolete properties.

      Thanks!
      Shanikia

        • Button actions from QV 8.5 to QV9
          shanikia

          Well I decided to get around this by manually creating one button and using the CreateObjectFromXMLPropertiesFile to create the rest.

          I know everyone is against macros, so if there are any suggestions ]for a menu of charts that can be dynamically maintained, please let me know!

          Shanikia.

            • Button actions from QV 8.5 to QV9
              John Witherspoon

              I just create a field, like "Chart". I give it values of all the titles of my charts. Each chart has a condition for display, like Chart='Revenue Trend'. If you create a list box for the Chart field, that is at least fairly close to the feel of hyperlinks, even if the coloration isn't the same.

              Moving away from the feel of hyperlinks, you could put a single-field multi-box up where the title should be, so that it serves both as the title of the chart and as a drop down for selecting the chart to display. More room on the screen for the charts themselves, slightly harder to select a specific chart since it takes two clicks instead of one.

              A similar option would be to create a new field for each chart, put the fields in a cyclic group at the top of the page as the title, and use display conditions like getcurrentfield(Chart)='Revenue Trend'. That gives you the ability to go to the next chart with a single click if that's desirable.

              We've done a pretty good job of getting our users to accept the way that QlikView does things. They don't insist on duplicating things they're more familiar with, like hyperlinks (unless I'm hyperlinking to an external document of some sort). I understand that not everyone is so lucky in regards to their users, and may be forced to make QlikView look and feel like some other product. But if possible, I think you'll save yourself trouble in the long run by making QlikView simply look and feel like QlikView instead of a web browser, Excel, Power Point, or whatever your users are used to.

              I suppose my suggestion falls flat in that it is NOT dynamically maintained from the existing charts, and instead requires a manual data entry and a reload to link to a new chart. I haven't found that much of a problem in practice, but perhaps it would be in your case.