Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Ax Pert Tutorial

Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

Contents

Introduction....................................................................................................................................................................... 6

Possibilities with Axpert ........................................................................................................................................... 6

Main components in Axpert ................................................................................................................................... 7

Understanding the concept behind Axpert ...................................................................................................... 8

Getting started ................................................................................................................................................................. 9

TStructs (Forms) ............................................................................................................................................................... 9

Create form ................................................................................................................................................................... 9

Create DC....................................................................................................................................................................... 9

Create fields ............................................................................................................................................................... 10

Save a tstruct ........................................................................................................................................................ 10

See it working ....................................................................................................................................................... 10

Try out.......................................................................................................................................................................... 10

Grid DC/frames......................................................................................................................................................... 11

Formulae in fields .................................................................................................................................................... 12

SQL in fields ............................................................................................................................................................... 12

Drop down fields ..................................................................................................................................................... 12

Select from List .................................................................................................................................................... 13

Select from form.................................................................................................................................................. 13

Save normalized .................................................................................................................................................. 13

Select from SQL ................................................................................................................................................... 13

SQL parameters ................................................................................................................................................... 14

Handling Large SQL results ............................................................................................................................. 14

Drop down fields with capability to add .................................................................................................... 15

Auto select in drop-down ................................................................................................................................ 15

Page | 1
Refresh on Save ................................................................................................................................................... 15

Fill fields .................................................................................................................................................................. 16

Multiselect fields ................................................................................................................................................. 16

Autogenerate fields ................................................................................................................................................ 17

Prefix fields ............................................................................................................................................................ 17

Dynamic sequences............................................................................................................................................ 18

Table fields ................................................................................................................................................................. 18

Dynamic table fields........................................................................................................................................... 20

File uploads fields in forms .................................................................................................................................. 21

Photos & Image fields ........................................................................................................................................... 22

Fill grid ......................................................................................................................................................................... 22

Multiselect property........................................................................................................................................... 23

Auto show & Add Rows property................................................................................................................. 23

Validate property ................................................................................................................................................ 23

Execute on save property................................................................................................................................. 23

Fill a grid DC from another grid DC ............................................................................................................. 23

Grouping field ...................................................................................................................................................... 24

Posting data – Gen maps ..................................................................................................................................... 24

Post multiple records into target .................................................................................................................. 26

Control field .......................................................................................................................................................... 26

Posting from a grid in source to a grid in target .................................................................................... 27

Group field............................................................................................................................................................. 27

Posting to specific rows .................................................................................................................................... 27

Mapping constant values................................................................................................................................. 27

Updating fields in DB tables – MD Map ......................................................................................................... 27

Control field .......................................................................................................................................................... 29

Execute on approve/reject............................................................................................................................... 29

Page | 2
Append MD Maps (AMD Maps) .................................................................................................................... 29

MD Map definition as script ........................................................................................................................... 29

Tool bars in tstructs ................................................................................................................................................ 30

Tracking changes/Audit trial ............................................................................................................................... 30

IViews – reports & Lists.............................................................................................................................................. 30

About IViews in Axpert .......................................................................................................................................... 30

IView parameters ..................................................................................................................................................... 31

IView columns ........................................................................................................................................................... 32

Hyperlinks .............................................................................................................................................................. 32

IView properties ....................................................................................................................................................... 32

Pivot in IViews/Reports ......................................................................................................................................... 32

Tool bars in IViews .................................................................................................................................................. 33

Row options............................................................................................................................................................... 33

Scripts ............................................................................................................................................................................... 33

About Scripts in Axpert ......................................................................................................................................... 33

Assignments in scripts....................................................................................................................................... 34

Loops in scripts .................................................................................................................................................... 34

If conditions in scripts ....................................................................................................................................... 35

Major Axpert functions.......................................................................................................................................... 35

Loading a form..................................................................................................................................................... 35

Load a form along with data .......................................................................................................................... 35

Loading a page .................................................................................................................................................... 36

Clearing a form .................................................................................................................................................... 36

Cancelling form data ......................................................................................................................................... 36

Delete a record in form .................................................................................................................................... 37

Refresh Field values in a form ........................................................................................................................ 37

Load an IView/Report ........................................................................................................................................ 37

Page | 3
Navigate to an external page ......................................................................................................................... 37

Closing a popup window ................................................................................................................................. 37

Hiding controls in a form ................................................................................................................................. 37

Unhide controls in a form ................................................................................................................................ 38

Enable components in form............................................................................................................................ 38

Disable components in form .......................................................................................................................... 38

Change field captions at run time in forms .............................................................................................. 38

Set focus to a component in a form ............................................................................................................ 38

Showing popup messages in forms............................................................................................................. 38

Send EMails ........................................................................................................................................................... 38

Email Configuration ........................................................................................................................................... 39

Printing forms/reports ...................................................................................................................................... 40

Data Import ........................................................................................................................................................... 40

Mathematical functions......................................................................................................................................... 42

String functions ........................................................................................................................................................ 42

Date functions........................................................................................................................................................... 42

Axpert jobs...................................................................................................................................................................... 43

Call third party API....................................................................................................................................................... 43

Axpert Cards (Widgets) .............................................................................................................................................. 43

HTML Plug-ins ............................................................................................................................................................... 44

Users, roles & responsibilities ................................................................................................................................. 44

Work flow ........................................................................................................................................................................ 45

Axpert API ....................................................................................................................................................................... 46

Sample Java Script code to call Axpert API ................................................................................................... 46

API call to save data into a tstruct ................................................................................................................ 46

API call to get application variables ............................................................................................................. 47

API Call to get an IView result ........................................................................................................................ 47

Page | 4
API Call to get an IView parameters ............................................................................................................ 48

Application variables & Parameters ...................................................................................................................... 48

Publish Axpert apps .................................................................................................................................................... 49

Database console ......................................................................................................................................................... 49

In-Memory Database console ................................................................................................................................. 50

Axpert Mobile ................................................................................................................................................................ 50

Push notifications ......................................................................................................................................................... 50

Axpert on-premise installation ............................................................................................................................... 50

Page | 5
Axpert 11
Tutorial and guide

Introduction
Axpert is a low code application platform that is widely used. Apps are created using Axpert by
only defining the data structures. There is no need to write programs in multiple layers. Agile
owns the patent for this concept behind Axpert. This is one of the widely used low code
platforms across many countries.

Axpert is best suited for requirements that are data centrical with complex process, that needs
to manage large volumes of data and integrate with other applications.

Axpert is available both on-premise and on cloud.

Possibilities with Axpert

Axpert apps can be used on Windows Desktop, Browsers as web applications and on mobile
devices. Axpert apps can be deployed on remote locations with automatic data synchronization.

Page | 6
Main components in Axpert
Axpert apps are built by defining forms, reports, lists, widgets and writing scripts to achieve
some complex tasks. The various utilities and tools that are packed with Axpert development
environment enables users to create enterprise class apps on the fly.

The main components in Axpert developer site are these –

You can download Axpert from www.developer.agile-labs.com and install on-premise or on your
private cloud. To install Axpert on-premise, follow the instructions provided in the installation &
configuration section. This may take several hours.

When Axpert is installed in a server or a cluster of servers, that is called an Axpert Instance
(AxIns).

For each application that is to be developed & deployed on Axpert, you should create an
Axpert App schema (AxAS). The data and meta data that are related to the application are
stored in the schema.

Axpert is already installed & configured on www.AgileCloud.biz. This is a shared AxIns on cloud.
You can build and host applications on this cloud for your customers. You may also choose to
build Axpert apps on AgileCloud and deploy it on-premise too. See Axpert on-premise
installation section for installing Axpert on-premise.

Let us now start understanding Axpert by building an application on AgileCloud.

Page | 7
Understanding the concept behind Axpert
The basic building block of Axpert is called a transaction structure. A transaction structure
(tstruct) is a collection of data elements along with business rules. To develop apps on
Axpert, the core entities are identified and represented as transaction structures.

A data element is described by its basic attributes (like type, width, etc..), rule to populate and
rule to validate. A collection of such data elements become a structure. Data flow from one
structure to another is created as maps. The maps are created by connecting data elements in
source structure to the target structure. Special logic that needs to be attached along with data
may be attached using Axpert scripts or database procedures and functions. Axpert support
Oracle, MySQL, PostgreSql & MS SQL databases.

For example, in a CRM application, the core entities are prospects, sales person, customer
master & daily activities. In a procure to pay cycle – supplier master, item master, rate contract,
purchase request, purchase order, GRN, supplier bills are some of the major tstructs. In a time-
sheet application – employee, project master, time sheet, sasks, project milestones are some
major tstructs.

The structures are created in Axpert through the developer site. The rest are managed by Axpert
run time site. These structures can be accessed as a form in Axpert. In other words, all forms in
Axpert are created as tstructs. Once a structure is created, the underlying database tables to
store data are automatically created. Axpert also manages all table relationships and referential
integrities.

The Axpert core layer is a collection of API that provide services around a tstruct. It consists of
API for saving data into structures, listing data from structures, searching, getting the menu,
managing work flow, data flow, data import, data export, script execution, etc.

