using RAD functions in creating Java script (HPSM)

I want to create a java script to load .unl file.

so how to implement "$L.rc=simple.file.load( <unload file name>, <target file name>, <drop if already exists flag> )" in creating java script.

 

  • First, I would question why you need to do this.  But, the _how_ is pretty simple.

    To call RAD functions inside javascript, preface the function with 'system.functions.' and then replace the '.' in the function with underlines.

    So it should be something like:

    var RC = system.functions.simple_file_load(pathToFile,targetFileName,dropFlag)

    with 'pathToFile' being a valid path to the unload, 'targetFileName' being the appropriate dbdict name for the targeted unload, and 'dropFlag' being the appropriate true/false value

  • Thanks Jacob,

    I want to perform this because My requirement is to automatically load and unload .unl file without using hpsm gui.

    I want to execute load and unload using command line sm.exe.

    Can anyone please guide me how to unload using java script

     

  • Hi Akkigpt,

    Not sure whether the answer I provided to unload files from command solves your problem or not.

    Would like to understand your requirement, why you want to use js to fulfill your requriement insteand of using the method I mentioned in

    /t5/Service-Manager-Service-Center/how-to-unload-script-in-HPSM-using-command-prompt-or-program/m-p/6901052/highlight/false#M134316

    let me know if I can help.

    Ling-Yan

  • Hi ling-yan,

    I need java script because I am familier with JS and not have much knowledge on RAD function.

    As how to code in HPSM taloring -> script i am not getting any guide or guidence on it.

    Script you provided on 

    /t5/Service-Manager-Service-Center/how-to-unload-script-in-HPSM-using-command-prompt-or-program/m-p/6900330#M134263

    That was helpful but the parameter for predefined unl file and new unloaded unl file was passed from HPSM GUI Script, in my requirement i need to pass it from command line syntax

    somewhere in below command.

    sm.exe script.execute NULL NULL prepare_backup.script NULL -bg

     Is there any way that I can do it.

     

    As in script library java script can be written and can be called from sm.exe and parameter can also be passed from command line itself. that is the reason I want java script.