LOCAL - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki

Overview

THIS WIDGET IS UNDER DEVELOPMENT

The LOCAL Data Widget is returns the locally stored database. This can then be accessed, bound to, and modified using both Datasource, POST and other bindings. On mobile, LOCAL utilises autosave="true" on the form, as well as the save() event to the FORM table. Documents can be filtered and bound to by any form field element using FILTER, evals, etc. The POSTMASTER bindings notify the user of background attempts for offline and online saving. For more information on HIVE package visit https://docs.hivedb.dev/.

Restrictions:

  • SQL works mainly on mobile as it saves offline when not able to connect to a network, and will attempt to automatically complete a form when connected if that form has been called to complete().
  • When a form is called to complete() and is offline, the sql widget will continue to try to post in the background until the max attempts defined in POSTMASTER is hit, at which point it will throw an error within the POSTMASTER Global Bindings.

Bindings

The bindings of SQL are based on the FORM bindings. SQL generates a key for every FORM saved.

Examples

<Datasource id="FORMS" url="sql://localhost?table=POST">
<POSTBROKER id="delete" method="delete" url="sql://localhost?table=FORM"/>

These are two sql urls on a postbroker and Datasource, showing how to call the sql brokers tables.

<Datasource id="FORMS" url="sql://localhost?table=POST">
</Datasource>
<LIST Datasource="FORMS">
<ITEM>
<!--This is the SQL query to delete by key-->
<POSTBROKER id="delete" method="delete" url="sql://localhost?table=FORM&amp;key={key}"/>

<LINK onclick="open('{key}')">
<BOX height="200" width="100%">
<ROW>
<COLUMN>
<!--These are the bindables on postmasters-->
<TEXT value="key: {key}"/>
<TEXT value="form_key: {form_key}"/>
<TEXT value="Status (1 incomplete, 2 complete, 3 error): {status}"/>
<TEXT value="format (xml,json etc): {format}"/>
<TEXT value="method used: {method}"/>
<TEXT value="url: {url}"/>
<TEXT value="body: very large file, you can access and edit the xml using this"/>
<TEXT value="date: {date}"/>
<TEXT value="attempts: {attempts}"/>
<TEXT value="info (response message on post): {info}"/>

</COLUMN>

<BUTTON onclick="continue('warning','Confirm Delete');post('delete');fire('FORMS')">
<ICON icon="delete" color=""/>
</BUTTON>

</ROW>
</BOX>
</LINK>
</ITEM>
</LIST>

This is an example of the POST table within sql and its bindings.

<Datasource id="FORMS" url="sql://localhost?table=FORM"/>

<LIST Datasource="FORMS">
<ITEM>
<!--We call the delete method with the form key when deleting-->
<POSTBROKER id="delete" method="delete" url="sql://localhost?table=FORM&amp;key={key}"/>

<!--This is the SQL query to open by form key, key is auto-assigned when a form is saved-->
<LINK onclick="open('{key}')">
<BOX height="50" width="100%">
<ROW>
<COLUMN>
<TEXT value="{title}" color="{status}==1?'red':'black'"/> <!--TITLE is an input field added to this particular form, it is not generated-->
<TEXT value="{key}"/>
<TEXT value="Complete = {complete}"/>
</COLUMN>

<!--Complete == false means incomplete, true is complete-->
<ICON icon="check_circle_outlined" visible="{status}==1?'false':'true'"/>

<BUTTON onclick="continue('warning','Confirm Delete');post('delete');fire('FORMS')">
<ICON icon="delete" color=""/>
</BUTTON>

</ROW>
</BOX>
</LINK>
</ITEM>
</LIST>

This is an example of the FORM table within sql and its bindings, as well as an included form field TITLE.

Other Widgets You May Find Useful

⚠️ **GitHub.com Fallback** ⚠️