The Axpert UI layer provides a standard user interface for accessing tstructs as forms, lists,
menus, widgets, wizards, data import & export features, user and access control management,
work flow configuration.

Axpert is not a code generator. It has a standard set of APIs that read and execute the logic
defined in structures. For example, there is one API called submit. This will be able to submit
data into any structure or form.

Hence, functionalities created in Axpert are available as API that can be consumed by third party
applications. There is no need to write programs or do any additional activity to publish the
functionality as web or REST services.

Page | 8
Getting started
Go to www.agilecloud.biz.

Use the “Contact us” link in Agile Cloud to register. On providing your basic information as part
of the registration process, you will be sent login credentials. As part of the login credentials the
schema name, user name and password will be emailed to your registered email address.

Login to AgileCloud with given credentials. An empty application screen will be displayed. Click
on the “Develop” option under utilities to start developing an app. This will open the Axpert
development site. The development site can be accessed by using the link
www.agilecloud.biz/dev too. The developer site provides all required options to develop an
application.

Axpert may be downloaded from http://developer.agile-labs.com/resources/downloads/. Follow


the instructions in the Axpert installation section to install and configure Axpert.

TStructs (Forms)
Create form
Click on Forms/TStruct option to create and edit forms. This will list all the available forms in the
application. Click on New button to create a new form. The “New Form” page will be displayed.
Enter the form name, caption and click on submit button.

Create DC
On successful creation of a form, the form elements are listed. The form elements page lists the
form elements on the left panel. It shows the properties of a selected element on the right
panel. For a new form, by default, a DC is added. A DC is a Data Container.

A data container is a frame in the form. A DB table name can be set in the table name property
of a DC. When the structure is created, the table is also created in the backend database. One or
more fields can be created under a DC. Each field in the DC will be created as a component in
the form. It is also created as a field in the table. A DC table that is created by Axpert will contain
the TableName+Id as a field. This is the primary field for this table & Axpert populates this field
with an unique number. This field is referred to as recordid in Axpert.

There can be more than on DC in a tstruct. The first DC in tstruct is called a primary DC. The
tables of DCs other than the primary DC will also contain the tablename+id field of the primary
DC table.

Page | 9
Example: consider a tstruct that has 2 DCs. The primary DC table is header and the second dc
table is detail. The header table will be created with HeaderId as its primary field. The detail table
will be created with DetailId as its primary field. HeaderId also will be created as a field in Detail
table with a foreign key relationship with headerid in header table. So, when data is stored in
these tables at run time, the referential integrities are automatically established.

Create fields
Once a DC is created, start creating fields by selecting from the available options under the New
option. Select the field type as per need. Most field types are self-explanatory. The advanced
fields like table fields & the form elements will be described in later sections.

Save a tstruct
Once your form elements are created, click on the save button in the top tool bar. This will the
save the tstruct and make it available in run time. After save, use the Form Design option to
design the form. The form design need not be done if a tstruct is not published as a form to the
user.

See it working
Login it www.agilecloud.biz/run using the given credentials. The form will be automatically
added to menu. Click on it and see it working. Axpert manages all the functionality related to
saving, listing, searching, editing & deleting data in the form.

Try out
Customer form
Try out creating a customer form with form elements as given below and check it out

Name Caption Details

Cname Customer name Simple text, unique & not empty

Ccode Customer code Autogenerate

Address Address Large text

AccountManager Account manager Drop down Axusername from User logins form.
Axpert by default comes with a form to create
users.

Email Email Email

Page | 10
Similarly try creating – Use your imagination to create as many fields as possible. Try out all the
basic fields, components & special fields.

• Supplier form
• Employee form
• Leave application form
• Product master form.

Grid DC/frames
These are frames in which data is accepted as a table. Each field that is created in a grid DC is
shown as column in a table in this frame. A database table that is created for a grid DC as in a
normal DC. Each row that is entered in the form in this DC is stored as a row in the DC table.
That mean there may be many rows in a grid DC table for data entered in a form. The non-grid
DC tables will have only one record for every form data. Hence, a one to many relationship is
established between the primary table and the grid table.

Example:

Sales Order form

Invoice No
Invoice date
Customer
Ship to
Bill to
Tax No.

Product UOM Qty Rate Amount

Consider creating a form as above. This is to be created as tstruct with 2 DC viz. header & detail.
The detail is a grid DC in which each grid column is created as a field under this DC. For every
sales order that is entered in this form, there will be one record in the header form and for every
row in the detail grid, a row will be added in the detail table. These two DB tables are related by
the HeaderId.

