Simplicty and flexibility!

The livetext format of the new runtask (chain menu) addition to DG3

Started by DataEase Development
You will need to Sign In to be able to comment on the Blog!

The livetext format of the new runtask (chain menu) addition to DG3

In DG3 version 0.15 we got a new addition to code that can be run on open page, the task.

A task is simply a collection of code that can be run in sequence like the old DE-DOS chain menus. The difference is that in DG3 each of the routines that run can leave data for the web page to use.

In DG3 we have a lot of these that can be used as livetext in a page:

the data that give us information about the logged in user or an anonymous user for all others
the data that came in as query parameters (?field1=value&field2=value2)
session data set by the page using xdg3.session.field=value in a url and removed using xdg3.delsession.field
the main record read by the page, dql or transfer on page load
 viewdata.field the list of data returned by a table, transfer or dql in a dataview
 transfer.field data that came from running a transfer on page load, can be data from external source like mssql, mysql, posgresql, csv, directory lists etc.
 transferlog a result log from the transfer
 task the new task runner data results (see below for the format)
 tasklog the new task runner log data that show all routines that was run

How to use task livetext on a page

Like all other livetext, the format is simply [{ livetext }]. All you have to do is to do is to use these simple rules for finding the data:


That is if you used a transfer names importcontacts that do a csv import where the fields are named ContactName and EMail, the livetext to list that contact names and email will be:

[% for contact in task.importcontacts %]

<tr><td>[% contact.ContactName %]</td><td>[% contact.EMail %]</td></tr>

[% endfor %]

for a dql with the same data the format is:



[% for contact in task.dqlname.viewdata %]

<tr><td>[% contact.ContactName %]</td><td>[% contact.EMail %]</td></tr>

[% endfor %]


The reason for the extra viewdata is that taskrunner returns the raw dql result. That is you will find

 True or False
The first record from the list view
The list view
The error message from the dql that failed
Example of how to show different results based on dqlhasrun

[% if task.dqlname.dqlhasrun %]

<h3>The first record</h3>

<p>[% task.dqlname.maindata.ContactName %] - [% task.dqlname.maindata.EMail %]</p>

[% else %]

<p>Sad to report a dql failure</p>

<p>The error message was [% task.dqlname.error %]</p>

[% endif %]

Written by DataEase Development 17/08/13 at 10:19:02 DataEase Generation 3