1 Reply Latest reply: May 15, 2014 10:10 AM by RalphB _ RSS

    Selecting filters

    D V V Ranga Raju

      Hi All,

      I have created a script to extract the data from files automatically(selecting the file and applying model to it).Above is working fine if the model has no Filters,but problem is "when the model contains different filters ,I am unable to select the filters using the script".Can any one please suggest me how can I select the filters and apply the model using script.

      Below is the script that I have created.

       

       

      Function EndOfMonth(dt)

      Dim dtTemp

       

      ' Change the passing date to the beginning of the month.

      dtTemp = CDate(Month(dt) & "/1/" & Year(dt))

       

      ' Add a month to the temp date and subtract one day

      EndOfMonth = DateAdd("d", -1, DateAdd("m", 1, dtTemp))

      End Function

       

       

       

      a(0)="156"

      a(1)="157"

      a(2)="161"

      a(3)="162"

      a(4)="191"

      a(5)="192"

      a(6)="193"

      a(7)="342"

      a(8)="534"

      a(9)="725"

      a(10)="733"

      a(11)="343"

      a(12)="524"

       

      For i=0 to 12

       

      Set MonarchObj = CreateObject("Monarch32")

       

      If MonarchObj.IsActive > 0 then

      End If

       

      y = EndOfMonth(Date() - 30)

       

      input_file="
      acsap-gm-chs2\Public\Monarch\datafiles\clients\gp\AP\2010\J an2011\bpf\"&a(i)&" ME Aging - External.pdf"

       

      openfile = MonarchObj.SetReportFile(input_file,False)

       

      If openfile = True Then

       

      z=MonarchObj.SetRuntimeParameter("Date",y)

      openmod = MonarchObj.SetModelFile("
      acsap-gm-chs2\Public\Monarch\models\Models\Blacline Bpfrieght\GP_Jai_final_ME Aging_blackline.xmod")

       

      If openmod = True Then

      MonarchObj.SetRuntimeParameter Date,y

      Output_file="
      acsap-gm-chs2\Public\Monarch\datafiles\clients\gp\AP\2010\J an2011\bpf\XXX ME Aging - External.csv"

      monarchobj.setTextAppend(1)

      MonarchObj.ExportTable (Output_file)

      End If

      End If

       

      MonarchObj.CloseAllDocuments

      MonarchObj.Exit

       

      Next

       

       

      Thanks ,

      Raju

        • Selecting filters
          RalphB _

          Hi Raju and welcome to the forum.

           

          It's been a while since I used Monarch V8 but this should work whether you are using the standard or the Pro.

           

          Try

           

          MonarchObj.CurrentFilter= "YourFilter"

           

          I use that extensively in several scripts I have set up and have no problems.

           

          Give that a try and let us know how it worked.

           

          Ralph