-
- Preview browser
- Page designer
- DQL editor
- Application wide settings
- Security settings
- Page caching module
- Modules
- Snippets
- Actions
- Context editor
- Task editor
- Scheduler editor
- Search engine editor
- Web server console
- Site layout editor
- Template editor
- Robots editor
- Style definitions
- Database manipulation
- Table designer
- Transfer editor
- Reporter
- Deployment module
- Deployment server settings
- Debugger
- .end
- .form header
- .form trailer
- .items
- assign
- application status
- backup db
- begin transaction
- break
- call menu
- call program
- case
- cluster by
- commit
- connect
- copy all from
- data-entry
- db status
- delete records
- define
- disconnect
- do
- documents
- exec SQL
- else
- end
- enter a record
- error messages off
- error messages on
- exit
- export
- for
- global
- if
- import
- imports
- in
- input using
- install application
- into
- list records
- lock
- lock db
- modify records
- message
- named
- others
- prompt
- query selection
- record entry
- records
- reorganize
- restore db
- rollback
- run procedure
- servers
- temp
- then
- tran off
- tran on
- unclustered
- unlock
- unlock db
- via form
- while
- with
- abs
- acos
- addressof
- ampm
- anylookup
- asin
- atan
- atan2
- ceil
- CHR
- concat
- ConsoleCopy
- ConsoleMemoCopy
- ConsoleShow
- ConsoleWriteToFile
- cos
- cosh
- date
- DatePicker
- day
- DEOS
- DialogOpen
- DialogOpenRelated
- DocumentCloseName
- DoesObjectExist
- ExecDQL
- ExecuteFile
- exp
- FileExecDQL
- firstc
- firstlast
- firstw
- FixedWidth
- floor
- futurevalue
- GetCurrent
- GetVar
- hours
- if
- installment
- jointext
- julian
- lastc
- lastfirst
- lastw
- length
- log
- log10
- lower
- MemoChunk
- MemoCopy
- MemoDecodePair
- MemoExecDQL
- MemoFind
- MemoGetGlobal
- MemoLength
- MemoMemoCopy
- MemoMemoReplace
- MemoReadFromFile
- MemoReplace
- MemoSetGlobal
- MemoStringBetween
- MemoStringFrom
- MemoStringTo
- MemoWordCount
- MemoWriteToFile
- midc
- midw
- minutes
- mod
- month
- OpenForm
- OpenMenu
- OpenProcedure
- OpenReport
- periods
- power
- presentvalue
- proper
- random
- rate
- RefreshForm
- RefreshScreen
- RefreshStatus
- Remote
- Remote authentication
- Remote POP3
- Remote IMAP
- Remote SMTP
- Remote XML
- seconds
- SetColor
- SetCurrent
- SetFocus
- SetLabelText
- SetMemoValue
- SetState
- SetStyle
- SetValue
- SetVar
- sin
- sinh
- spellcurrency
- spelldate
- spellmonth
- spellnumber
- spellweekday
- sqrt
- StringBetween
- StringEscape
- StringFind
- StringFrom
- StringReplace
- StringTo
- tan
- tanh
- textpos
- timeampm
- ToText
- UniqueID
- upper
- Wait
- weekday
- WriteToFile
- year
- yearday
- yearweek
- " (quotation marks)
- () (parentheses)
- + (addition)
- , (comma)
- - (subtraction)
- . (period)
- -- (comment)
- / (division)
- * (multiplication)
- * (asterisk)
- ? (question mark)
- ~ (tilde)
- : (colon)
- := (assignment operator)
- ; (semicolon)
- < (less than)
- <= (less than or equal to)
- = (equals)
- > (greater than)
- >= (greater than or equal to)
- all
- all files
- and
- any
- between
- blank
- count
- count of
- file
- highest of
- in groups
- in groups with group-totals
- in order
- in reverse
- item (Statistical)
- item (Conditional Statistical)
- lock files
- lock nothing
- lock records
- lookup
- lowest of
- max
- mean
- mean of
- min
- not
- number
- numeric string
- or
- pause
- percent
- selected record
- std.dev.
- std.err.
- sum
- sum of
- text
- time
- to
- variance
- window
- Rules for queries
- * (asterisk)
- ? (question mark)
- ~ (tilde)
- and
- or
- not
- ( ) (parentheses)
- Debug querys
- Livetext tags
- xdg3 query
- Sessions
- Pagination
- Free text search
- Intro on fields
- Text
- Hidden
- Date
- Dropdown
- List
- Checkbox
- Radio button
- Text edit
- Redactor (richtext)
- CKEditor
- TinyMCE
- Intro
- hasPrismConnection
- doAction
- doDerivation
- doMenuItem
- doPrismDerivation
- setFormField
- runPrismFunction
- @GetDefinition
- . document
- . listcommands
- . listdocuments
- . listdrives
- . listfiles
- . listfunctions
- . listinternals
- . listoperators
- . listrelated
- . listtables
- . object
- . table
- . testdql
- @SetDefinition
- . document
- . object
- Extra modules intro
- python
- Qt
- wkhtmltopdf
- PySide
- PyXCC
- django
- Apache
- LightTPD
- nginx
- pywin32
- flup
- cssutils
- Pillow
- psutil
- mysqldb
- psycopg2
- pyodbc
- python_dateutil
- requests
- suds-ews
- setuptools
- Whoosh
- wmi
- django-send
- bootstrap
- bootstrapmultiselect
- jquery
- jqueryui
- ckedit
- tinymce
- redactor
- JavaScript EU VAT Number Validation
- feedparser
- beautifulsoup
- appsdir
- six
- pycparser
- pyOpenSSL
- cryptography
- cffi
- enum34
- pyasn1
- idna
- ipaddress
- PyYAML
- coverage
- coveralls
- docopt
- mock
- funcsigs
- pbr
- nose
- paypalrestsdk
- paypal
- libcurl
- 7zipcpp
- cef
- cpp-jwt
Remote
Function::Internal
retval := Remote(commandstring)
retval := Remote(commandstring, input)
retval := Remote(commandstring, input, output)
Used to do commands on a remote web server or organize in memory structures.
Parameters
commandstring : Text
This can be all from a sequence used to log in, a returned field that we already have fetched using a previous call to Remote or setting a value to a empty object or update existing object. All commands starts with a @commandname:. If not a @ if the first char in the command string, the meaning is either a data fetch and return or a data set. A data fetch is characterized bu being a string without any = in. A data set is a string with a = in. The name fetched or set can be a single name, an object where you use dot notation or an array where you use [index] notation. When you fetch data, you can also transform of fetch part of the data by using a filter. The filter is recognized by a |.
Example of notation
Remote("@cleanup") This is a simple command with no parameters at all. It simply clean up all memory and connections done.
Remote("@get:http://json.example.com/customer/1/") This is a remote lookup command that has on parameter. In this case it read and return the json data from a web site that returns the data as json. This data can be read by fetch data calls later on. Remote("@get:http://files.example,com/images/flower.jpg" ,"c:\images\niceflower.jpg") Some commands that interacts with server can have special parameters to override the default functionality. This can be to store the result somewhere else like in this get command that we use for downloading files to disk. Remote("@imap:fetch 1") This is a command with a sub command that has a parameter. In this case you read the mail with id 1 using the imap protocol. val:=Remote("mailcount") This command returns the value from the data store named mailcount. This value is actually returned if you run the pop3 command. val:=Remote("customer.name") This command returns a value inside a json object that previously are returned by an other command like the @get. val:=Remote("emails[0].Subject") This command return the Subject found in the first object inside the mails array. The mails array is actually used to return data from both the @pop3 and the @imap command. val:=Remote("emails[0].Body|html") This command returns the Body in the first ovject inside the mails array and runs this through a filter to transform of fetch a part of the data. In this case you actually returns the html data of a multipart mail body that was returned by a @pop3 or @imap command. val:=Remote("emails[0].Body|html",,MemoField) This command set the returned data into a body field. As you might know, DfW can only return 256 characters of data to a variable like val. To over come this you can use a body as the third parameter. The memo field must be and active in memory field. How to do this will be explained in more details in the mail handling part of the documentation. val:=Remote("emails[0].Body|html",,"MemoField") This is the same as the previous example except for this will set the data into the memofield in the active form. The difference are "" around the name means in the active form instead of the active memo field given by a dql for command. val:=Remote("myvar=My own string value") This command set a value into myvar variable in the data store. The variable is created if it do not exist an overwritten if is does. val:=Remote("myvar=", "My own string value") This command set the value form the second parameter into variable. This can be created by any valid formula or fields. val:=Remote("myvar=", concat("Re: ",Subject)) Sets the result form the concat formula into myvar. val:=Remote("myob.myvar=My own string value") This command set or create a variablein the object myob. If myob do not exist or are a other type of value, it will be created a new object and a variable in the created. val:=Remote("myarray[0]=My own string value") This will set a value in the first position of a string array named myarray. If the array do not exist, it will be created. val:=Remote("myobarray[0].subject=My own string value") This will set a value in the first position of an object array named myobarray. The value will be set in a object and the a variable named subject the object is created if it do not exist. If the array do not exist, it will be created. val:=Remote("mail.Body.html=","memo:EMailHtmlMemo") Sets the in form memo to a special mail object that can be used to build mails for sending using the @smtp command. the "memo:FieldName" indicates to fetch the in memory memo field from GUI. Returns/Result
String with asked for field, empty string or in error situation the error string.
Commands
@agent Nothing Set the user agent sent to the server. Default is "dataease-agent/1.0". Some server used this to serve different pages to different clients. So if you do not get the same result as in your browser, you can try to change this value to something like "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0" that is what Firefox 37 returns on Windows 7. @arrayadd Nothing Add a string to root array. This method will convert any json object to a single array if it is something else and add the element to the array.
Ex: Remote("@arrayadd","val1")+Remote("@arrayadd","val2") will produce ["val1","val2"] when you call Remote("@json")@arraysize
LE9 >= 6640Number Return the size of array or blank if not an array.
Ex. If you have a root array call Remote("@arraysize") to get the size or root array
Ex. To get the size of any other array call ("@arraysize:mvdata.data") to get size of the array located at mvdata.data@cleanup Nothing Closes all connections and removes all remote lookup memory uses for the current session. The session is left there to reuse. For removing it completely you have to use @remove instead. This can be done on all connections except default that only support @cleanup.
Parmeters:
- keepdebug - let you keep logging and debug while clearing the rest Ex. Remote("@cleanup:keepdebug") will clear all but debug set
@cookieclear Nothing Clear the prevoious cookies definition set by us. @cookieget String Returns the value of a cookie in the cookie store for the last used request to a server. To read the cookies use the index of the cookie to read. Index start at 0.
Ex. Remote("@cookieget:3") will return cookie at index 3
Ex. Remote("@cookieget","0") will return the first cookie@cookieset Nothing Set a cookie to be sent for the next request to the server. The cookie is set direct to the active request object and will be keept until you do a @cleanup and start over. @connect
Nothing Used to set up a connection to a remote server by supplying the url to use.
Ex. Remote("@connect:http://www.dataease.com/getmydata/")@current
last current command
or
Name
Set the current active remote lookup session or return the name if :Name is omitted. If no change is done, the one created by default the first time used is called "default".
Ex.: curentused := Remote("@current") returnes the name of currently used session.
Ex. 2: Previous := Remote("@current:mysession") will locate and existing session named mysession or create a new session named mysession and switch to that one. The return value will be the command for setting the session back to the previous session. If the previous session was default the return value will be "@current:default". This can can be used to switch back to the previous when you are done.
@debug Nothing Turn on debug trace and save it to what. Supported for now is file
Parameters:
- file Ex. Remote("@debug:file",filepath)
- anyother will just be used as prefix for text in log Ex. Remote("@debug:log", "My log message") will add a entry to the file given with log as prefix and message as the text.@debugoff Nothing Turn off debug trace @delete
LE9 >= 6705String Do a get with DELETE verb set and return result. The result is parsed as json and set into the current session object.
Parameters:
- url Ex. Remote("@delete", "https://api.example.com/v1/customers/1/") . Will send a delete command to the api with a request to delete customer 1 and set result in json session object@deleteraw
LE9 >= 6705String Do a get with DELETE verb set and return result.
Parameters:
- url Ex. result := Remote("@deleteraw", "https://api.example.com/v1/customers/1/") . Will send a delete command to the api with a request to delete customer 1 and return result to the result variable.@error String Last error reported. Ex a bad user name password.
@errorclear Nothing Clear the last error message. @fieldexist String
yes/no
Return if the there are a value for the key given in a json or xml. In json we support the . and [] in xml you have the / [] and . to navigate the structure
Parameters
- key Ex Remote("@fieldexist:recorddata.name") will return yes if field exist and no if not
@fieldnames String Return a list of fields found in an element. Ex. Remote("@fieldnames:mails[0]") list all fields found in the first mail. Remote("@fieldnames:") list all element names in the first level. All fields found are separated by a line feed. @fileload Nothing Load a JSON file into current session
Parameters:
- filename
Ex: Remote("@fileload:c:\mydir\filename.json")
@filesave Nothing Save current session as a JSON file
Parameters:
- filename
Ex: Remote("@filesave:c:\mydir\filename.json")@filter Nothing Update values in the query string with these new values in the form of field1=value1&field2=value2. If a field is not already in the query string it will we added to it. @get Nothing Fetch a new set of data from the remote server using the query, the url and the login information set in previous commands. You can also set a url and a query direct in the get as a shortcut.
Ex. Remote("@get:http://api.example.com/data/cities") will get the json data from the server and load it into the internal json store in remote.
- extra parameter used to override save to json array. This can be used to download files from server to a proper area on disk. No conversion is done when downloading file.
Ex Remote("@get:http://file.example.com/flower.jpg,"c:\images\flow... download a image to disk
@getraw String Return raw data from server by a GET call using the supplied url or the one set in previous connect. The raw data is returned to the caller. @headerclear Nothing Remove all headers set previously so we can start over. @headerget String Return the value of a header that will be sent in the next request. To read header use the index of the header to read. Index start at 0.
Ex. Remote("@headerget:3") will return header at index 3 (that is the fourth header starting at 0)
Ex. Remote("@headerget","0") will return the first header@headerset Nothing Set a custom header that will be used on the next request. The headers are reset after a request is done, so you have to set them for each call to a server.
Ex. Remote("@HeaderSet","Content-Type: application/xml") will replace the default content type for a raw request to xml.@imap String Get imap mail form the server. See own document for commands and examples. @isloggedin String Return yes if logged in and no if not @json String Returns the raw json from the data in the current session. You can use this to debug your data or see what's returned from the server by setting it to a memo field. A parameter will select the root of the json, no parameter will return all. @jsonfrom String Returns the session storage from a session without changing the session.
Ex. Remote("@jsonfrom:selectfields") will return the json stron form the selectfields session without the need to switch to it@jsonto Nothing Sets the json string to a named session . Can be useful if you are using one session for doing calls to an authenticated api and others to store result and manipulate data for sending.
Ex. Remote("@jsonto:datastore",Remote("@json")) will save data from current session to datastore session.@logbody Nothing Log the body returned from the function to a file given by parameter 1. Ex Remote("@logbody:C:\rlbody.txt") @logheader Nothing Log the header returned from the function to a file given by parameter 1. Ex Remote("@logheader:C:\rlheader.txt"). Mind that all mail handling commands logs all communication with the server using the header and processed data in the body. HTTP traffic separates header and body by leaving the server specific data to the headers and what the user see in the body. @login Nothing Login using user/password as parameter or previous set @username and @password. @logintype
Nothing
The type of login used. Defaut is dataease, but you can also use basic, digest, ntlm, negotiate, anybasic, post and django. The DataEase method used the default login method used on DG3 server. The anybasic method tests all of the basic methods from the strongest to basic and uses the best supported version. The negotiate method is not activated at the moment.
@logout Nothing Logout using the login type set, @logupload Nothing Log the data posted to the server to a file given by parameter 1. Ex Remote("@logupload:C:\rlupload.txt"). At the moment it is only smt:send command that uploads data. @patch
LE9>=6640String Patch the data on the server by posting values set previously using @Remote to set json values. The data is sent to the server using the PATCH verb. The return data if json are then set to the current object. The raw string data is also returned from the function. @patchraw
LE9>=6640String Post data to the server with the PATCH verb and return the raw data from the server as a string.
- what to post to the server. This can be a file, a memo, string etc. It is sent to the server as is. To tell the server what you send, you should manually set the headers.
The server will return a string of the result comming back from the server.
Ex. Remote("@patchraw",MemoWithXML) will post the xml code found in the memo. To tell the server this is xml you should have added Remote("@headerset", "Content-Type: application/xml") and the url to the endpoint using Remote("@connect:http://www.example.com/endpoint").
Ex 2. You can also do Remote("@headerset", "Content-Type: application/json") then Remote("@patchraw:https://the.server.domain/api/endpoint",thedata) to post raw json string direct to the url.@patchurl
LE9>=6640String Post data with the PATCH verb set in store as url encoded form code.Takes first level json sat with Remote("fieldname=value")
Ex. Remote("@patchurl","http://api.postmydate.com/formdata")@password Nothing Set the password used for login @processinfo Nothing Get a list of all processes the current user can see on the computer.
The list of processes are returned as an array objects named "processes". The number of processes returned can be read from the value "processescount".
You can use a string as filter of what to return. The format is either just a string that will filter on the process name, but you can also use the format fieldname=filtervalue. Filter value support * and ? for wildcard and letter. The object returns the following fields that also are the supported filter fields: pid, name, fullname, user and domain.
Ex. Remote("@processinfo") will return all processes that you can see
Ex 2.: Remote("@processinfo:DataEase.exe") will return all processes that have the name DataEase.exe
Ex 3.: Remote("@processinfo:name=de*&user=administrator") will return all processes that have a name that starts with de and are started by the administrator user.
@pop3 String Get pop3 mail form mail server. See own document for commands and examples. @post String Post data to the server using a form post method and set the return data as json values in session. The raw return string as also returned from the function.
- [filename] to post is optional. If no value set, the json data set will be sent to the server with header "application/json". If you want to upload a file set the filename as second parameter.
If you upload a file it will simulate using file upload form (same as <input type="file" name="uploadedfile"> in a web form.). The form is posted as a form with enc="multipart/form-data".
Ex. Remote("@post:http://api.example.com/data/update") will post the json data we have created in out json structure to the server
- extra parameter will take the data from file instead of json structure and post this to the server
Ex. Remote("@post:http://files.example.com/upload", "c:\images\flower.jpg") will post the image file to the server.@postraw String Post data to the server and return the raw data from the server as a string.
- what to post to the server. This can be a file, a memo, string etc. It is sent to the server as is. To tell the server what you send, you should manually set the headers.
The server will return a string of the result comming back from the server.
Ex. Remote("@postraw",MemoWithXML) will post the xml code found in the memo. To tell the server this is xml you should have added Remote("@headerset", "Content-Type: application/xml") and the url to the endpoint using Remote("@connect:http://www.example.com/endpoint").
Ex 2. You can also do Remote("@headerset", "Content-Type: application/json") then Remote("@postraw:https://the.server.domain/api/endpoint",thedata) to post raw json string direct to the url.@posturl String Post data set in store as url encoded form code.Takes first level json sat with Remote("fieldname=value")
Ex. Remote("@posturl","http://api.postmydate.com/formdata")@put String Update the data on the server by posting values set previously using the DataEase server method. The return data if json are then set to the current object. It is also returned as a string from the function. @putraw String as postraw except using put as verb @puturl String as posturl except using put as verb @query
Nothing
Replace the query string with this one. The query string is everything added after a ? in a url.
@raw
String
Return raw data from server by a GET call using the supplied url or the one set in previous connect. The raw data is returned to the caller.
@remove
Nothing
Removes the session from the cached session list. This can be done on all sessions except default. The default session is always available, but you can clear your data by using @cleanup.
@returnbuffer String The last result from last called action. @returncode String Returns the last result code from a http request. This is the codes returned by a web server. 200 is all ok, 30X is request for redirect, 40X is access denied of some sort and 50X is an internal server error. If the code is 0, no request has been done. The X is a number between 0-9 and describes the kind of error. @securitytype Nothing Set the type of security used on none http protocols like pop3. You can set none, any and secure. None do not set security, any the is the default tires any security type including none and use the strongest supported and secure tries any one except none and uses the strongest. @set Nothing Set a value in the locally cached data by using the form fieldname=Value. This is the same as using the direct fieldname=value except that you can add the type.
Types are set direct after @set: and before the fieldname seperated by a colon. Ex @set:int:key will set a int type value to the filed named key
Supported types are array, bool, double, float, int, null object and string. The default if not set is string as is when you use the fieldname= form.
Ex. Remote("@set:fieldname","A value") will set a string value of "A value" to the json element named fieldname.
Ex. Remote("@set:objectname.field","A value") will set a string value of "A value" to the json element named field in the object named objectname.
Ex. Remote("@set:bool:boolfieldname","true") will set the boolean value of true to the json element named boolfieldname.
@setjson Nothing Takes a json string, encodes it en set it to the local cache. @setproxy Nothing Takes proxy server as parameter. Ex. Remote("@setproxy", "http://myproxy:8080") will use the server myproxy as as proxy on port 8080. @seturlencoded Nothing Takes a string in url encoding and translate it to JSON. The url encoded string is in the form of FieldName=urlencodedtext&Field2=otherurlenencodedtext, so this is then stored into the session as a object with field FieldName and Field2 and can then be retrieved with a Remote("FieldName") etc. @setxml Nothing Takes a xml string and parses it in to a DOM tree in memory and enters the remote session into XML mode. Full functionality and examples can be found in the Remote XML document.
Parameters
- flags that can have the values:
- ignorenamespace | that remove all before : in element names before checking it. Ex Remote("s:Envelope/s:Body/asm:SupplyRequest") becomes Remote("Envelope/Body/SupplyRequest") in a soap request. And then Remote("soap11:Envelope/soap11:Body/asm:SupplyRequest") will work as well.
- usenamespace | names with namespaces will be used (this is the default) that means a path in the xml s:element is different form soap11:element and using just element will fail.
@timeout Nothing Set a time out value for the maximum time to be used for getting back a result including the time it takes to return the data. Default i 0 that means no timeout at all. You can use the form 10 for ten seconds or 10000ms to 10 thousand milliseconds. The form 10s for 10 seconds are also valid. @urldecode String Return the decoded version of an url encoded string
Ex. Remote("@urldecode","Hallo%20world!") will return "Hallo world"@urlencode String Return the url encoded version of a string
Ex. Remote("@urlencode","Hallo world!") will return "Hallo%20world"@username Nothing Set the username used when login fieldname String returns the livetext stored in the server cache for the value fieldname. The fieldname can be in the form of a single name, a . separated name, an array of string or an array of object. Ex. single name: fildname, dot separated name: objectname.fieldname, string array: dataarray[10] and object array: objectarray[10].fieldname. These can be as deep as you need to represent the data. All values will be converted to a string when returned to caller, but any valid json value are supported. fieldname= Nothing Used to set a value to a field name. The field is added if it not is found in the current data and replaced if there are a current value. You can use any valid combination supported by get field to set a field as well. Filters
Filters that can be used when fetching values. At the moment most of the filters only work on mail data stored in the mime store in the variable mail or emails[]. All filters are set by using the | character before the filter value. A filter can also have parameters like the attachment and attachmentname. Then the the filter have the form |attacment 1 where the parameter is separated from the filter by a space.
attachment
Returns the attachment and store it a file. The filter can have 0 to three parameters where the meaning depends on the type and number of parameters. The first are the position in the Body if it is a number. It starts on 1 and count up to as many attachment there is in the mail. You can find the number of attachments by using the attachmentcount filter. The next parameter is the folder to save the attachment in. Make sure to use "" around the path if it contains space in the name. If no folder is uses or you add a "" the current app path is used. If the the path starts on \ or second character is : a global path is used. Mind that this might not be legal depending on the run time environment. If not this will be a relative path to the current app folder. Last parameter is used to override the file name.
Ex.:
|attachment will store the first attachment to the app folder using the filename given by the attachment.
|attachment 2 upload will save the second attachment to a subfolder named upload in the app folder and using the file name given by the attachment
|attachment "C:\User\Me\My Documetents" invoice0034.pdf will store the first attachment in the a fixed folder with spaces in the name to a specific file name.
attachmentcount Number of attachments found in the MIME body. Ex. emails[0].Body|attachmentcount will return the number of attachments in the first mail in the incoming mails store. The value returned is a string as for all remote lookup commands. attachmentext Returns the file extension to the file name given by MIME. Can take zero or one parameters. When zero parameters it returns the extension of the first attachment, if one this indicates which attachment to fetch the extension from, and the first is 1. Extension are returned including the . so a pdf will return the extension .pdf and no extension will return nothing. attachmentname The file name registered by the MIME attachment. Can take zero or one parameters. When zero parameters it returns the name of the first attachment, if one this indicates which attachment to fetch the name from, and the first is 1. html The html part of a MIME body in an email. The filter can be used on both the mail.Body valriable and the emails[idx].Body variable. multipart The multipart in a MIME body in an email. You will get this if you have a html body with embedded images using cid: in images source for embedding elements in the email. This will give you all the MIME parts of this element of the body. Ex. Remote("emails[0].Body|multiparts") will return the multipart section of the first email read if it exists and blank if not. raw Returns the value of a MIME part in raw MIME format. Ex. emails[0].mail|raw will return the first mail object in raw MIME text as it is stored in the MIME mail array and emails[0].Body|raw will return the first emails body in raw MIME format. text The text part of a MIME body in an email. The filter can be used on both the mail.Body valriable and the emails[idx].Body variable. Examples
Examples not using a server:
To understand how to use the Remote data store, we will do a few examples without calling a server in the first examples. First we will show how to set a named datastore. All settings done to a named data store is maintaned in memory until you close down DataEase or use the @cleanup command. To set up a new datastore, you use the @current:name command. This will switch to an existing datastore if it exist or create a new. In the next example we will create "mydata" datastore and create a field direct on the root object called "myvalue", an array called "data" with 10 objects, and 2 field in each object called "Name" and "Code". Then we pick the 6th element in the array and return it.
-- The DQL define temp "Dummy" text. define temp "telle" number. define temp "cname" text. define temp "ccode" text. Dummy := Remote("@current:mydata"). Dummy := Remote("myvalue=a value"). telle := 0 . while telle < 10 do Dummy := Remote(concat("data[", telle , "].Name=Name", telle)) . Dummy := Remote(concat("data[", telle , "].Code=C", telle)) . telle := telle + 1 . end cname := Remote("data[5].Name") . ccode := Remote("data[5].Code") . list records cname ; ccode . -- The body ***************************************************** Test of creating a json structure in memory only ***************************************************** .items Code: [{ccode}] Name: [{cname}] .end ***************************************************** -- The result ***************************************************** Test of creating a json structure in memory only ***************************************************** Code: C5 Name: Name5 *****************************************************
Create an string array and read values back form it. In this example we do not use field names inside the array, but just set a string value direct into the array. This is never used in the DataEase server, but can be useful when connecting to other kinds of server like mail server. We also added a @cleanup command to start on a fresh datastore. This is useful if you reuse your datastore name.
-- The DQL define temp "Dummy" text. define temp "telle" number. define temp "cname" text. define temp "ccode" text. Dummy := Remote("@current:mydata"). Dummy := Remote("@cleanup"). telle := 0 . while telle < 10 do Dummy := Remote(concat("data[", telle , "]=Name", telle)) . Dummy := Remote(concat("data2[", telle , "]=C", telle)) . telle := telle + 1 . end cname := Remote("data[5]") . ccode := Remote("data2[5]") . list records cname ; ccode . -- The body ***************************************************** Test of creating a json string array in memory ***************************************************** .items Code: [{ccode}] Name: [{cname}] .end ***************************************************** -- The result ***************************************************** Test of creating a json string array in memory ***************************************************** Code: C5 Name: Name5 *****************************************************
This concludes the section where you use the Remote command without calling a server. In the next section you will need a server to use.
Examples with data on remote server:
For the examples I use a Contact table where you have a first_name, last_name, title, and email field. I have created a DG3 page that have a fixed filter
email=[{ user.email }] that connects the logged in user to the record data by the registered email. To use the page for Remote, you just add a query string q.action=getrecord to the url and sets the action to updaterecord when you save the changed data back to the server. Here are the example of how to do it.
Login and show the registered values on the contact.
-- The DQL define temp "Dummy" text. define temp "fname" text. define temp "lname" text. define temp "email" text. define temp "title" text. define temp "dob" text. Dummy := Remote("@current:mydata"). Dummy := Remote("@connect:127.0.0.1:8080/licensecheck/editcontact/"). Dummy := Remote( "@login:username/password"). Dummy := Remote("@query:q.action=getrecord"). Dummy := Remote( "@get") . fname := Remote( "recorddata.first_name") . lname := Remote( "recorddata.last_name") . email := Remote( "recorddata.email") . title := Remote( "recorddata.title") . dob := Remote( "recorddata.dob") . list records fname ; lname ; email ; title ; dob . -- The Body ***************************************************** Get my contact info ***************************************************** .items Name:[{fname}] [{lname}] EMail:[{email}] Title:[{title}] Day of birth:[{dob}] .end ***************************************************** -- The result if you have a valid login ***************************************************** Get my contact info ***************************************************** Name:Test User EMail:test@example.com Title: Day of birth:17.08.67 *****************************************************
Get a record and update it with new values. This routine simply toggles the title form blank to "The Master" each time it is called and return the result.
-- The DQL used define temp "Dummy" text. define temp "fname" text. define temp "lname" text. define temp "email" text. define temp "title" text. define temp "dob" text. Dummy := Remote("@current:mydata"). Dummy := Remote("@connect:127.0.0.1:8080/licensecheck/editcontact/"). Dummy := Remote( "@login:username/password"). Dummy := Remote("@query:q.action=getrecord"). Dummy := Remote( "@get") . fname := Remote( "recorddata.first_name") . lname := Remote( "recorddata.last_name") . email := Remote( "recorddata.email") . title := Remote( "recorddata.title") . dob := Remote( "recorddata.dob") . if title = blank then title := "The master" . else title := "" . end Dummy := Remote("@query:"). Dummy := Remote( "action=updaterecord") . Dummy := Remote( jointext("recorddata.title=",title)) . Dummy := Remote( "@put") . title := Remote( "recorddata.title") . list records fname ; lname ; email ; title ; dob . -- The body ***************************************************** Get and update my contact info ***************************************************** .items Name: [{fname}] [{lname}] EMail: [{email}] Title: [{title}] Day of birth: [{dob}] .end ***************************************************** -- The result if you have a valid login ***************************************************** Get my contact info ***************************************************** Name: Test User EMail: test@example.com Title: The master Day of birth: 17.08.67 *****************************************************
Delete record