Scripting

  • 1.  Has anyone figured out a way to run custom Crystal

    Posted 12-07-2016 08:02
    Has anyone figured out a way to run custom Crystal reports from Custom office buttons and pass parameters (that part is critical) in version 2013 and higher? Or does it need to be wrapped in a dotNet program called from a VBscript?


  • 2.  RE: Has anyone figured out a way to run custom Crystal

    Posted 12-07-2016 08:04
    wrapped in a dotNET program called by a VBscript"" - is that like a Turduckin ?


  • 3.  RE: Has anyone figured out a way to run custom Crystal

    Posted 12-07-2016 08:05
    More like a ""Sagefucus""...


  • 4.  RE: Has anyone figured out a way to run custom Crystal

    Posted 12-07-2016 08:14
      |   view attached
    If you can somehow involve PowerShell, I guess that would make it a Turbaconducken!


  • 5.  RE: Has anyone figured out a way to run custom Crystal

    Posted 12-07-2016 08:16
    ' Open up crystal report without selection criteria ' The second parameter is of the form: ' ""SY_ReportManagerGeneratedListing_rpt,{Report Name},{Report Title}"" retVal = oSession.InvokeProgram(""SY_LISTING_UI"", ""SY_ReportManagerGeneratedListing_rpt,SO_Sales_Order_CUSTOM.rpt,Sales Order"") ' Call to new up the SY_ReportEngine object SET oReportEngine = oSession.AsObject(oSession.NewObject(""SY_ReportEngine"")) ' Open the report at the location in which it is stored reportName = ""SO_XXXXXXX_CUSTOM.rpt"" retVal = oReportEngine.OpenReport(oSession.PathRoot + ""REPORTS\"" + reportName) ' Grab the SalesOrderNo SalesOrderNo="""" retVal = oBusObj.GetValue(""SalesOrderNo"", SalesOrderNo) SONo = ""'"" + SalesOrderNo + ""'"" ' Set a formula with it retVal = oReportEngine.SetFormula(""fSalesOrderNo"", SONo) ' Or use the selection criteria (similar to a WHERE clause) retVal = oReportEngine.SetSelectionFormula(""{SO_SalesOrderHeader.SalesOrderNo} = "" + SONo) ' Preview your report retVal = oReportEngine.Preview()


  • 6.  RE: Has anyone figured out a way to run custom Crystal

    Posted 12-07-2016 11:54
    @BrettPensinger - thanks! A question - is this in a vbscript? I am getting an error on SET oReportEngine = oSession.AsObject(oSession.NewObject(""SY_ReportEngine"")) of Object Required 'oSession'


  • 7.  RE: Has anyone figured out a way to run custom Crystal

    Posted 12-07-2016 12:01
    This is VBscript you can include on a Sage custom office button. Did you save the reports in the Reports dir, and change the reportName var?


  • 8.  RE: Has anyone figured out a way to run custom Crystal

    Posted 12-07-2016 12:13
    I think I made the appropriate changes: NumberOfCopies = inputbox (""Enter the number of labels to print"",""Number of Copies"",""1"") retVal = oSession.InvokeProgram(""SY_LISTING_UI"", ""SY_ReportManagerGeneratedListing_rpt,SO_ShipLabel_CUSTOM.rpt,Shipping Label"") ' Call to new up the SY_ReportEngine object SET oReportEngine = oSession.AsObject(oSession.NewObject(""SY_ReportEngine"")) ' Open the report at the location in which it is stored reportName = ""SO_ShipLabel_CUSTOM.rpt"" retVal = oReportEngine.OpenReport(oSession.PathRoot + ""REPORTS\"" + reportName) ' Grab the Invoice InvoiceNo="""" retVal = oBusObj.GetValue(""InvoiceNo"", InvoiceNo) InvoiceNo = ""'"" + InvoiceNo + ""'"" ' Set a formula with it 'retVal = oReportEngine.SetFormula(""fInvoiceNo"", InvoiceNo) ' Or use the selection criteria (similar to a WHERE clause) retVal = oReportEngine.SetSelectionFormula(""{SO_InvoiceHeader.InvoiceNo} = "" + InvoiceNo) ' Preview your report retVal = oReportEngine.Preview() 'or print times number of copies 'retVal = oReportEngine.Print(NumberOfCopies) 'will this work for multiple copies??