Scripting

  • 1.  I was wondering if anyone knows how to use the SY_

    Posted 05-04-2012 14:46
    I was wondering if anyone knows how to use the SY_Reinitialize business object specifically with the ""ReinitializeFile"" function. The ""VerifyFile"" function returns a 1 on the file I've chosen, but passing that same filename to the ""ReinitializeFile"" function comes back with the message ""Unable to open one or more files"".


  • 2.  RE: I was wondering if anyone knows how to use the SY_

    Posted 05-04-2012 23:16
    1st you have to run GetCompanyKey() function then InitReinitializeFiles() as these setup up some internal VARs that ReinitializeFile() needs. Here's a ProvideX example I whipped up for reinit'ing AP_InvoiceHeader from SYZCON. I presume you're using BOI or Customizer script. You can adapt for BOI (maybe you know how to do already) by changing syntax and a few things. Substitute NEW line with NewObject equivalent, the ' symbol with a . the %SYS_SS with oSS version. Also set all the preliminary stuff (nSetUser, nSetCompany, oSS, blah blah) ! ------------------------------------------------------ DROP OBJECT o,ERR=*NEXT tmpModCode$=""AP"",tmpEverest$=""Y"",myFile$=""AP_INVOICEHEADER"" o=NEW(""SY_Reinitialize_bus"",%SYS_SS) retVal=o'GetCompanyKey(%SYS_SS'CompanyCode$, tmpCompanyKey$, tmpCompanyObj) retInit=o'InitReinitializeFiles(tmpModCode$,tmpEverest$) retReinit=o'ReinitializeFile(myFile$) ! ------------------------------------------------------


  • 3.  RE: I was wondering if anyone knows how to use the SY_

    Posted 05-07-2012 08:55
    Great -- translated this to a VBS and it worked!


  • 4.  RE: I was wondering if anyone knows how to use the SY_

    Posted 05-07-2012 09:03
    Can you post the VBS script? ( for future reference.) THX


  • 5.  RE: I was wondering if anyone knows how to use the SY_

    Posted 05-07-2012 09:07
    This is the VBS of Alnoor's equivalent (doesn't have the preliminary stuff like his for comparison purposes): fn = ""AR_PriceLevelByCustPriceCode"" retVal = oSS.nSetProgram(oSS.nLookupTask(""SY_Reinitialize_ui"")) Set oSys = oScript.NewObject(""SY_Reinitialize_bus"", oSS) retVal = oSys.nGetCompanyKey(""ABC"", compKey, oComp) retVal = oSys.nInitReinitializeFiles(""AR"",""Y"") retVal = oSys.nReinitializeFile(fn)