Reports are made easily with SQL programming language and other EMDI commands that are implemented on the comments.
Variables that you can use in the code:
(in “where” command)
:apo starting date
:ews final date
Report description 1st parameter from accounts
Report code 2nd parameter from accounts
:param1 3rd parameter from accounts
:param2 4th parameter from accounts
:search search for forms that search is checked
:orderby it is added for sorting instead of “order by” command
–nodecimals– unlimited decimals
–combo– drop-down list
Fields in the code
(used in the select command)
doc sales line number “Aa” (creates a button that opens sales in the selected document)
cus client line number “Aa” (creates a button that opens the selected customer)
pro product line number “Aa” (creates a button that opens the selected product)
prd product line number “Aa” (creates a button that opens the documents of the selected product)
ksq its result is used in the update script (creates a button that opens an editor for data editing)
eml the e-mail to be send|Name|Value|E-invoice link|Shipping tracking number (creates a button that sends an e-mail)
sms the mobile to be send|Name|Value|E-invoice link|Shipping tracking number (creates a button that sends sms)
NEXT VALUE FOR “gen_counter” : line number
Up to 2 scripts can be executed, delimited with “;”.
In the 1st example, we can edit and save selected customer’s fields. It is important to always include the key field “Aa”.
select * from "pelates" where "Kvdikos"=:ksq
The 2nd example contains 2 scripts. First, a new line is created (if not already exists) on the table “kinhseis” and then we select to show 2 fields from the same table, “Order stage” and “Notes”. In this case, we also use the the key field “Aa” (“kinhseis”.”Grammh”).
UPDATE OR INSERT INTO "kinhseis" ("kinhseis"."Grammh","kinhseis"."aapar") values (:ksq,(select first 1 "grammes"."Aapar" from "grammes" where "grammes"."Aa"=:ksq));
select "kinhseis"."Uesh" "Order stage","kinhseis"."Grammh" "Aa","kinhseis"."custom1" "Notes" from "kinhseis" where "kinhseis"."Grammh"=:ksq
Custom fields from the update script
The “Field for editing” is used to set a list of options in the field we want.
In “Field options” we write the options for the list, separated by comma (“,”). It’s not compulsory.
The “Reading field” is used to get the contents of the field we want. It’s not compulsory.
By using the “Link” field, we can execute an external link or application.
When a web link is called, we can use the following variables:
#VL1: edit field
#VL2: reading field
When a local programm is called, there is no use for variables because they are being sent as 1st and 2nd parameters.
C:\Program Files (x86)\company\mysoftware.exe
The first line can contain EMDI commands as comments in SQL and is automatically created whenever you make a change:
--search-searchtitle-asearch-searchtitle-graph x-xx-graph y-yy-graph labels-xxlabel-from-fromvalue-to-tovalue-step-stepvalue
Where searchtitle, the title of the search field (2 fields).
If you want to create a graph, then where “xx” you input the field for axis x and “yy” the field for the axis y and “xxlabel” the title of the field that is on the axis x.
To create loops, fill the fromvalue, tovalue, stepvalue.
To count the lines we use the following variable after the select:
NEXT VALUE FOR "gen_counter" AS "Row #", ...
In order to paint lines with colors (yellow,red,green) we can define a variable that takes up to 9 values delimited with comma “,” :
Lines are colored accordingly as follows:
A drop-down list could be created where its each option inserts a code into the variable –combo– from the corresponding psql file.
In the following example, we create 2 options, DELIVERY and RESERVED:
When the user selects DELIVERY then the content of sql1.psql file is inserted in place of –combo– variable.
psql file example:
or whichever sql code piece we would like to implement in our main code.
The psql files are saved in the same folder as the reports (usually C:\Program Files (x86)\SBZ systems\EMDI\reports).