Page | 11
Formulae in fields
A formula can be assigned to any field in Axpert. A formula for a field is assigned in the
expression property. The formula will be evaluated and assigned as the field value at run time.
All fields in this tstruct/form that are before this field can be used as variables in the formula.
The operators are + - * / ^ ( ). { is used as quotes in Axpert. So, to use a constant string, enclose
the string between { }. For example, a string hello in an expression is set as {Hello}. The list of
functions that can be used in Axpert is available in the Axpert functions section.

Examples:
Consider a form that contains fields
• ItemName
• ItemType
• SellingRate
• SaleQuantity
• DiscountPercent – This should be populated with 3% if ItemType=A and SaleQuantity >
5 or ItemType=B and SaleQuantity > 100
• SaleAmount – This should be calculated based.

Formula for DiscountPercent –


Iif( ((ItemType={A}) & (SaleQuantity>5)), 3, iif((ItemType={B} & SaleQuantity>100), 5, 0))

Formula for SaleAmount –


(SellingRate*SaleQuantity) – (((SellingRate*SaleQuantity)*DiscountPercent)/100)

SQL in fields
An SQL can be assigned to a field. At run time, the SQL will be executed. The value in the first
row and first column will be assigned as the field value. SQL may have parameters. The
parameters may be field names from this tstruct/form. Fields that are before this field can be
used as SQL parameters. If suggestive property is set to true, the value that is filled can be
changed by user.

Drop down fields


Drop down fields show a list of choices for users to select. The drop-down values can have 3
different sources. It may be from a list of values, from a field in another form or an SQL result.
The data source can be chosen in the Data panel in the properties section.

Page | 12
Select from List
Choose the “select from list” option to create a field with list of drop-down values. The values
are provided as a comma separated string in the “List Values” field. For example, if we need a
gender field as a drop down, create a drop-down field with “select from list” option and in list
values field enter Male,Female,Transgender as values.

Select from form


Choose the “Select from form” option to create a drop-down field that will list data from a field
in another form, as drop-down values.

Example: Consider a task allocation form with a drop-down field to select employee to whom
the task is to be assigned. The drop-down should list the names of employees from employee
master. Add a drop-down field, choose “select from form” option. Choose the employee master
in the “Data source form” field. The fields in the employee master will be listed in the “Data
source field”. Choose the “employee name” in this field. Axpert automatically frames an SQL &
displays in the SQL text.

Save normalized
Notice that the SQL framed by Axpert in a “Select from form” case has 2 columns. The first
column is the recordid of the source table and second is the data source column. The drop-
down values are listed in run time from the data source column in the SQL statement. While
saving, the recordid is stored instead of the value.

Select from SQL


This is a critical feature to implement many business rules. This may also be used to write
complex logic as SQL functions and get the result into this field.

Choose the “Select from SQL” option to create a drop-down field that will list the values
returned by an SQL statement as drop-down values. Enter the SQL statement in the “SQL text”
field. The first column in the SQL result will be listed as drop-down values.

The pop out button at the right top corner of this field will open a full Database console. This
can be used to inspect all the DB objects, create SQL functions, procedures, triggers, indexes,
etc. The SQL result can be executed to check out the result of the SQL statement.

In case, instead of storing the drop-down value in this field in run time, the recordid of the
source table has to be stored (save normalized), the first column in the SQL should be the
recordid and the second field should be the data source field. The Save Normalized check box
should be ticked.

<TBF>

Page | 13
SQL parameters
The fields defined in this tstruct may be passed as parameters to the SQL statement. SQL
parameters are prefixed with colon in an SQL text. At run time, the values entered in these
parameter fields will be passed as parameter values to the SQL statement. This enables
developers to pass parameters to DB functions/procedures or apply filters and get only relevant
data as drop-down values. SQL parameters may be tstruct fields or application variables. Axpert
provides a set of default app variables like username (logged in user name), userrole (the roles
assigned to the logged user) etc. User define app variables may also be added in the “App
variables & params” option under Utlis. A list of default application variables is available in the
Default App Vars sections. <TBF>

Example: Consider a table named “CountryData” that contains three fields named Country, State
& District. This has records of all countries, the states within them and districts within the states.

Consider a form in which there are 3 fields Country, State/Province & District/Territory. The
country is a drop-down field that lists all the countries from CountryData. The State is a drop-
down that lists all the states within the selected country. The District/Territory is a drop-down
field that lists all the districts within the selected state.

Each field will have a select statement that brings data from CountryData. The SQL in the state
field will have country as a parameter. The SQL in district field will have :state & :country as
parameters.

<TBF> illustrations

Handling Large SQL results


Consider cases where an SQL result returns a large set of records that may be more than a ten
thousand records. Getting this kind of a result and binding to a drop-down in a form will lead to
non-responsive web/mobile app. The user may also need advanced filtering option to do a
quick filter from the large result to select the required value.

This is achieved in Axpert by introducing a tag named {dynamicfilter field1, field2, … ~


Field1Caption, Field2Caption, …} in the SQL text. This tag should be added to the where clause
of the SQL. The column names on which an advanced search should be provided to user at run
time follows the dynamicfilter tag. The captions that are to be displayed in the search window
for each column are provided as comma separated strings after the ~.

Once a dynamic filter tag is introduced in an SQL, the SQL result data is brought to front end in
blocks of 1000 rows. This can be modified in developer options using the “Drop down fetch size”
property.

Examples:

Page | 14
1. Select a.username, a.mobile, a.dob from axusers a {dynamicfilter a.username, a.mobile
~User Name, Mobile No.} order by username
2. select username,nickname,email from axusers
where actflag='T' {dynamicfilter username,nickname,email~Username,Nickname,Email}
order by 1
3. select username, nickname, email from AxInternalUsers where actflag='T' {dynamicfilter
username,nickname~UserName,NickName }
union all
select username, usergroup, null from AxExternalUsers {dynamicfilter
username,usergroup~Username,Nickname }
order by 1
4.

<TBF> The screen shots related to the run time UI for a dynamic filter field.

Drop down fields with capability to add


Drop downs may be listing data from other forms. If the required value is not found in the drop
down at run time, users may need an option to add. That means, data should be added to a
master form. Select form name in the master “property”. At run time, the drop down will have an
link to add a new value. On click of this option, the form (that is set in the master property) will
be opened in new mode. On submit of data, the drop-down list will be refreshed and the new
value will be listed in the drop-down.

<TBF>Illustrations.

Auto select in drop-down


Consider a requirement in an application that has a drop-down field. The value in the drop-
down field should be auto selected if there is only one drop-down value. If there are more than
one drop-down value, the user will choose from the drop-down. Tick this “auto select” to enable
this functionality. Enabling this without proper need will reduce the performance of the end
application. So, this feature should be used only if this functionality is an absolute necessity.

Refresh on Save
The drop-down values may change after saving data in this form. Set this option for such needs.
On saving the data in the form the drop-down values of such a field will be fetched from
database. Enabling this without proper need will reduce the performance of the end application.
So, this feature should be used only if this functionality is an absolute necessity.

Example: Consider a task allocation form with fields


• Task Name – Drop down from Tasks Form. The drop-down field SQL has a where
TaskForms.Status=’New’.

Page | 15
• Assign to – Drop down from employee master.
On saving data to this form, the status field in task form is updated with Assigned. So, when a
new data is entered after saving, the task name drop-down values should be refreshed. To
enable this refreshing, this flag is set to true.

Fill fields
Fill-fields are associated to drop-down fields. The SQL in a drop-down field may have many
columns. The columns in the SQL, other than the recordid column and the data source column,
may be mapped to a fill-field in this tstruct. The column in the SQL that is mapped to a fill-field
is called the source column. At run time, when user selects a value in a drop down, the value
from the source column of the selected row is populated into the fill-field.

To define a fill-field
• Add a text or numeric or date field.
• Select Mode of entry as “Fill”.
• Select the associated drop-down field name in “master” property.
• Select source column from SQL in “Source” property.

For example, consider a form that contains 2 fields viz. EmployeeName & EmpGender. The
employee name is a drop-down field in which the user may choose an employee name from
master. The SQL in the employee name field should contain the gender column from employee
master. Add a short text field for EmpGender. Select the mode of entry as “Fill”. Select
“EmployeeName” in the master property & ‘Gender’ in the source property.

<TBF> Illustration to be added.

Multiselect fields
A multiselect field is the same as a drop-down field from a source SQL. The only difference is
that a user can select one or more values. The selected values will be stored comma separated in
the field.

Consider a case where user has to select one element from across multiple groups. That is, first a
set of choices are listed for selection. On selection, next set of choices are listed. Then the next
set of choices…

Example:
Consider a drop down in which user has to select a colour, a style and a size. The SQL should
result should be as below. The GroupBy, GroupOrder, Selected & Rule should be columns in the
SQL. In this sample result given below, first the drop down will show all the colours. Then the

Page | 16
styles will be listed, then the sizes will be listed. User can choose one after another in the same
field. The grouporder column specifies the order in which the choices have to be listed. ‘T’ in
Selected column, auto select the value into the field by default. The Rule string has one position
for each set of choices. M in this string stands for Mandatory. If a particular group is set as
mandatory, then user will have to choose at least one value in this group.

Options in drop down GroupBy GroupOrder Selected Rule


White Colour 1 T MNM
Red Colour 1 F MNM
Blue Colour 1 F MNM
Sports Style 2 T MNM
Sturdy Style 2 F MNM
Light Style 2 F MNM
30” Size 3 T MNM
32” Size 3 F MNM
34” Size 3 F MNM

Autogenerate fields
Axpert will generate unique sequential numbers for autogenerated fields. An autogenerated
number will have 2 parts. An alphabetical prefix followed by a unique sequential number. There
can be more than one sequence for an autogenerated field. Each sequence is uniquely identified
by the prefix. Use the Define Sequence property in the data section of an autogenerate field
properties to create one or more sequences.

Example: Consider a loan application form that has an autogenerated field named
ApplicationNo. The number generated in this field should be prefixed with ‘LAPP’ followed by a
unique number starting from 1. To achieve this, create an autogen field with one sequence with
given prefix. In run time, as user enters data in a form, for every record a unique sequential
number will be generated and assigned as this field value. The number will be prefixed with
‘LAPP’.

Prefix fields
The prefix column can be set with a field name. The field name should be prefixed with colon.
This field is called the prefix-field. Only fields in this tstruct can be used as prefix-field. The
prefix-field should be before the autogen field. At run time, the value in the prefix-field will be
used as a prefix.

In the example above, consider a scenario where the prefix should be


• ‘VAPP’ for vehicle loan applications
• ‘HAPP’ for home loan applications
• ‘LAPP” for other loan applications.

Page | 17
To achieve this, add a prefix-field before the autogen field. The value in this field should be
‘VAPP’, ‘HAPP’, ‘LAPP’.

At run time, the depending on the selection in loan type field, the prefix will be set. But, the
numbers generated will be sequential across all prefixes. To generate multiple sequences at run
time, use dynamic sequences.

Dynamic sequences
New sequences can be added at run time. That means, while creating the form, there may be
only on sequence. But, using the value in prefix-field new sequences can be created at run time.
The value in prefix-field should be a comma separated string in the following order
• It should start with _
• prefix
• starting number
• number of digits
• transid (optional, required if an autogen field uses the sequence from afield in another
tstruct/form)
• fieldname (optional, required if an autogen field uses the sequence from afield in
another tstruct/form)

Example: consider a scenario where an autogen field has following rules


• Prefix = 5 Char Company Code + Year
• Every unique prefix should be considered as a unique sequence.

To achieve this the prefix-field value should be _{:compcode}+{:YearOfDate}+{1,6}. In this case,


the compcode and yearofdate are fields in this tstruct.

Table fields
A table-field is a collection field type (CFT). The properties of this field is provided as a JSON
string in the collection field descriptor (CFD). This is used to accept field values in a drop-down
table in run time. The drop-down table will have columns & rows as described in the descriptor.

The CFD value can be set as below –


{
“props”: {
“type“: “table”,
“title”: “My table”,
“colcount“: “4”,
“rowcount”: “5”
“valueseparator”: “|”
“rowsepaatror”: “||”

Page | 18
“SQL”:
}
“col1” {
“caption”: “Column one”
“value”: “v1”
“source”: “<sourcefield>.
“exp”:”expression to calculate & populate”
“vexp”:”expression to validate”

}
“col2”: {
}

At run time, the CFT will pop up a table in which data can be entered by user. The data entered
by user will be stored in the field as one string. The individual field values will be separated by
the given value separator. The rows will be separated by given row separator.

The “type” tag in the CFD can be set to table or form. Forms will be shown as name-value pairs.

The source tag may be set with a field name from the tstruct. This field is a drop-down field if
the source field is a drop-down field. The drop-down values from source are used as drop-down
values for this field.

Example: Consider a use-case where the user is entering the marks of a student
• Student name – Selection from a drop down of students from student master.
• Subject – Drop-down field
• Mark – Accept
• Mark details – Table field that pops up a table as below

Test type Written Oral Total


Test – 1 30 10 40
Test – 2 18 7 25
Term – 1 31 12 43

The CFD for the above would be as below


{
“props”: {
“type“: “table”,
“title”: “Marks table”,
“colcount“: “4”,
“rowcount”: “5”

Page | 19
“valueseparator”: “|”
“rowsepaatror”: “||”
“SQL”:
}
“col1” {
“caption”: “Test type”
“value”:””
}
“col2”: {
“caption”:”Written”
“value”: “”
}
“col3”: {
“caption”:”Oral”
“value”: “”
}
“col4”: {
“caption”:”Total”
“value”: “”
“exp”:”col2+col3”
}
}
If the test type should be a drop down, follow the steps given below
1. Create a hidden field before Mark details field named “HTestTypes” as a drop down field.
2. Change the col1 definition in the CFD as below
“col1” {
“caption”: “Test type”
“value”:””
“source”:”HTestTypes”
}

Another way of doing it is to create the HTestTypes field as a text field with an expression that
returns the comma separated string of the test types like Test -1,Test – 2,Term – 1. The comma
separated values will be converted into a drop down for Col1.

Dynamic table fields


There is a property named Dynamic Source Field (DSF) for table-fields. This provides a drop
down of fields in this tstruct. In run time, the dynamic source field should be populated with the
name of a table descriptor. The CDF defined in the selected table descriptor will be used to
create the table in run time.

Page | 20
The Table descriptor option is under Utils in developer site. This option accepts a name for the
descriptor and the collection field descriptor JSON.

In the above example if subject is science, then a table as below should be displayed.

Test type Theory Practical Total


Test – 1 30 10 40
Test – 2 18 7 25
Term – 1 31 12 43
Internal – 1 41 18 59

Define the CFD for both tables as 2 different records in Table descriptor option. Name the
science table as “SciDef” and the earlier table definition as “OthDef”.

Create a field named MarksDSF as an expression field with expression iif(subject={Science},


{SciDef}, {OthDef}). Select this field in the Dynamic source field property for mark details table-
field.

This is an extremely powerful concept that can be used for cases like EMR, Lab tests forms, cost
centers, budget apportioning, textile costing forms and many more.

File uploads fields in forms


These are fields that provide options to users to upload one or more files. Each file name will be
shown as a tag within the field. These file names are stored in this field as comma separated
values. There can be more than one file-upload fields in a form. These may be added to grid
frames too. The name of a file-upload field should be prefixed with AxpFile_.

By default, the uploaded files are stored into a database table. The name of the database table
will be TransId+FieldName. The transid is the name of the tstruct/form. The field name is the
name of the file-upload field without the prefix AxpFile_.

Example: If the transid is ‘form1’ and file-upload field name is ‘axpfile_mydocs’, the table name
will be form1mydocs.

It is not very efficient to store file uploads within database. The uploaded files may be stored in a
file server at a given path. Set the file server name in app variable named “AxpFileServer”. The
file path should be set in “AxpFilePath”. If the file server is protected with a password, it should
be set in “AxpFileUser” and “AxpFilePwd”.

Example: To store in all files in a server named “DocServer” in path “E:\Axpert\FileUploads” with
user name “AxpertFileUploader”, password “Agile.01”
Go to App Vars option under utlis in developer site. Add the following vars.

Page | 21
AxpFileServer={ \\docserver}
AxpFilePath={ E:\Axpert\FileUploads}
AxpFileUser={ AxpertFileUploader}
AxpFilePwd={Agile.01}

To change the path for a file-upload field in a form, add a field prefixed with “AxpFilePath_”.
The field name should be same as the file-upload field. The path set as value in this field will be
used to upload to the file server set in AxpFilePath app vars.

Example: If the file-upload field name is Axpfile_mydocs, the file-upload-path field should be
named AxpFilePath_mydocs. This field value should be the path (like E:\Axpert\SpecialDocs\). It
may also contain along with server name like \\docserver\Axpert\SpecialDocs\.

A file name modifier may be added to the end of the file path suffixed with *. In that case the file
names will be added to the modifier string. If the file-upload-path field contains
\\docserver\Axpert\SpecialDocs\202110101800*. If a file named “MyPhoto.jpg” is uploaded, it
will be stored in \\docserver\Axpert\SpecialDocs\202110101800myphot.jpg.

Photos & Image fields


Select a photo or image field There can be more than one image field in a form. These are
stored in database tables by default. The name of the table will be transid+fieldname of image
field. For example if the form name is “form1” and the image field name is “MyPhoto”, the table
will be Form1MyPhoto. Image fields cannot be used only in grid DC.

Axp_ImageServer & Axp_ImagePath are application variables in which the server & filepath in
which the photos should be stored are provided. If these vars are defined, then the images will
not be stored in DB tables but in the give path in the given server. The files will be stored under
the transid folder under the given filepath. The file will be named as “recordid”+fieldname+the
file extension.

Fill grid
This is a map in a tstruct/form that is used to populate an SQL result into a grid DC. Every row in
the SQL result will be added as a row in the grid DC. The column values will be from the SQL
named as the source-column will be mapped to the fields in the grid DC. Use the “Fill Gird”
option under “New” section to create a fill-grid map.

The fill-grid caption is shown as an option in run-time for users to choose to execute the fill-
grid. The fill grid option will be available as an option at the top of the grid DC.

Page | 22
Select the DC into which the SQL result should be populated in the “Target DC” property. Enter
the source SQL in that property. The SQL may use any field before the Target DC as parameters.
Map the columns in the SQL to the fields in the target DC in the Map Details DC.

Multiselect property
User may need only selected rows from the SQL result to be populated in the grid. Set this
property to true for this use case. At run time a popup window will be shown that lists all the
rows from the SQL result.

User may choose rows and selected rows will be populated into the target grid DC. User may
choose rows in the popup window by either clicking or double clicking. This option can be
selected in the “Select On” property.

The footer string property may be used provide a string that has field names from the tstruct
embedded in it. The fields should be prefixed with colon. At run time, this string will be
displayed after replacing the fields with actual values. This will be displayed at the bottom of the
selection window.

Auto show & Add Rows property


The fill grid will be auto executed without user having to click on the fill grid option, if auto show
is checked. Fill grid will auto execute based on the selection in the “Add rows” property.

Check the “Firm Bind” property to auto execute the fill grid in case the SQL parameter field
values are changed. For example, consider a form that fills the pending tasks of a selected
employee. The pending tasks are brought by an SQL to which the employee name is passed as a
parameter. The employee name could be drop-down field in the form. When the employee
name is changed in the form, the grid will be auto refreshed with tasks of selected employee
when “Firm Bind” property is checked.

Validate property
Check the “Validate” property to validate the values that are populated in each field in target DC
when the fill grid is executed at run time.

Execute on save property


A fill grid executes only when user focuses on the target DC or clicks on the fill grid option. In
case the form data is saved without focusing on target DC or clicking on option, then the fill grid
can be executed while saving. Check this property to enable this functionality.

Fill a grid DC from another grid DC


Instead of filling a grid from an SQL result, it can be filled from another grid DC. Select the
“Source DC”. In this case, the SQL should be empty. Every row in the source grid will be added as

Page | 23
a row in this grid DC. The column values will be from the source grid named as the source-
column will be mapped to the fields in the target grid DC.

Grouping field
A column in the source grid may be set as a grouping field. The rows in the source grid will be
grouped based on the value in grouping column. For each grouped row a row will be added to
the target grid.

Example:
Consider a Source grid as below. Set the GL Code as the grouping field to group and post to the
target grid.

Product GL Code Sale Qty


A1 G1 100
A2 G1 200
A3 G2 400

Consider filling a target grid as below


GL Code Sale Qty
G1 300
G2 400

Posting data – Gen maps


Genmaps are defined as part of tstructs. These are used to post data into another tstruct/form.
The tstruct in which the genmap is defined is called the source tstruct. The tstruct to which data
is posted is called the target tstruct.

When data is entered in the source form and saved, data is automatically posted into the target
tstruct/form. When data is edited, deleted or cancelled in source, the corresponding changes are
applied in the target too.

A field in the target may be mapped to a field in the source. So, when a transaction is posted
from source to target, the mapped field values are copied from source to target. Not all fields in
the target may be mapped. The autogen fields, fill-fields, expression fields & SQL fields in the
target will be auto populated. The validations in the target will be performed. In case of an
exception in the target, the source transaction also will not be saved.

Example 1:

Page | 24
Consider a tstruct that captures details about a customer. In the same application, let us create
another form in which all contacts are stored. When a customer is created, the contact person
names are posted to contacts form.

Customer Form
Name Details
Cname Customer Name
Address Simple text field with 250 char width
City Drop down from city master
URL
Email
ContactPerson Name of contact person
CPEmail Contact person email address
CPMobile Contact person mobile
CPDesignation Drop down from designation master
Contact Form
Name Details
ContId Autogen number
ContDate Expr – Date(). This fills today date in this field.
ContactName Name of contact person
ContactEMail Contact person email address
ContactMobile Contact person mobile
OrgName Name of organization
Desig Designation of the person.

Whenever a customer is created a record should be added to the contact form. To, achieve this
define a genmap as below

• Name – Post to contact


• Post type = post one transaction in target
• Post event = default
• Map (Target=Source)
o ContactName = ContactPerson
o ContactEmail = CPEMail
o ContactMobile = CPMobile
o Orgname = CName
o Desig = CPDesignation.

The contID and ContDate are automatically filled with appropriate values with a record is posted
into contact tstruct.

Page | 25
Post multiple records into target
Select “Post one transaction for every row in a grid DC’ option in Post type property. In this case,
for every row in the source selected grid DC, a row will be posted in target.

Example 2:

Customer Form
Name Details
Cname Customer Name
Address Simple text field with 250 char width
City Drop down from city master
URL
Email
DC2 Contacts grid DC. Users may enter many contact persons for one
customer
ContactPerson Name of contact person
CPEmail Contact person email address
CPMobile Contact person mobile
CPDesignation Drop down from designation master

To post one record for every contact person in the DC2 of customer form, set the post type as
post one transaction for every row in DC2. The rest of the genmap definition will be the same as
given in Example 1.

Control field
A control field controls the genmap posting. This is a field in the source tstruct. The genmap will
be posted only if this field value is T.

Example 3:
In the example 2, consider a case when only contact persons whose designations are manager
or general manager are to be posted to contacts form.

To do this, add a field in DC2 named, CanPost. This should be an expression field with
Iif(CPDesignation={Manager} | CPDesignation={General manager}, {T}, {F}) – This expression will
return T if designation is Manager or General manager else it will return F.

Set this field as control field in the genmap. So, only rows in the DC2 that have the given
designations are posted to the target.

If a customer data is edited and saved in customer form, automatically the changes will be
posted to contacts form. In case the designation is changed to a manager or general manager
from any other designation while editing a customer data, a new record will be posted to the

Page | 26
contacts form. In case a designation is changed from manager to executive while editing
customer data, the already posted record in the contacts form will be deleted.

Posting from a grid in source to a grid in target


Consider a tstruct with that has a grid and the target transaction also has a grid. Set the post
type to “Post one transaction in target”. Map grid fields in target to grid fields in source. Set the
target row as zero for all grid fields. In this case, one transaction is posted in target for every
record in source. Every row in grid DC in source is added as a row to the grid DC in target. A grid
field in target may be assigned to a non-grid field in source too. Grid fields in target cannot be
mapped to fields from 2 different grid DCs in the source.

Group field
This is used when data from a grid DC in source is posted into grid DC in target. When a group
field is set, the rows are grouped based on the value in the group column. For each group a row
is added to the grid DC in target. Numeric fields that are mapped from source grid to target grid
are cumulated group wise and posted into target grid.

Posting to specific rows


There may be need when a grid in the target tstruct should be filled with a fixed set of rows, The
data may need to be posted from source into a grid that is expected to have a prefixed number
of rows. In this case, each cell the target grid can be addressed while by selecting the target field
and setting a target row. When genmap posts data into the target the rows are added as
defined in the map.

Mapping constant values


Some fields or cells in the target may need to be filled with static values. The values are hard
coded in genmap. This can be done by selecting “%value” the source field. Enter the static value
to be assigned in the Source value in the map. Use %grid value when assigning a value to a grid
field in target in case when rows from a source grid are copied. Use $ID in case a hard coded
recordid value is to be assigned to a normalized drop down field in the target.

The mapping of constant values functionality may be better achieved by setting the constant
value in a field in source using an expression and assigning this field to the target.

Updating fields in DB tables – MD Map


Numeric data entered in a field in a form may need to be aggregated into a field in a maser
table. Similarly, a string or date field may need to be replaced into a field in a master table.
Some use cases for this may be to aggregate total sales in customer table from invoice form in,
replace the last sale date in customer form with invoice date, etc.

Page | 27
The form from which data is to be updated is called the detail form. The form to which the data
is to be updated is called the Master form. This update is defined using a Master-Detail Map
(MD Map).

The field to be updated is defined by selecting the master form and master field. The detail field
is the field from which data entered in the details form is updated to the master field.

The relationship between the master table and detail table is selected in the Master Search Field
and Detail Search Field.

An MD Map definition is converted into an “Update” SQL statement and posted to database. A
typical update statement looks like

Update <TableName> set MasterFieldName=MasterFieldName+DetailFieldName where


MasterSearchField=DetailSearchField.

Example 1:
Consider an invoice form as below
Name Details
InvNo Invoice No. Autogenerated
InvDate Date, Auto filled with today date
CustomerName Drop down from customer master
Address Fill based on customer drop down, save normalized.
Item details Grid DC storing in InvItemDetails table.
ItemName Drop down from item master
SaleQty Qty to sell
SaleUnit Unit of measurement – filled from ItemName drop down
Rate Selling rate
SaleValue SaleQty*Rate
Footer Non Grid DC
SaleValue Total({SaleValue})
Terms Terms of sale

Consider customer master form as below


Name Details
Name Drop down from customer master
Address Fill based on customer drop down
TaxNo Tax No.
TotalSaleValue Hidden numeric field.

To update the TotalSaleValue in Customer form from SaleValue field in invoice form, define an
MD Map as below

Page | 28
• Master form – Customer master
• Master field – TotalSaleValue
• Detail field – SaleValue
• Master search field – Default (This refers to the primary field of the customer master
table)
• Detail search field – CustomerName
• Update type - Add

In the invoice form, if the customer name field is not save normalized, then the
• Master Search field – Name in Customer form
• Detail search field – CustomerName in invoice form.

Control field
A control field controls the MD Map execution. The MD Map will be posted only if this field
value is T.

If the control field value changes from T to F, the already updated value will be reversed. If the
control field value changes from F to T, the value will be update.

Example 2:

In the example 1 given above, consider the invoice header has another drop down field named
Invoice type with drop down values “Proforma, Tax Invoice”. In run time, if the user selects
Proforma in this field, then the MD Map should not be executed.

Add a field named “CanUpdateMaster” with expression iif(InvoiceType={Proforma}, {F}, {T})

Execute on approve/reject
An MD Map can be executed only when the data in the form is approved or rejected. The MD
Map will not be executed when transaction is saved. This can be enabled by checking those two
options.

Append MD Maps (AMD Maps)


MD Maps will search the master table using the master search field and detail search field.
Matching records in the master are updated. If matching records are not found, a new record
can be added in the master table. This can be achieved by ticking the “Append” option in MD
Map definition.

MD Map definition as script


An MD Map can be defined as a script like as below

Page | 29
• tablename = Give name of table to be updated
• transid = transid of the form in which this MD Map is defined
• sourceframe = if all rows from a grid dc should be update give gird dc no here else give 1
• @mastersearchfield = detailserchfield
• +masterfield1= detailfield1
• *masterfield2= detailfield2
• append = true

The script is a collection of name-value pairs. Name-value pairs prefixed with @ symbol are
considered as master search field and detail search field. Name-value pairs prefixed with *
symbol is considered as master field and detail field with update type replace. Name-value pairs
prefixed with + symbol is considered as master field and detail field with update type add.

Tool bars in tstructs


A tstruct/form by default will have following buttons
• New
• Submit
• Search
• List
• Remove
• Options

There is a tool bar on top and a tool bar in the bottom. The user added options will by default
get added under options. The buttons to be displayed in the the bottom tool bar can be chosen.

Tracking changes/Audit trial


Tick the “track changes” property in form properties. The tracking can be enabled user wise or
field wise too. If tracking changes is enabled user wise, the changes done by only selected users
are tracked. Similarly, the changes done to only selected fields can be enabled. The changes are
stored in the history table. The name of the table is <TransId>History. For example, if the name
of the tstruct (transid) is ‘empm’, the history table name will be empmhistory. This table can be
used to show history of changes are reports. It may also be accessed through the history button
in tstruct forms in run time.

IViews – reports & Lists


About IViews in Axpert
The result of an SQL statement is displayed as a tabular report. The SQL may have parameters.
Parameter values are accepted from user at run time. Each column may have hyper links which

Page | 30
may be used to drill down to another IView or open TStruct/form along with form data. Scripts
may be written to do special functions in an IView. These may be executed on button click.

IView parameters
Parameters SQL are automatically considered as IView parameters. User can enter value for each
IView parameter. Each parameter value will be auto populated or accepted from user based on
the definition made for each parameter.

The parameter values may be calculated using a formula that can be provided in the expression
property. The expression may use other parameter names as variables. App variables may also
be used in expressions.

Use validate-expression property to validate the user input for the parameter. If valid values are
not provided, the IView will not bring result.

Parameter values may be selected from a drop down. The drop-down values may be populated
from a SQL result. The SQL text can be defined in the SQL property. Other parameters & app
variables may be used as SQL parameters. A pick list is used when the SQL result is expected to
bring more a few thousand rows. In this case, the data will be fetched from database in blocks of
a few hundred records depending the characters entered in the parameter.

Multiselect parameters
The IView SQL should be joined with an Axpert table named axpselectionc. This table will be
populated with user selected values in a multi-select parameter.

In the params tab, add a parameter. Set its mode of entry as “Multi select”. The multi-select is
like a drop-down parameter. It allow users to select more than one value. The selected values
are added as rows to the “axpselectionc”. The selected values are stored in the “Selection” field
in this table.

Example:
Consider an IView that displays Employee details based of selected employees.
IView SQL - Select EmployeeName, Gender, Age, GrossSalary from EmployeeMaster A,
AxpSelectionC B where A.EmployeeName = B.Selection

Add a parameter name pEmpName. This name can be anything. Set mode of entry as Multi
Select.
Parameter SQL – Select EmployeeName from EmployeeMaster order by EmployeeName

Page | 31
IView columns
The SQL columns will automatically be added as columns in the IView. Select any column and
change its column properties. Columns may be hidden. The table kind of a view displayed in top
can be used to resize column width and reorder them. New columns may be added to the IView.
The values for the user added columns may be set using column expressions. The expressions
may use other column names as vars and app vars.

Hyperlinks
The values in a column may be displayed as a hyperlink. The option to create a hyper link under
the options button that is displayed on each column in the top table in the column section. The
hyper link may be configured to load form data, open a tstruct or another iview. The data from
the iview columns/params can be passed as parameter. The parameter may be assigned to a
field in a selected tstruct or a parameter in a iview.

IView properties
The iview properties are used to change the look and behavior of an IView. The group field can
be used to group rows and show as a one row. All rows that have the same value in the group
field will be shown as one row in the IView.

Load TStruct property can be selected to load a form from the IView. In this case, the IView tool
bar will have an “Add New” option. This will load the selected tstruct form in new mode for user
to add new data. It will also provide a hyperlink to load a record in edit mode.

Pivot in IViews/Reports
Tabular reports are collection of rows and columns. In a pivot report, the data at the pivot
column will be transposed from rows into columns. The cell values that follow the pivot column
will be plotted as values in the transposed columns.

This is defined in an IView by naming the pivot column as “pivot”. The IView should be ordered
by the pivot column to ensure same values in pivot columns listed together.

Example:
Consider report as below
Month Product Group Sale Qty Sale Value
Jan Electronics 500 50,00,000
Feb Electronics 3000 18,00,000
Mar Electronics 1500 20,00,000
Jan Mobile 400 45,00,000
Feb Mobile 3200 20,00,000
Mar Mobile 1100 18,00,000
Jan Wearables 600 58,00,000

Page | 32
Feb Wearables 3500 28,00,000
Mar Wearables 1800 30,00,000

If the above report is pivoted at Product Group, the result will be


Month Electronics Mobile Wearables
Qty Value Qty Value Qty Value
Jan 500 50,00,000 3000 20,00,000 600 58,00,000
Feb 3000 18,00,000 400 45,00,000 3500 28,00,000
Mar 1500 20,00,000 3200 20,00,000 1800 30,00,000

Tool bars in IViews


IView will have following options by default
• New (if a tstruct is attached to the IView)
• Search
• Data
o Parameter
o Add view
o Graphs
• Options
o User added options

Row options
Add a column named AxRowOptions in the IView. It may be added as part of the IView SQL. The
value should be a string as below
(Name1),(Caption1),(hyper link name or script name),(MaterialIcon1) ~
(Name2),(Caption2),(hyper link name or script name),(MaterialIcon2)

This definition will provide the given set of an options for every row in the row options column.

Scripts
About Scripts in Axpert
Scripts are used to achieve complex tasks. A script is written using the Axpert functions. A script
is given a unique name. Scripts can be executed on events or on a button click. See the section
on Axpert Jobs to execute scripts background as scheduled jobs.

Page | 33
// symbol is used in scripts to write comments.

Assignments in scripts
Variable Name=Value.
Examples:
Mark=100
MarkPercent=Mark/100
ExamResult=iif(MarkPercent<35, {Fail}, {Pass})
ExamDate=MakeDate({10},{10},{2021}) //returns 10/10/2021 as date var

Loops in scripts
While Condition
Statements
If condition
Break
Endif
EndWhile

Example1 1:
I=1
TotalValue=1
While (i<100)
TotalValue=TotalValue+i
I=i+1
EndWhile
//This function sets value to DisplayTotalValue field.
SetFieldValue({DisplayTotalValue}, 1, TotalValue)

Example 2:
Looping through a SQL Result. Consider an SQL that returns project names from project master.
Let us write a loop to make a comma separated string of all project names

//FireSQL executes SQL and the result can be accessed in the given name in 1st param.
FireSQL({PNames}, {Select ProjectName from ProjectMaster order by ProjectName})
While (!EOF({PNames})
//SQLGet reutrns the given field name value from current row in PNames Dataset
Name=SQLGet({PNames}, {ProjectName})
ProjectNames=ProjectNames+Name
GoNext({PNames})
EndWhile
SetFieldValue({MyProjects},1, {ProjectNames})

Page | 34
If conditions in scripts
If Condition
Statements
Else
Statements
EndIF

Example:
//checking if project name is empty, MyProjects field is set with “There are no projects”.
If ProjectNames={}
SetFieldValue({MyProjects}, 1, {There are no projects})
Else
SetFieldValue({MyProjects}, 1, ProjectNames)
EndIf

Major Axpert functions


Loading a form
Use function LoadForm(Transid, Params, DisplayMode, RefreshOnClose) in a script. If the script is
assigned to a button, on button click the form will be opened in new mode.

DisplayMode – ‘d’ to show form in the same frame. ‘p’ to popup, can be popup. ‘n’ to open in a
newtab.

RefreshOnClose – Used in case of popup. Set to true to close popup on close.

This will open the given tstruct in new mode. The Params is a string that contains name=value
pairs separated by ‘~’. The field values will be assigned at the client level. If it requires server
call, it will be made to fill values to dependent fields.

Load a form along with data


Use function LoadFormAndData(Transid, Params, DisplayMode, RefreshOnClose) in a script. If
the script is assigned to a button, on button click, a form will be displayed along with data in
edit mode.

DisplayMode – ‘d’ to show form in the same frame. ‘p’ to popup, can be popup. ‘n’ to open in a
newtab

RefreshOnClose – Used in case of popup. Set to true to close popup on close.

Page | 35
Params – A string that will be used in the where condition of the SQL that will be used to search
for a record from the tstruct primary table. Any field in the primary table can be used in the
condition. It may also be set as “recordid=:value”.

This will open the given tstruct along with data in edit mode. The field values will be assigned at
the client level. If it requires server call, it will be made to fill values to dependent fields.

Loading a page
Use function LoadPage(PageName, Params, DisplayMode, RefreshOnClose) to load a page in a
script. If the script is assigned to a button, on button click at run time, the given page will be
displayed.

DisplayMode – ‘d’ to show form in the same frame. ‘p’ to popup, can be popup. ‘n’ to open in a
newtab

RefreshOnClose – Used in case of popup. Set to true to close popup on close.

Params – Name-value pairs that may be used as parameters for the widgets in the page.

This will open the given page.

Clearing a form
Use function ClearForm(Transid, Params) in scripts. If the script is assigned to a button, on
button click in run time, the form data will be cleared.

It clears all field values & uploads and puts the form in new mode. In case a script is assigned to
an “On New” event, that script also will be executed. The field values given in the Params (as
name-value) pairs will be assigned. If required, FormLoad service will be called.

Cancelling form data


Use function CancelTransaction(Transid, RecordId, ShowResult) in script. If the script is assigned
to a button, on button click in run time, the form data record will be marked as cancelled in the
database. Such a transaction will be considered as deleted and can be filtered in reports so that
cancelled records are not shown in reports.

Cancels the record given by the recordid. Success/error messages will be displayed if
ShowResult Param is true.

Response is a success message or error message.

Page | 36
Delete a record in form
Use DeleteTransaction(Transid, RecordId, ShowResult) in script. If the script is assigned to a
button, on button click in run time, the data will be removed from all database tables. Deletes
the record given by the recordid. Success/error messages will be displayed if ShowResult Param
is true.

Response is a success message or error message.

Refresh Field values in a form


Use Refresh(Names, WithDependents) in script. If the script is assigned to a button, on button
click in run time, it refresh the field value. In case of SQL field, the data will be fetched again
from database. Expression fields will be evaluated again and the new value will be set to the
field.

Names will contain Field1~<RowNo>, Field2~<RowNo>, … If RowNo is set to zero for a grid
field, all rows in that column will be refreshed.

Returns a JSON string of field values after refreshes. If WithDependents is true, it will return
along with dependent field values.

Load an IView/Report
Use function LoadIView(IViewName, Params, IsPopup RefreshParent) in script. If the script is
assigned to a button, on button click in run time, the given IView will be displayed.

DisplayMode – ‘d’ to show form in the same frame. ‘p’ to popup, can be popup. ‘n’ to open in a
newtab.

RefreshOnClose – Used in case of popup. Set to true to close popup on close.

Params – Name-value pairs that may be used as parameters for the widgets in the page.

Navigate to an external page


Use function HyperLink(URL) in script. If the script is assigned to a button, on button click in run
time, it will navigate to the given URL.
Closing a popup window
Use function CloseWindow() in script. If the script is assigned to a button, on button click in run
time, it will close the popup window.

Hiding controls in a form


Use function Hide(Names) in script. If the script is assigned to a button, on button click in run
time, one or more components in the form can be hidden. This may be used in events in a form.

Page | 37
The names param has one or more fields, dc, buttons, labels thant needs to be hidden. The
given components will be hidden.

Unhide controls in a form


Use function UnHide(Names) in script. If the script is assigned to a button, on button click in run
time, one or more hidden controls in the form will become visible.

The names param has one or more fields, dc, buttons, labels thant needs to be hidden. The
given components will be made visible.

Enable components in form


Use function Enable(Names) in script. If the script is assigned to a button, on button click in run
time, one or more read-only controls in the form will be editable.

The names param has one or more fields, dc, buttons, labels thant needs to be hidden. The
given components will be disabled.

Disable components in form


Use Disable(Names) in script. If the script is assigned to a button, on button click in run time,
one or more disabled controls will become editable.

The names param has one or more fields, dc, buttons, labels thant needs to be hidden. The
given components will be disabled.

Change field captions at run time in forms


Use SetFieldCaption(Name, Caption) in script. If the script is assigned to a button, on button
click in run time, the given new caption will be assigned to the field.

Set focus to a component in a form


Use function SetFocus(FieldName, RowNo) in script. If the script is assigned to a button, on
button click in run time, sets the focus to the given component.
Showing popup messages in forms
Use function ShowMessage(MessageText, MessageType, MessageOptions) in script. If the script
is assigned to a button, on button click in run time, to popup messages. The MessageType can
be Confirmation, Warn and proceed, Exception. In case of a confirmation message, the message
options will be displayed as buttons. The selected option will be returned as the result.

Send EMails
Use function SendEMail(ConfigName, Param) in script. If the script is assigned to a button, on
button click in run time, to send an email.

Page | 38
This function sends an email as per the configuration made. Email configurations can be done in
the “Configure Emails” option in Utils in Developer site. Check out the section on “Configure
Emails” section to understand the configuration.

Param – The Param should contain recordid for email from tstructs. For Email from IViews, it will
contain comma separated name-value pairs of iview param names & param values.

To send emails without a configuration, set the following vars in script before this function call
• Axp_EMailTransid
• Axp_EMailIView
• Axp_EMailTo
• Axp_EMailCC
• Axp_EMailBCC
• Axp_EMailSubject
• Axp_EMailAttachment
• Axp_EMailBody

The status of Emails sent can be see in the Email Jobs console that is available in the Admin
console option in Axpert run time.

Email Configuration
Emails are configured using the “Confiure Email” option under Utils in developer site. There can
be many email configurations that are identified by a unique name.

Email Source –
• To email tstruct/form data, choose the “TStruct” option
• To email an iview/report, choose the “IView” option.
• To send an email for every row in a IView result, choose “IView rows” option.

In all the fields related to email like Email To, CC, BCC, Subject & Body, data from the selected
tstruct or iview can be tagged. The tags are written as : symbol followed by the
field/param/column name.

The attachment field –


• In case of Emails from forms, the file-upload field may be embedded to send embedded
files as attachments. Use P__* to send all print forms related to form data. Use P__<print
form name> to send a particular print format as attachment.
• In case Source is IView – Drop down options (IVIew as PDF, IView as HTML, IView as MS
Excel)
• In case of emails from IVIew rows – Value cannot be entered.

The body of an Email may contain a :IVIewAsHTML tag. This tag will be replaced with the IView
result in the email. This is applicable only when source is iview.

Page | 39
Printing forms/reports
Use function AxPrint(Source, StructureName, Param, FileServerName, FileType, DirectPrint) in
script to print forms. The print forms are created using Fast reports. Refer to the Fast reports
section to know more about formatting fast reports.

This function will send print as per the given definition or parameters.
• Source – t - tstruct, i - iview or r - iview row
• SturctureName – Name of tstruct or IView.

• Param – If tstruct, this should contain the recordid of the form data that is to be printed.
For IViews, it will contain comma separated name-value pairs of iview param names &
param values.
• FileServerName – This is the name of the file server that is configured through “Define
Servers” option under utitlity.
• FileType – PDF, HTML or Excel.
• DirectPrint – ‘T’ if to be directly printed. This is not applicable when source is iview row.

The configuration parameters can be changed before making this function call. This is done by
setting the following variables.
• Axp_PrintToURL
• Axp_PrintURLAuthentication //Comma separated name,password
• Axp_PrintFIlePathAndName
• Axp_FileType//AsHTML/AsPDF
• Axp_DirectPrint //True/False, applicable only for IView & TStruct.

The file name along with the folder name will be returned by this function. The status of all print
jobs sent can be seen in the Print Jobs console that is available in the Admin console option in
Axpert run time.

Data Import
Use function AxImport(ImportDefName, SourceFilePathAndName) in scripts to import data. This
function will import data as per the definition made in the import definition from the given
source file.

The source file is given along with path. The results of an import job can be viewed in Import
Jobs Console in the Admin console. The source file may be an excel file or CSV file. In case of
CSV, the separators may be , or : or |,

Import is done in the following steps –


1. Uploads the source file into a temporary DB table.
2. Optionally – The table data can be transformed into any other data format as per need
using a stored procedure. The stored proc should transform data and store The fillgrids,
genmaps, MD Maps or scripts associated with DB events in this tstruct will be executed

Page | 40
while import. This process is time consuming and may be set to work as a multi thread
application.
3. The results are stored into AxpImpJobs table (contains the status of each job and error
message) and AxpImpFailedRecords table (contains the list of records that could not be
imported due to errors. The records in these tables can be viewed through the admin
console option in Axpert run time options button. Further, IViews may be created from
these tables to provide users an interface for managing imported records.

Import definition
Import definition is available as an option in Utils in Axpert Developer site. The definition
properties are
• The name given in this definition is used as a parameter in the AxImport function.
• The tstruct/form is selected. Data from source file is imported this form.
• Map in file – Check this if each column heading in the source file contains the field to
which the column is mapped.
• Map source to fields – Select the field names into which the column values from source
are mapped. The 1st column in source is mapped to the first selected field, to second
column is mapped to 2nd selected field and so on.
• Primary field – The primary field in the selected tstruct.
• Group field – The rows in the source file are grouped based on the column that is
mapped to this field. The grouped rows are posted as one transaction.
• Thread Count – When importing large amount of data (5000+ rows), the import can be
speeded up by increasing the thread count. The maximum can be 9.
• Process mode – Select “Process with errors” to push in all records. The errors will be
available in the import console. These may then be corrected and saved. Select “Only
valid data” to import only valid records. The errors can be seen in the admin console.
“Stop on error” will abort the import process when an error is encountered.
• Procedure name – The name of the procedure that is the used for transformation of
source data into a different table format as per need. The data from the transformed
temporary table will then be imported into the tstruct.
• Std width – Fields in the temporary table are created with the data type and width of the
mapped field. If a column in source is not mapped to a field in this tstruct, then an
exception is raised. This exception can be avoided by un-checking the “Bind to tstruct”
and “Ignore field exception” properties in import definition. Such columns will be created
in temporary table as string fields with width as given in the “Std width” property.
• Text qualifier – Check this if the source file consists of comma separated values in which
the values are within double quotes.

Example 1:
Consider a tstruct as below
Employee Name [ ] Gender [ ] Age [ ] Designation [ ]
Qualification [ ]

Page | 41
Prior experience
Company name Designation From To

An excel sheet as below can be a source


Prem Male 30 GM MBA Just Software Manager 2014 2018
Prem Male 30 GM MBA Control systems Developer 2009 2014
Niya Female 23 Sales BBA RM Systems Sales 2018 2019
exec trainee

For importing the above source file, set the EmployeeName as the primary & group field. On
importing, the record for Prem will be imported with 2 rows in prior experience grid. Record for
Niya will contain one row in the prior experience grid.

Map in file can be enabled if the first row contains the field name to which the column is
mapped.
Empname Gender Age Desig Qual Orgname Priordesig Fromyear toyear
Prem Male 30 GM MBA Just Software Manager 2014 2018
Prem Male 30 GM MBA Control Developer 2009 2014
systems
Niya Female 23 Sales BBA RM Systems Sales 2018 2019
exec trainee

In case the file has fields that are not in tstruct, if the “Bind to tstruct” flag is checked, an
exception will be raised. If this flag is unchecked, a new field will be added to the temp table to
which the data from source will be uploaded. The field type char and the width will be set as
provided in “Std Column Width” field in the definition. Similarly, if the a field in the excel is
mapped to a field that is not in the tstruct, an exception will be raised while importing. The
exception can be ignored by checking “Ignore field exception”.

Mathematical functions

String functions

Date functions

Page | 42
Axpert jobs
Axpert jobs are defined to run schedule background jobs. Background jobs can be configured to
run on a specific day or in specified time intervals. Use the Axpert Jobs option in Axpert
Developer site to create an Axpert job. The function that is to be performed by a job is defined
as a script.

Scripts can be used to


• import data
• export data
• upload/download files
• call third party API
• run database procedures
• push notifications,
• send emails
• and many more…

All these functionalities are available as Axpert functions. Refer to the Axpert functions section to
understand more on this topic.

Call third party API


Use function ExecuteAPI(APIDefinitionName) in script to make an API call. As part of the API
definition the URL, header string, parameter string & request string can be set. These strings are
constructed based on the requirement of the third party API. The data can be read from Axpert
database using FireSQL & SQLGet functions. The data can be transformed either using a
database procedure. Simple string constructions can be done using Axpert scripts.

The result of every API call will be updated into database table name AxAPIJobDetails. This result
can be seen in admin console.

Axpert Cards (Widgets)


Widgets are defined as Axpert Cards. The widgets will be displayed in the main page after the
user logs in. Each card is assigned to one or more roles. The type of widget displayed depends
on the card type.

A KPI card will display a single value along with the card name. The value in the first cell in the
SQL result of the given card SQL will be displayed as value.

Page | 43
App variables and app params may be used as parameters in SQL statements.

A Chart card will display an SQL result as a chart. The type, look and feel of chart can be set
using the properties in the card definition.

A list card will display the card SQL result as a list. These can be used to show small lists of data.
If SQL results are large, the loading time will be impacted there by reducing app performance.

Menu & modern menu cards are used to show menu items as widgets. The child menu within
the menu will be shown in drop downs.

Select the roles to which the cards are applicable. On login, all the cards that are applicable to all
the roles of the user are displayed in their home page.

At run time, users have option to hide or re-order the cards based on their preferences.

HTML Plug-ins
HTML pages can be added to Axpert. These pages can be accessed from the Axpert menu. Use
the HTML pages option in Axpert developer site.

The image files that are required for the HTML can be uploaded in the “Upload images”
property in HTML Page definition.

The HTML can be entered in the HTML editor in the next section. Use the buttons Add CSS and
Add JS to add CSS and JS files. These are automatically referenced in the HTML.

Axpert API functions can be used in the Java script files. Refer to the Axpert API section to know
about Axpert API that may be used in your Java script files.

Users, roles & responsibilities


User logins, roles and responsibilities can be created in Axpert run time. These options are
available in Admin console.

Create responsibilities by giving a name. Tick the menu options to which this responsibility has
access. Click on the hyper link of any tstruct or iview to provide field level access rights. The
access rights can be provided for fields & buttons.

Create roles and assign one or more responsibilities. The home page for a role may be changed
to point to a custom HTML page. The access rights defined in all responsibilities are allowed for
the user.

Page | 44
Users are assigned roles. The role assignment may optionally be done between 2 dates. The
menu will be dynamically generated based on the access rights of the roles assigned to the user.
The branch to which a user belongs may be selected. Similarly, the locations to which the user
has access are also assigned. The data is filtered to show only data related to their branch and
location.

Work flow
Work flows are enabled at the tstruct/form level. This property is available in form properties.
The forms for which work flow is enabled are listed in work flow definition screen. Select the
form and click on the New Work flow button.

A form can have multiple work flows. A condition should be set for each work flow definition.
This is mandatory if there are more than one work flow for a form. There can be only one work
flow for a form without any condition.

At each level the role, the rights of this role, max time to respond and action to do in case of
inaction are set.

When a transaction is created for first time in run time, it is sent for approval to the role given in
level 1 in the work flow definition. If there are more than one work flows for this form, the work
flow to be used is selected based on the given condition. On approval at a level, it is sent to the
role in the next level till the last level is reached. Once the last level approves, the transaction
data is marked as Approved.

There may be more than one user in each role. For example, there may be many managers,
project managers etc in an organization. When data is sent to a role for approval, it is sent to all
users.

Instead, the data should be sent only to a particular user in that role based. For example, a leave
application may need to be sent only to the manager of the branch in which the employee is
attached.

The exact user name may be got using an SQL statement. The role that is selected in the work
flow level will be available in to_role variable. This may be used as a parameter in the SQL. The
SQL to be used to get the user name should be assigned to the variable named m_workflow.
This can be done in a script that is set in “On approve” or “On reject” or “On form load” event.
Additionally, the status of the transaction in the prior level will be available in wf_status variable.

The wf_status will contain the following values


• Approved -Final approval
• Created
• Rejected

Page | 45
• Review
• Approve – when approved in prior level.
• Return

Set the next level of approval to wf_applevel variable in script to override the flow. Whatever
level is set in this variable will be used as the next approval level.

Axpert API
The core layer of Axpert are a collection of web and REST services. These services can be
accessed at the same URL where Axpert is deployed. Use the Axpert API request and response
string formats using the “Axpert API” option under Utils in Axpert developer site.

Sample Java Script code to call Axpert API


Axpert API may be called from any programming/scripting languages like Java script, Android,
Java, Dot net, etc.. Some of the sample scripts are given below.

API call to save data into a tstruct


This call posts data into a tstruct named ‘rcatt’. The given JSON is only a sample. It should be
replaced with field names of the tstruct and required field values.
$.ajax({
url: "../../aspx/axinterface.aspx/TstructSaveData",
type: "POST",
contentType: "application/json",
data: JSON.stringify({
jsonInput: '{"transid":"rcatt","UserLogin":{"no":"1","type":"0","data":{"latitude":"' + Latitude +
'","longitude":"' + Longitude + '","inout":"' + inout + '","inremarks":"' + inremarks +
'","outremarks":"' + outremarks + '" }}}'
}),
cache: false,
async: true,
dataType: "json",
success: function (data) {
if (data.d == "") {
return;
}
var resval = data.d.split("*$*");
//*************************************
},

error: function (response) {

Page | 46
//*************************************
}
});

API call to get application variables


$.ajax({
url: "../../aspx/axinterface.aspx/GetGlobalVar",
type: "POST",
contentType: "application/json",
data: JSON.stringify({
strVar:
'm_empindate^m_empintime^m_empinlatitude^m_empinlongitude^m_empoutdate^m_empou
ttime^m_empoutlatitude^m_empoutlongitude^m_emprecid^m_nickname'
//this is a sample list of variables for which we need the values from Axpert. These will vary as
per need.
}),
cache: false,
async: true,
dataType: "json",
success: function (data) {
if (data.d == "") {
return;
}
var splitData = data.d.split('^');
//your code goes here. The result will be provided as a string with values for all variables
separated by ^.
},

error: function (data) {


//your code goes here
}
});

API Call to get an IView result


$.ajax({
url: "../../aspx/axinterface.aspx/GetIViewData",
type: "POST",
contentType: "application/json",
data: JSON.stringify({
ivName: 'iview1', ivParams: '', pageNo: '1', recsPerPage: '0'
}),
cache: false,

Page | 47
async: true,
dataType: "json",
success: function (data) {
if (data.d == "") {
return;
}
//your code goes here
},
error: function (response) {
//your code goes here.
}
});

API Call to get an IView parameters


$.ajax({
url: "../../aspx/axinterface.aspx/GetIViewParams",
type: "POST",
contentType: "application/json",
data: JSON.stringify({
ivName: 'iview1'
}),
cache: false,
async: true,
dataType: "json",
success: function (data) {
if (data.d == "") {
return;
}
//Your code goes here
},
error: function (response) {
//your code goes here
}

Application variables & Parameters


Application variables can be added by defining the variable name and variable value. The
variable value may be constant value. Data from database may be read and assigned to these
vars. Use FireSQL & SQLGet functions in the script.

Page | 48
One or more application parameters can be defined. The values for these parameters will be
accepted from user after login. The param window can be accessed from the right top

The following are the list of default application variables –

• Username – Logged in user name


• Userrole – logged user roles, comma separated role names
• Connectionname – name of the connected schema.
• Axp_language – selected language.
• Axp_timezone – time zone from of the server.
• Siteno – This contains the logged in site no. This is useful only in case of multi-site
deployments with data synchronization.

Publish Axpert apps


Enterprise class apps need separate instances for development, testing and production. The
publish option can be used to move the meta data of forms, reports or any of the Axpert
components from one server to another. The URL, connection string & the database connection
parameters are accepted for each server. Each server is given a unique name. Any number of
servers instances & schema can be added.

User can select the Axpert components like tstructs, iviews, cards, HTML pages, Db objects etc
and publish to a selected server.

Axpert maintains a history of all the publish that has been done. The list of options can be
filtered to show only the changed objects after the last publish. This eases the job of publishing
changes across instances and schemas.

Database console
This option lets users access the database directly from the Axpert developer site. This will
provide access to the developer to all database objects like tables, views, triggers, procedures
etc. Developers will be allowed to create new database objects or edit the existing ones through
this option.

Page | 49
In-Memory Database console
Redis is the in-memory database used in Axpert. All the pre processed meta data and frequently
accessed data are stored in Redis. The key names are generated based on schema, role,
language, axpert object name. This console displays the key details related to every Axpert
object. Selected keys can be cleared by deleting them.

Axpert Mobile
Download Axpert from Google play store or Apple store. On installation of this app, you can
connect to your Axpert schema by providing the URL & Schema details. Alternatively, login to
the Axpert application on a desktop through a browser. Open the QR code for the application
under the settings option in Axpert run time. Scan the QR code from the mobile.

The application can be connected to by typing in client code. The client code for an application
will be available below the QR Code when logged in through web. The client code can be
generated through the get client code option in the QR code screen. Users can get the client
code from the administrator or from the QR code screen in web application.

Push notifications
Content will be shortly updated

Axpert on-premise installation


The content will be updated in a few weeks. Till then connect with Agile Labs support team to
get it installed in the local instance. You can use the Contact Us link in the www.agilecloud.biz to
send a request for on-premise installation.

Page | 50

You might also like