-
- About server
- LegEasy Connect
- Dev server
- Live Server
- DERun
- Hello world
- Call script after startup
- Using tools
- Authentication
- Custom authentication
- External authentication
- Basic authentication
- Folder Security
- Data manipulation
- Read one record
- Read many records
- Write one record
- Delete one record
- Direct Page/DQL
- Page data definition
- Directory listing
- File handling
- Prism lists
- Data Defintions
- Get data definitions
- Create data Definitions
- Update data definitions
- Delete data definitions
- Definition format
- A web page
- Page definition
- DQL pages
- Single file/memo DQL
- Single file/memo Page
- LiveText tags
- Url commands
- Tags
- How data is triggered in a page
- Form goals
- Auto form
- Setting up autoform
- A single form
- Form with subform
- Form actions
- About Update
- About DataEaseConnect
- checkquery
- callbacksuccess
- clearrecord
- connectonfieldchange
- convertvaltonumber
- decodequery
- deletedata
- deletetdf
- displayerrormsg
- doaction
- ensurequry
- fetchrecord
- fetchrecords
- finddatatype
- findfieldindef
- formdata
- formdefs
- forminit
- forminitdone
- formloaded
- generateid
- getcookied
- getdata
- getelement
- getfield
- getmyhost
- getnumlines
- getrecordcontent
- getrecorddef
- getrecordnofromurl
- gettdf
- gettablefromurl
- istrueval
- login
- logout
- makenewline
- multirecordinit
- newdata
- newtdf
- rundql
- populateoneselect
- selectpopulate
- setcsrfheader
- setelement
- setfield
- singlerecordinit
- stringify
- stripsuffix
- updatedata
- updatetdf
- useisodatetime
- usenumber
- version
- About decommon.js
- The loader
- calccaretpos
- decodequery
- generateid
- insertitem
- loadfilelist
- loadfile
- loadinternals
- message
- rundql
- runpage
- savefile
- selectitem
- testdql
- version
- About jsBridge.js
- Action names
- deCheckVersion
- DEOS
- getnumlines
- GetCurrent
- GetValue
- GetVar
- jsAction
- jsActionExt
- jsActionExt2
- jsAddClass
- jsDEOS
- jsDerivation
- jsDerivationDebug
- jsDocumentDelete
- jsDocumentEdit
- jsDocumentOpen
- jsExecDQL
- jsGetActiveDocState
- jsGetVar
- jsGetCurrent
- jsGetDocumentState
- jsGetValue
- jsGetPRISMValue
- jsHide
- jsInt21
- jsLiveText
- jsLog
- jsMemoExecDQL
- jsMenuItem
- jsNewBlankForm
- jsOpenAppCat
- jsPrismDerivation
- runPrismFunction
- jsRefreshDocuments
- jsReorganize
- jsReorganizeAll
- jsRemoveClass
- jsSetFixedValue
- jsSetVarFromField
- jsSetValue
- jsSetVar
- jsSetCurrent
- jsSetWebField
- jsSetWebFieldFromVar
- jsShow
- jsToggle
- jsToggleClass
- makenewline
- SetCurrent
- SetValue
- SetVar
- startdebugger
Read one record
To read one record, you must have right to the data and use the maindata url to fetch them using a http GET command. The format of the url is; /maindata/tablename/recno/?dataeasequery1&othersettings=val1&othersetting2=val2 etc.
/maindata/ tells the server to give you one record of the selected table.
/tablename/ tells what table to fetch the data.
/recno/ tells the record to fetch based in the query.
The query format is the same as for any other query in server. The first part between ? and the first & is a query as your write it in DataEase. This mean you can write a Name="A*" to get all records with a text field starting on A. You can also use all other operators like AND, OR, BETWEEN, >, >=, <, <=, =, not = etc. So if you want a record where Name starts on A and regdate is between to dates your write "Name="A*" AND regdate between 10/10/20 to 12/10/20". If you want to get the results in acending or decending order based on a field, you add this as "®date=in order".
Ex. /maindata/Address/0/?Name="A*" AND regdate between 10/10/20 to 12/10/20®date=in order&jsonpretty=1&getrecordcount=1
This query will return the first record matching Name="A*" and reg date between the 10/10/20 and 12/10/20 in acending order on regdate is formatted json and also add the number of record matched. Then the first or these are returned to the user.
Extra query parameters that can me used to manipulate the result can be found here.
Set default values on new record
When doing a GET new record (-1) you can use the query values to set field default to internal datastore before read. That is if you have a value that i not fixed but set by some calculation done in your web page, you can do a ?&fieldname=myval to set it as a default value.
Format returned from query
The return format is application/json with the following format:
When no error occurred: { 'result' : 'ok', 'recorddata' : { 'Name' : 'Bjorn', 'Country' : 'Norway', 'Street' : 'Narrow street', 'Postno' : '1234', 'PostAddr' 'Somewhere' }, 'recno' : '0' } When error occurred { "errormsg" : "no record matching query" "result" : "error", } When not sufficient right to table { "message":"Not logged in and default rights not sufficient.", "result":"forbidden" }
If the default security is not set or the user is not logged in with sufficient right to the table, you will get "forbidden" as the result of the query.