Sage 100

 View Only
Expand all | Collapse all

Rename File Perform Logic

  • 1.  Rename File Perform Logic

    Posted 12-18-2023 12:27

    I found this Perform Logic statement on Sage City to rename file on completion. This will rename the source file name once an import is complete. How ever I cannot get this to work. I'm working with Sage 2023 Premium. I'm obviously missing a step.

    • Copied the text and place in VI folder.
    • Named the file RenameFile.PL

    In the VI job

    • Perform Type: On Completion
    • File Type: Standard (only option)
    • Command: ..VI\RenameFile.PL

    Any suggestions?

    Sage remove preview
    VI Perform Logic to rename file on completion
    I have a .vbs script to rename a file that I would like to run on completion of a VI job. The script runs fine outside of Sage. Following the other threads here
    View this on Sage >

     



    ------------------------------
    Tina Meacham
    RKL eSolutions, LLC
    ------------------------------


  • 2.  RE: Rename File Perform Logic

    Posted 12-18-2023 12:32
    Edited by Kevin Moyes 12-18-2023 12:33

    You are missing a backslash in your command.

    ..\VI\RenameFile.PL

    Edit:

    You can also put the PL file in the CM\script folder, and it should be automatically copied during upgrade migrations.  (Located in the VI folder means you have to copy it manually during upgrades).



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 3.  RE: Rename File Perform Logic

    Posted 12-18-2023 12:36

    Kevin 

    That was a typo on my part I do have it in there.




    ------------------------------
    Tina Meacham
    RKL eSolutions, LLC
    ------------------------------



  • 4.  RE: Rename File Perform Logic

    Posted 12-18-2023 12:42

    Standard? Make sure the user has permission to rename the file.

    Advanced / Premium?  Best to use a UNC, where the Sage service account has permission to rename the file.



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 5.  RE: Rename File Perform Logic

    Posted 12-18-2023 12:59

    Are you getting errors or is it just not actually doing anything? 



    ------------------------------
    David Overholt
    DWD Technology Group
    ------------------------------



  • 6.  RE: Rename File Perform Logic

    Posted 12-18-2023 14:07

    Just says failed. I'm trying to change the service for SQL and Sage, as they appear to be running as local accounts. Then try again.



    ------------------------------
    Tina Meacham
    RKL eSolutions, LLC
    ------------------------------



  • 7.  RE: Rename File Perform Logic

    Posted 12-18-2023 14:18

    The windows account used by the Sage service will need the permission for this.  (We always run the Sage service as a named user with local admin permission, as well as access to any network paths used with Sage 100).



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 8.  RE: Rename File Perform Logic

    Posted 12-18-2023 17:04

    I stopped the Sage Service and ran as my user. Which I confirmed is in the Administrator group. Still not working, just get this message. 



    ------------------------------
    Tina Meacham
    RKL eSolutions, LLC
    ------------------------------



  • 9.  RE: Rename File Perform Logic

    Posted 12-18-2023 17:10
    Edited by Kevin Moyes 12-18-2023 17:10

    I'd try MAS90 style, just to confirm it is a permission issue, not something in the perform logic itself.

    ! Rename the source file (originally created by Slade Hornick)
    !
    ! Put the Import file in something more manageable
    f$=ImportFileName$
    !
    ! Close the source file, before trying to move it
    close (1,err=*next)
    !
    ! Create a name for the new file
    f_new$=f$+"-"+dte(0:"%Y%Mz%Dz-%Hz%mz%sz")+".imported"
    !f_new$=f_dir$+f_file$+".old"
    rename f$, f_new$
    exit



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 10.  RE: Rename File Perform Logic

    Posted 12-18-2023 17:53

    Tried in MAS90 and failed. Just so you can view and make sure I haven't missed anything. I do not need to edit the file or anything correct?



    ------------------------------
    Tina Meacham
    RKL eSolutions, LLC
    ------------------------------



  • 11.  RE: Rename File Perform Logic

    Posted 12-18-2023 17:58
    Edited by Kevin Moyes 12-18-2023 17:58

    That looks fine (as long as you have copied that file to the right folder on the server).

    If it failed in MAS90 mode I'd suspect something is blocking the rename at the operating system level, unrelated to Sage 100.

    You are testing with a UNC path to the file, and you have full control over the file, it isn't open or marked as Read Only...?



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 12.  RE: Rename File Perform Logic

    Posted 12-19-2023 06:35

    Tina, 

    the error message is indicating that it can't find the file Renamefile.PL in the vi folder. so the code in the file is not an issue.

    I see you copied that text and renamed the file. is it possible that there is a hidden .TXT file extension on the file name or something? 



    ------------------------------
    David Overholt
    DWD Technology Group
    ------------------------------



  • 13.  RE: Rename File Perform Logic

    Posted 12-19-2023 11:22

    @David Overholt UGH...yes that was it! Thank you! 



    ------------------------------
    Tina Meacham
    RKL eSolutions, LLC
    ------------------------------



  • 14.  RE: Rename File Perform Logic

    Posted 12-19-2023 22:02

    Whoa, that perform logic file is an oldie but goodie.  Slade was a master of scripting back in the day!!

    @Tina Leonard - I think everyone has been bitten by the hidden extension issue at least once.  I learned the hard way back in the mid-aughts.  Since that day, I always click on the display file name extensions options in file explorer view tab.  Not sure why MSFT defaults this setting to off.



    ------------------------------
    Jeff Schwenk
    Bottomline Software, Inc.
    (540) 221-4444
    ------------------------------



  • 15.  RE: Rename File Perform Logic

    Posted 12-19-2023 22:35

    Yes.  I can't think of a good reason for hiding the file extension. Why is it even an option?



    ------------------------------
    Doug Higgs
    Midwest Commerce Solutions, Inc
    (312) 315-0960
    Chauffeur, Chef, and Personal Assistant to Sprinkles
    ------------------------------



  • 16.  RE: Rename File Perform Logic

    Posted 12-20-2023 08:56

    Agree. Hiding file extension for known file types results in the unobservant user opening invoice.pdf.exe

    Me: "Right click on Autorun.exe and select run as administrator", User: "which autorun, there are 2?" 

    Also a problem for .csv files and their automatic association with Excel. 

    Always turn off the hide extension option and change association of .csv to Notepad.



    ------------------------------
    Eric Lunceford
    First Mate Business Solutions
    Oklahoma City, OK
    877-880-8960
    ------------------------------