Cross Ref > Database
By Mike Prestwood
Corel Paradox versus Java: A side by side comparison between Corel Paradox and Java.
This category documents connecting and using data including database commands, and common technologies used.
Languages Focus This common syntax name documents editing a record as a whole: add/insert, edit, post data, and delete.
Corel Paradox:
insertRecord, postRecord, edit
In ObjectPAL, you use Cursor.InsertRecord to add a new record, Cursor.postRecord to post the record, and Cursor.deleteRecord() to delete it. To edit a record, you must put the cursor into edit mode, Cursor.Edit() . (A cursor applies to both a TCursor and UIObject.)
ObjectPAL gives you tremendous flexibility with editing data and includes many additional commands such as insertAfterRecord and isEdit . For dBASE tables, you can also use unDeleteRecord() to un-delete a record. See the ObjectPAL help for more commands.
Syntax Example:
The following code snippet adds a record to a given TCursor with FullName and Created fields:
tc.edit() tc.InsertRecord() tc.FullName = "Barack Obama" tc.Created = today() tc.postRecord
[Not specified yet. Coming...]
Corel Paradox:
setRanger, setGenFilter
In ObjectPAL, you can filter set a TCursor, UIObject, and Table objects using setRange() and setGenFilter() .
Syntax Example:
The following example loads, filters, and runs a report.
var r Report dyn DynArray[] String endVar dyn["Name"] = "SCUBA Heaven" Customer.setGenFilter(dyn) r.load(":Sample:customer") r.Customer.setGenFilter(dyn) r.run()
You can also drop a flter with:
r.Customer.dropGenFilter()
[Not specified yet. Coming...]
Languages Focus Finding a record is about moving a cursor to a specific record within a set of records (documented here). In addition to finding a record, you can sort, filter, and loop a set of records (documented in their topics).
Corel Paradox:
locate, qLocate
ObjectPAL provides a rich set of commands for finding a record with a TCursor or UIObject including:
locate() - Seach for a value based on a criteria. Uses indexes as appropriate.
locatePattern() - Search for a pattern within a value.
moveToRecord() - Moves to a specific record number.
qLocate() - Search using currently set index.
Each of these basic find record commands has supporting commands such as locateNext() and recNo() .
Syntax Example:
var tc TCursor endVar tc.open("Customer.db") if tc.locate("Name", "Proffessional Divers, Ltd.") then tc.edit() tc.Name = "Professional Divers, Ltd." msgInfo("Success", "Corrected spelling error.") endIf tc.endEdit()
[Not specified yet. Coming...]
Languages Focus Top, bottom, next, and previous.
Corel Paradox:
home, end, nextRecord
ObjectPAL uses home() , end() , nextRecord() , priorRecord() to move a database cursor (works with either a TCursor or UIObject).
TCursor.nextRecord()
These commands send a message to the object. Specifically, they send an action constant using the action command. The above snippet is equivalent to:
TCursor.action(DataNextRecord)
It is handy to with familiar with action constants because not all action constants have an ObjectPAL equivalent comment.
Syntax Example:
The following snippet uses the active keyword to move to the second to last record of the table attached to the UIObject that currently has focus:
active.end() active.priorRecord()
You can also use the self keyword to refer to the UIObject your code is attached to.
[Not specified yet. Coming...]
Corel Paradox:
switchIndex, sortTo, setGenFilter
In Paradox, you add an index for each sort your wish to perform on a table then use switchIndex() . Alternatively, you can use sortTo() to sort a table into a new table.
More Info / Comment
[Not specified yet. Coming...]