Programming Language

4GL QLX, a programming language

"...don’t think how to do it, just think – what for..."

QLX is a high-level programming language. Its syntax has been simplified as much as possible in order to make it an optimal tool for the Gardens Builder application. As assumed, it should enable not only programmers but also specialist consultants to develop the application. The main advantage of the QLX language is the fact that it is a highly optimised and specialised tool for developing business software. QLX is simple, as it consists of basic syntax and extensions: the SYS library and methods used for managing DS objects.

 Developer Window Example

 QLX – Basic syntax

:types

System :
o Boolean,  Integer, Decimal, Date, Text, BLOB, Rec, Object

Former custom types and their counterparts in system types ():
o Number (Decimal), Option(Integer), String (Text), Field(?), COM (Object)

:Type conversion

Conversion during the evaluation of operations on two variables is performed in the following sequence (starting from the lowest type):

Boolean, Integer, Decimal, Date, Text, Blob,  Rec Object

For two types, conversion is performed in an ascending order.

When writing, conversion is possible in all orders.

It can be assigned as an operation e.g.: l = ((p=5)-4); or l = p = i = 5;

:loops

FOR (iEx = minValue;maxValue ) { statement }
WHILE ( bEx ) { statement }

:conditional statement :

IF ( bEx ) { statement }
ELSE { statement}

:operators :

& - i bEx= bEx1 & bEx2

| - lub bEx= bEx1 | bEx2

<> - różny bEx= bEx1 <> bEx2 lub bEx = !(bEx1 = bEx2)

! - negacja bEx= ! bEx1

:return function value and break:

EXIT ( Value, [break] );

:obsługa wyjątków :

TRY { statement }

:commit data base transactions :

COMMIT ( [tConnection, bClose] )



QLX – Basic GUI enhancements

ERROR ( tInfo );

System :
Breaking a single code path and database transaction (if not included in the TRY statement, the message in GUI)

tInfo – Error Message

DIALOG ( tInfo ,[ iType ] ) : iModal

Information and dialog boxes

tInfo - Information

iType – Dialog Box Type

STATUS ( ['O','U','C'], tId, tInfo, iSize )

O – Open status windows or adds an additional status panel

U – Update the status

C – Close status windows

tid – Status ID

tInfo – Status label

iSize - Max. status bar

INFO ( tInfo , [clear ] )

Add a line in a "Info" descriptive window.

iInfo - message,

clear - if clear = 1, the content of the Info window is cleared before a new line is added.

RUNWIN ( tName , [iType, iReportType ] )

Run a window or report (display, print, export the window)

CREATE ( COMobject )

Create an object batch COM, COM+



QLX - Sample DS methods

DS:

 

 

 

_ASXML :Text

Generates XML with Ds.

 

_DSNAME :Text

DS name 

 

_FIRSTFIELD :fname

Returns the name of a first structure field if the structure is constructed dynamically. 

 

_FROMXML(Blob, [Bool recid])

Parsers XML to DS.

 

_GETDS(fname,Rec) : Bool

DS nod search.

 

_GETFIELD (fname):TextValue

Returns a field value based on a selected field name.

 

_GETTYPE(fname) :text

Returns a field type based on a field.

 

_MODIFYALL(fname, textvalue)

Modifies all values in the field for all selected records.

 

_NEXTFIELD :fname

 Returns the name of a subsequent field if the DS structure is constructed dynamically.

 

_SETCONN(conn)

Changes a data source. Data for the DS structure can be retrieved from multiple databases.

 

_SETFIELD(fname,textval)

 Sets the field value based on a field name. 

 

_SETRANG(fname,val)

Sets the second filter level.

 

_SORT(f1,f2,...)

Sorts structures in the system memory regardless of data base sorting.

 

_SUMFIELD(fname): decimal

 Returns the sum of values in a selected field.

 

_SUMFIELDS (SumDS,[fname 1,...,fname n]);

Creates tempds - sumds excluding selected fields; uses all decimal fields.

 

CLEAR

Clears all values in a selected record.

 

COPY(rec, noisnert)

Noinsert 1 – Copies only one level and does not enter 0 into the database; by default, it copies all structures from records to a similar structure with substructures, inserting records into a database.

 

COUNT(memonly bool)

Returns the number of records.

 

CREATEDS

Creates a data structure in a selected database.

 

DELETE :bool

Deletes a selected record including its substructures.

 

DELETEALL

Deletes all records including their substructures.

 

EXPORT(FileName,[CSV,XML,TAB], [header str])

 Exports data stored in the DS structure into a file. 

 

FIND( Fname,val ,[bConti]):bool

Searches a text in a field: CS bConti : 0, brak - od poczatku, 1 - od miejsca

 

FIRST : bool

Places the cursor in the first data record.

 

GETFILTERS(fname):text

Returns existing filters set for DS data.

 

IMPORT(FileName,[CSV,XML,TAB], bool recid, [header str])

Imports data to a DS structure from a file.

 

INSERT

Inserts a selected data record into a database.

 

LAST : bool

Inserts the cursor in a last data record.

 

LOOP ([memonly bool, reverse]) {}

