25 Replies Latest reply: Aug 16, 2011 6:26 PM by Patrick Anderson RSS

    Macro parse failed

      Hi,

      I'm trying to implement a dynamic cyclic group. Therefore I have created a little macro which should do the trick. Problem is that the macro is running in QlikView client without any issues but not using a browser.

      The macro code is kind of simple like this:

      Sub DynamicGroup
      ActiveDocument.GetApplication.WaitForIdle
      ActiveDocument.RemoveGroup "CyclicGroup1"
      Set gr = ActiveDocument.CreateGroup("CyclicGroup1")
      gr.AddField "Field1"
      gr.AddField "Field2"
      dim x(2)
      set gp = ActiveDocument.GetGroup("CyclicGroup1").GetProperties
      x(1) = "FIELD1"
      x(2) = "FIELD2"
      gp.Labels = x
      gp.IsCyclic = true
      ActiveDocument.GetGroup("CyclicGroup1").SetProperties gp
      ActiveDocument.GetApplication.Refresh
      End Sub

      When I run this macro in the client there is no problem but when I run it in the browser then I get the error message:

      Macro parse failed. Functionality was lost
      DynamicGroup
      Error: Object needed 'gr'

      I'm running QlikView 9 SR7.

      Can anyone help me with this?

      Regards

        • Macro parse failed
          Deepak Kurup

          hi,

          I am not sure, but i dont think you can create cyclic group in IE.

           

          I have once tried to create cyclic grp(not by macro) through chart properties but the edit group button was disabled.

           

            • AW:Re: Macro parse failed

              If it wouldn#t be possible I'm wondering why it should be possible to remove a cyclic group because the first line of the macro removes the group before it is recreated.

              And the group is definitely not usable after the macro has been executed so I guess it must be something other.

              But that is just a conclusion from my point of view. Does anyone know a possibility to get an "official" answer to this?

              Regards

                • AW:Re: Macro parse failed
                  Miguel Angel Baeyens de Arce

                  Hi,

                  Are both client and server running same version of QlikView?

                  Regards.

                    • AW:Re: Macro parse failed

                      hi im getting the same Macro Parse Failed message. I set up a post and still awaiting help.

                      http://community.qlik.com/forums/t/42978.aspx

                      Good luck.

                      • AW:Re: AW:Re: Macro parse failed

                        HI,

                        just to make sure I have just reinstalled the QlikView plugin on my machine and I'm still getting the error.

                        Any further idea?

                        Reagrds

                          • AW:Re: AW:Re: Macro parse failed
                            Miguel Angel Baeyens de Arce

                            You're right.

                            Let's see what other users say, but it seems to me a bug here to be reported to QlikTech support.

                              • AW:Re: AW:Re: AW:Re: Macro parse failed

                                 


                                Miguel Angel Baeyens wrote:
                                You're right.


                                Does this mean you can reproduce the error at your site and think that it should be possible to create a cyclic using a macro through the plugin?

                                Regards

                                 

                                 

                                  • AW:Re: AW:Re: AW:Re: Macro parse failed
                                    Miguel Angel Baeyens de Arce

                                    Hello,

                                    If the macro doesn't work, it should be triggered by pressing the button (similar to what happens when your macro saves the document, for example).

                                    But in this case (I'm using 10 SR1) the macro triggers and starts working, but it stops in this place, (because of creating fields permissions? don't think so, using section access works as expected as well).

                                    EDIT: The group is actually removed, then created, but fields are not added to that group, even using one dimension.

                                      • AW:Re: AW:Re: AW:Re: Macro parse failed

                                        Hi Miguel,

                                        Heres my macro script:

                                        ----------------------------------------------------------------------------------------------------------

                                        Sub SubmitQuestionnaire

                                        Set oXL=CreateObject("Excel.Application")

                                        'set doc = ActiveDocument
                                        'set mySelection = doc.fields("User").GetSelectedValues
                                        'for i = 0 to mySelection.Count -1
                                        'strIndex = mySelection.Item(i).text
                                        'next

                                        strIndex = ActiveDocument.Variables("Username").GetContent.String


                                        set DATA1 = ActiveDocument.GetApplication.GetProperties
                                        VarHolder1 = now()
                                        set temp = ActiveDocument.GetApplication.GetProperties
                                        VarHolder2 = mid(temp.UserName,4)
                                        set vCommentsToExcel = ActiveDocument.Variables("vUserEmail")
                                        VarHolder3 = vCommentsToExcel.GetContent.String
                                        set vCommentsToExcel = ActiveDocument.Variables("vUserPhone")
                                        VarHolder4 = vCommentsToExcel.GetContent.String
                                        set vCommentsToExcel = ActiveDocument.Variables("Quest1Answer")
                                        VarHolder5 = vCommentsToExcel.GetContent.String
                                        set vCommentsToExcel = ActiveDocument.Variables("Quest2Answer")
                                        VarHolder6 = vCommentsToExcel.GetContent.String
                                        set vCommentsToExcel = ActiveDocument.Variables("Quest3Answer")
                                        VarHolder7 = vCommentsToExcel.GetContent.String
                                        set vCommentsToExcel = ActiveDocument.Variables("vOtherFeedback")
                                        VarHolder8 = vCommentsToExcel.GetContent.String

                                        f_name = "\\Nmh-bus01\QVDataSource\QlikView Questionnaires\Question Answers.xls"
                                        set oWB = oXL.Workbooks.Open(f_name)
                                        set oSH = oWB.Worksheets.Item(1)

                                        With oWB.Worksheets.Item(1).Range("a1:a1000")
                                        Set c = .Find(strIndex, , , 2, 1, 2, 0)
                                        If Not c Is Nothing Then
                                        firstAddress = c.Address
                                        Do
                                        VarHolder = VarHolder + 1
                                        Set c = .FindNext(c)
                                        Loop While Not c Is Nothing And c.Address <> firstAddress
                                        End If
                                        End With

                                        if VarHolder = 100 then
                                        msgbox("It appears you have already submitted a questionnaire. To resubmit please delete old questionnaire?")
                                        oWB.Close

                                        set oSH = Nothing
                                        set oWB = nothing
                                        set oXL = nothing

                                        'CLEAR SELECTIONS IF QUESTIONNAIRE ALREADY SUBMITTED
                                        set v = ActiveDocument.Variables("vUserEmail")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("vUserPhone")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("Quest1Answer")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("Quest2Answer")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("Quest3Answer")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("vOtherFeedback")
                                        v.SetContent "",true
                                        exit sub
                                        else

                                        'PASTE THE VALUES INTO EXCEL SHEET SPECIFIED
                                        'username index
                                        oSH.Range("A65536").End(-4162).Offset(1,0).FormulaR1C1 = strIndex
                                        'date submitted
                                        oSH.Range("A65536").End(-4162).Offset(0,1).FormulaR1C1 = VarHolder1
                                        'user login
                                        oSH.Range("A65536").End(-4162).Offset(0,2).FormulaR1C1 = VarHolder2
                                        'optional user contact details
                                        oSH.Range("A65536").End(-4162).Offset(0,3).FormulaR1C1 = VarHolder3
                                        oSH.Range("A65536").End(-4162).Offset(0,4).FormulaR1C1 = VarHolder4
                                        'question answers 1-3
                                        oSH.Range("A65536").End(-4162).Offset(0,5).FormulaR1C1 = VarHolder5
                                        oSH.Range("A65536").End(-4162).Offset(0,6).FormulaR1C1 = VarHolder6
                                        oSH.Range("A65536").End(-4162).Offset(0,7).FormulaR1C1 = VarHolder7
                                        'additional feedback
                                        oSH.Range("A65536").End(-4162).Offset(0,8).FormulaR1C1 = VarHolder8

                                        If f_name="False" then

                                        Set oXL=nothing
                                        Exit sub
                                        End If

                                        oWB.Save
                                        oWB.Close

                                        Set oSH=nothing
                                        Set oWB=nothing
                                        Set oXL=nothing

                                        'CLEAR SELECTIONS AFTER SUBMISSION
                                        set v = ActiveDocument.Variables("vUserEmail")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("vUserPhone")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("Quest1Answer")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("Quest2Answer")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("Quest3Answer")
                                        v.SetContent "",true
                                        set v = ActiveDocument.Variables("vOtherFeedback")
                                        v.SetContent "",true

                                        msgbox("Thank you for completing the 'March 2011 - QlikView Questionnaire. Your answers will be reflected in the next report refresh.")
                                        'ActiveDocument.Reload
                                        ActiveDocument.ClearAll
                                        'ActiveDocument.CloseDoc
                                        'App.OpenDoc "http://nmh-vapps03/QvAJAXZfc/AccessPoint.aspx?open=&id=QVS@nmh-vapps03%7CCorporate/User%20Guidance/Orientation%20page.qvw&client=Plugin"

                                        end if
                                        End Sub

                                        -------------------------------------------------------------------------------

                                        As you can see there are many 'set' attributes in the script if i remove these it wont work.

                                        Is this a QlikView 9 bug?

                                        • AW:Re: AW:Re: AW:Re: AW:Re: Macro parse failed

                                           


                                          Miguel Angel Baeyens wrote:
                                          EDIT: The group is actually removed, then created, but fields are not added to that group, even using one dimension. <div></div>


                                          I found the same but I have just made another finding. The macro is not even working when the QlikView document is opened with the full client but not opened directly instead using the function "open on server".

                                          Is it possible that this kind of macro is not meant to be working when opening the document as a "normal" user on the server?

                                          And if yes is there another possibility to create dynamic cyclic without using macros?

                                          Regards

                            • Macro parse failed

                              Do you have section access? in my case i noticed that macros return that error when I use user login. As admin it works fine.

                              Anyone knows any option which must be "unticked" ? :)

                              • Macro parse failed

                                Hi AndreBer,

                                 

                                I am having a problem which is very similar to your post question.

                                 

                                In your Macro code instead of entering the fields by manually, i need to get the fields which are selected in listbox that fields should be save into group.

                                 

                                See below your code in that place i need to have currently selected fields as group.

                                 

                                gr.AddField "Field1"

                                gr.AddField "Field2"

                                dim x(2)

                                set gp = ActiveDocument.GetGroup("CyclicGroup1").GetProperties

                                x(1) = "FIELD1"

                                x(2) = "FIELD2"

                                gp.Labels = x

                                gp.IsCyclic = true

                                 

                                Pls send me with attachement how it can be worked.

                                 

                                Thnks in advance

                                • Re: Macro parse failed

                                  Hi AndreBer,

                                   

                                  I am having a problem which is very similar to your post question.

                                   

                                  In your Macro code instead of entering the fields by manually, i need to get the fields which are selected in listbox that fields should be save into group.

                                   

                                  See below your code in that place i need to have currently selected fields as group.

                                   

                                  gr.AddField "Field1"

                                  gr.AddField "Field2"

                                  dim x(2)

                                  set gp = ActiveDocument.GetGroup("CyclicGroup1").GetProperties

                                  x(1) = "FIELD1"

                                  x(2) = "FIELD2"

                                  gp.Labels = x

                                  gp.IsCyclic = true

                                   

                                  Pls send me with attachement how it can be worked.

                                   

                                  Thnks in advance

                                    • Macro parse failed
                                      Patrick Anderson

                                      ANY NEWS ON THIS? WHAT IS THE SOLUTION??

                                       

                                      I have a Qlikview that works fine if I open it from the on the server itself, but if i go in through the client I get "Allocated Memory Exceeded" Error. and the server disconnects.

                                       

                                      I have deleted all the macros that used to run on this QVW, but still ahve the error.

                                       

                                      ANy suggestions?