Sage 100

 View Only
  • 1.  Scripting issue on Standard vs Advanced.

    Posted 05-20-2022 15:00
    Edited by Jim Woodhead 05-20-2022 15:01

    We are attempting to run a Report from a script.  

    It works fine on a standard system but not on  an advanced one.  what are we missing?

    Here is a snippet of the code:

        taskID = oSS.nLookupTask("GL_TrialBalance_UI")
        retVal = oSS.nSetProgram(taskID)

    Set oGLTB = oScript.NewObject("GL_TrialBalance_rpt", oSS)

        retval=oGLTB.nSelectReportSetting(CurrentRptSetting)

        strOptions = "SORTREPORTBY$=""A"";DB_TYPEOFBALANCE$=""A"";DB_FISCALYEAR$=" & Chr(34) & FY(i)& Chr(34) &";DB_STARTPERIOD$=" & Chr(34) & Period(i)&" "&FDoM(i)& Chr(34) &";DB_ACCOUNTINGPERIOD$="& Chr(34) & Period(i)&" "&FDoM(i)& Chr(34) &";DB_ENDPERIOD$="& Chr(34) & Period(i)&" "&LDoM(i)& Chr(34) & ";CB_ZEROBALANCE$=""Y"";CB_CONDENSEDPRINT$=""N"""
        retVal=oGLTB.nSetOptions(strOptions)
    'Then generated strOptions string is:
    'SORTREPORTBY$="A";DB_TYPEOFBALANCE$="A";DB_FISCALYEAR$="2022";DB_STARTPERIOD$="05 2/1/2022";DB_ACCOUNTINGPERIOD$="05 2/28/2022";DB_ENDPERIOD$="05 2/28/2022";CB_ZEROBALANCE$="N";CB_CONDENSEDPRINT$="N"
    'Note that this company's 2022 FY starts 10/1/2021

        oGLTB.nReportType = 6

        retval = oGLTB.nInitReportEngine()

    '  Ouput Format Values/Types
    '  2 Rich Text
    '  3 Microsoft Word
    '  4 Microsoft Excel
    '  5 PDF
    '  9 Text
    '  10 CSV
    '  11 Tab Separated
        nOutPutFormat = 10
        sOutPutPath =  strVenaExportPath & CurrentCmp(z) & "\TBVenaExport" & FY(i) & Period(i) & ".CSV"


    'THIS IS THE LINE THAT THROWS THE ERROR BELOW
        retval = oGLTB.nSetExportOptions(nOutputformat, sOutputPath)

    '   Error #65: Window element does not exist or already exists
    '   Problem with oGLTB.nSetExportOptions
    '   oGLTB.nSetExportOptions: OutPutFormat=10, OutPutPath = D:\Sage\TBVenaExport\CBS\TBVenaExport202205.CSV




    'Process Report Options
    'EXPORT OPTIONS "EXPORT", "EXPORTDATA", "EXPORTWEB","EXPORTJAVXPDF","EXPORTMOBILEPDF"
    'PRINT OPTIONS "PRINT", "PREVIEW", "DEFERRED"
        retVal = oGLTB.nProcessReport("EXPORTDATA")


    any suggestions?



    ------------------------------
    Jim Woodhead
    DSD Business Systems
    619-990-3946
    ------------------------------



  • 2.  RE: Scripting issue on Standard vs Advanced.

    Posted 05-20-2022 17:09
    Edited by Alnoor Cassim 05-21-2022 17:32
    Are you trying to run a BOI script within the Launcher (like a button script on a screen) or outside the Launcher? If within, in the scripting class sample Script 43 quick prints a SO from PO Entry. You can adapt it for that and additional stuff your script needs. Note I recently suggested a few changes to that in my reply to Bob Osborn about that script.

    Also BOI always run as Standard, that is "Mas90 Mode". There is no "Advanced Mode" so it shouldn't matter but conflicts can occur if your BOI script uses an object variable reserved for Launcher scripts, like oScript, oSession, oBusObj, etc. That's why in BOI different user defined vars are used like oSS instead of oSession, and oBOIScript instead of oScript.

    It appears somewhere earlier in the script you must have:
    Set oScript = CreateObject("ProvideX.Script") 
    Change oScript to either oBOIScript or oPvxScript, then change every oScript reference as well.

    Also, make sure you can directly go into GL / Reports/ Trial Balance and can successfully export it the same way with the same report setting and same report options. IOW, if you get an issue/error there fix that then go back to the script. 

    Also, all BOI scripts "execute on client" so make sure the export path is correct relative to where the script is being executed from.
    E.g. if script runs from a workstation then I doubt that D:\Sage\.. path is valid.
    Hope that helps.

    ------------------------------
    Alnoor Cassim

    Email: alnoor@asifocus.com
    Ph:
    ------------------------------



  • 3.  RE: Scripting issue on Standard vs Advanced.

    Posted 05-24-2022 02:56

    This turned out to be an issue with v2018. Here is the fix for the problem I found on Sage City.

    This is an issue with Crystal and COM (BOI) for the Sage 100 2018 Release. To correct this, copy the pvxwin32.exe.config from the Sage 100 2018 installs ..\mas90\home folder to the C:\Program Files (x86)\Common Files\Sage\CommonComponents folder and then RENAME the file to pvxcom.exe.config.

    Thank you,

    Kent Mackall



    ------------------------------
    Jim Woodhead
    DSD Business Systems
    619-990-3946
    ------------------------------