Browses all records in a selected data set of a DS structure.

 

MARK

Inserts a checkmark in a selected record.  

 

MARKED :Bool

Checks whether a selected record is marked.

 

NEXT : bool

Moves the DS cursor to a subsequent data record. 

 

ORDER( f1,f2,...)

Initiates sorting of data retrieved into a database. 

 

SETFILTERS( f1,f2...)

Sets a first-level filter on various fields.

 

UPDATE

Modifies data in a database.

 

DS:Pola

Direct access to a DS field structure:nazwasubds:nazwapola... or "ds:nazwa pola"

 

Defining a DS method in a package linked to a DS

ds:nazwmetody(params) or "ds:nazwa metody"(params)



QLX – Sample methods for the SYS library

SYS:

 

 

 

ASTIME (Date):Text

Returns a time value from Data and Time variables.

 

BLOB(op[I E C],

I – imports the Blob variable from a file, E – exports the Blob variable from a file, P – packs the Blob U – unpacks the Blob variable.

 

CHAR(AsciCode)

Returns a character from an Asci code.

 

CLOSE

Closes the I/O device.

 

COS(x)

Returns the cosine angle.

 

CREATEDS(dsname,temprec): Bool

Creates DS based on a DSTree in the garden.

 

CTAN(x)

Returns the cotangents angle. 

 

DATEDIFF (Date1,Date2):Int

Calculates the difference between date and time.

 

DATEINT (Date,Text[YMDWRhms]):Int

Converts Date and Time to number values. 

 

DATEMAKE (Date,Int,Text[YMDhms]):Date

Creates Date and Time.

 

DELETEFILE(fname)

Deletes a file from the hard drive.

 

GETERROR:text

Returns the last error stored in the TRY clause.

 

OPEN(name,CLIENT,SERVER,LPT,FILE)

Opens the I/O device. 

 

OPENFILE(Mask) :FileName

Opens a dialog box where you can select a file to be opened.

 

RAND(Max)

A random function.

 

READ:text

Reads all data from I/O device, e.g. from a TCP/IP port.

 

ROUND(Dec,Precision,[+,-]): Dec

Rounds numeral variables.

 

RUNSERVER(PacName,Port)

Runs server watch. When the client is connected, PacName:Run is run.

 

SAVEFILE(Mask) :FileName

Opens a window where you can select a file to be saved.

 

SHELL(FileName, Params, Operat)

Starts actions for files compliant with the system shell.

 

SIN(x)

Returns the sinus angle.

 

SQL(command,[ Conn , dsresult])): Bool

Runs an SQL command in a selected database. 

 

STRCOPY (Text,Pos,[Len]):Text

Copies a substring from a text variable.

 

STRLEN (Text):Int

Returns the length of a text variable.

 

SYSDATE

Returns the date and system time.

 

TAN(x)

Returns the tangent angle. 

 

USERLOGIN ([UserId],[Password]):UserId

Returns the ID of a logged system user.

 

WRITE(text)

Enables you to save a text into a I/O device e.g. a TCP/IP port.  



QLX – GUI object methods (windows, reports, GDI)

Obj:

 

 

 

SETPROP(name,val,[noupdate=0])

Property setup.

 

ADD(id,label,i1,i2,parid/accel)

Adds a subitem.

 

DEL(id)

Deletes a subitem Id = ?ALL? .

 

SETITEM(id, name,val)

Sets the property of a subitem.

 

UPDATE

Updating.

 

_HANDLE

Returns handle to a window.

 

FOCUS

Sets a focus in an object.

Gdi:

 

 

 

RECT(x,y,w,h)

Draws a rectangle.

 

LINE(x,y,w,h)

Draws lines.

 

CLEAR

Clears a buffer bitmap.

 

SETCOLOR (Col, Typ, Wi)

Sets a line colour and width.

 

ELIPS(x,y,w,h)

Draws an ellipsis.

 

ADDACTION

Adds an action to a pop-up menu in the GDI.

 

DRAW(blobpicture,[X,Y,W,H,Stretch])

Draws objects in a BMP and EMF format.

 

DRAWTEXT(X,Y,W,H,Text)

Draws a text. 

 

FLOODFILL(X,Y,[Color])

Colours an area. 

 

GRADIENT 

Draws a multi-gradient structure.

 

SAVEAS(FileName, [W,H])

Saves a picture in an EMF format.

Win:

 

 

 

RUNMODAL(name,&ds,typ,R_typ)

Opens a window (report) that is modal for Win: Based on a DS entered as a reference.

 

PROCMSG

Processes window events.

 

DIALOG( text,ds.,typ,f1?fn) :int

Creates a modal dialog box with edit or grid features Typ 0 ? edits1 ? read grid 2 ? edit grid 3 - tree 4 - ListView f1?fn nazwy pól.

 

CLOSE(action)

Action = mok,mcancel

Rep:

 

 

 

PRINTSEC (SecName,bool nomove)

Prints a selected report section. 

 

PAGENEXT

Moves the cursor to the next printout page.

 

PAGENO : int

Returns the number of a selected page.