Agile Developer

Axscript

Axpert 11
TStructs (Forms)
IViews
Scripts
Axpert Jobs
Axpert Cards
HTML Plug-ins
Users & Roles
Workflow
Axpert API
Application Var/Params
Publish Axpert Apps
Axpert Mobile
Settings
Utilities
Customization
WebServices
Axfast

Axpert Script

Axscript is a windows service program that executes Axpert jobs in the background. Download the Axscript.exe and install to avail the services.

How to install Axscript?

  • Place the Axscript.exe in the file path where all the dependent DLLs are available. For example, place the Axscript.exe under Axpert folder where all the latest DLLs are available.
  • Open the command prompt from the windows start option, right click and run as administrator.
  • NOTE:The Axscript.exe should be run in administrator command prompt. The service installation may fail in other case.

  • Traverse to the folder where the .exe is placed using cd command in the command prompt.
  • Insert the command given below to install Axscript.
  • axscript.exe/install

  • On successful installation a pop-up message appears “Service installed successfully”
  • To verify the installation of the service, go to command prompt –> services.msc –> A tab with list of services will appear. Search for Axpert Script Service
  • OR
    Go to Task manager –> services –> find “Axpert Script Service”
    NOTE: Whenever a new release is provided, user should start the service by going to Axpert Script Service –> Right click, and select start option from the drop down.

How to update with latest release of Axscript?

  • If the user wants to install latest Axscript then, go to services –> Axpert Script Service –> Right click, and select Stop option from drop down.
  • Uninstall the Axscript application from the system by using the command axscript.exe/uninstall in the command prompt.
  • Install the latest release and install Axscript service. Verify the configuration settings of Axscript(Config.ini) then, Go to services and start the Axpert script service.
  • NOTE: Axpert 11 supports Axscript on Redis server only.
    Whereas, Axpert 10.9 supports Axscript on Redis server and without Redis server.

Configuration Settings

To enable the Axscript operations, we require a mandatory Config.ini file in the path where the axscript.exe is placed.

This file may or may not include thin client details based on the POS usage. Introduce a new section for axscript. If Config.ini does not exist, create a file with a .ini extension using notepad and introduce an a script section as shown below.

Parameters under Axscript with REDIS Server:
  • Redishost: the IP of the redis host in use. The above is the default value that will be considered.
  • Redispassword: Send the password to the dev team (the .net team). They will provide a redis.pwd file which needs to be placed in your local path. The path where the .pwd file is placed needs to be specified in redispwd of config.ini file.
  • Dbcon: The application name in use
  • Owner: The username
  • Fromtable:
    • The default value assigned is False.
    • If the axscript service is using redis server then fromtable value should be False.
  • Trace: To track any errors during execution we can enable trace by setting it to True. By default, the value is set to False.
  • NOTE: If axscript has to operate on redis server then redishost and redispwd fields are mandatory.

Parameters under Axscript without REDIS Server:
  • Dbcon: The application name in use
  • Owner: The username
  • Fromtable:
    • The default value assigned is Flase.
    • If the axscript service is not using redis then fromtable value will be True.
  • Trace: To track any errors during execution we can enable trace by setting it to True. By default, the value is set to False.

AXSCRIPT Tables

The details of axpert jobs are recorded in tables. These tables are used by all Axpert jobs, regardless of whether or not redis is used.
Axscript With Redis: Push data into redis then Axscript will read data and insert it into the table.
Axscript Without Redis: Insert data directly into the table.
There are two tables that record job details in axpert:

  1. Axscriptjobs –> The job details will be available in this table. We can schedule multiple jobs for the individual scripts.
    Select * from axscriptjobs
  2. If the axscript is using “fromtable=true”(without redis) then values have to be inserted manually into the table.
    If the axscript uses Redis, the values are first sent to Redis, after which the data is referred to and pushed into the table.

  3. AXSCRIPTDEF –> All the jobs defined in the axpert developer are stored in this table.
    Select * from AXSCRIPTDEF

How to push value into Redis

Syntax: SetToRedis(HostName, KeyName, KeyValue , pwd : String ; timeout : integer);
To perform any job, user has to push the action details to redis server by using SetToRedis procedure in Axpert script. The user has to give five values as per the defined parameters. They are:

  1. Host Name- (IP Address of redis server and Port No)* (Ex : 127.0.0.1:6379)
  2. Key Name – This will be the Job Name for the task and it should be unique.
    Key name format:
    newaxs + Priority + <Unique_No>_<Application Name_><ScheduledTime>
    newaxs – new axscript
    Priority – Priority value should be 0 for high priority and 1 for normal priority
    Unique no – Get 6 digits unique number by using Autogenerate field.
    Scheduled time – year month date hour minute second
    Ex.- newaxs1000001_agileerpdemo_20211124010000

  3. Key Value – All the necessary information that is required to perform a job will be here in one string and will be separated from each other with the pipeline symbol ‘|’
    Key Value format:
    “dbcon=ConnectionDetails|owner=admin|scriptname= MyScriptName ” (Without params)
    “dbcon= ConnectionDetails |owner=admin|scriptname=MyScriptName|axparam_<Mention Params here>” (With params)
    If parameters are specified, the format should be as follows:
    axparam_tmpval(n)=3456|axparam_tmpdt(d)=07/09/2020
    Example: KeyName, KeyValue
    newaxs1000001_agileerpdemo_20211124010000″dbcon=agileerpdemo|owner=admin|jobdate=20211124|scriptname=salesinvlist EmailAttach”
    NOTE: When the axpert jobs are processed the prefix of the parameter list changes as follows

    • Job In progress-prefix the parameter list with inp
      inp1000001_agileerpdemo_20211124010000″dbcon=agileerpdemo|owner=admin|jobdate=20211124|scriptname=salesinvlist EmailAttach”
    • If the job encounters any error, then the list is prefixed with err.
      err1000001_agileerpdemo_20211124010000″dbcon=agileerpdemo|owner=admin|jobdate=20211124|scriptname=salesinvlist EmailAttach”
    • If the job is successful then, it is prefixed with done.
      done1000001_agileerpdemo_20211124010000″dbcon=agileerpdemo|owner=admin|jobdate=20211124|scriptname=salesinvlist EmailAttach”
  4. Redispwd – Redis password available in the .pwd file.
  5. Timeout- Response wait time
  6. *(If the IP address of redis server is local host, then 127.0.0.1 will be passed and default port no is 6379)
    Example: settoredis(redishost,keyname,keyvalue,pwd,timeout)

    The submit button in axpert job of the developer site calls isave () which feeds the data of active axpert jobs into redis.
    The job is executed only if it is marked as Active while defining it.

    The expression set field uses the syntax to set the redis value.
    NOTE: The password is copied from the .pwd file

    The Axscript will find the jobs defined using the newaxs prefix and push it into axscriptjobs table. It is further processed and details are taken from AXSCRIPTDEF table using the script name referred from the jobs.