From wiki.ginstr.com
Jump to: navigation, search
m (formatting)
Line 10: Line 10:
 
===Query with keys===
 
===Query with keys===
  
;<code>[gn:act_rawQueryToWidgets]|[table,query;column{n};target{n};key{n}]</code>  
+
:;<code>[gn:act_rawQueryToWidgets]|[table,query;column{n};target{n};key{n}]</code>  
  
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
+
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
|-
 
|-
 
! scope="col" | Parameter
 
! scope="col" | Parameter
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| table
+
| <code>table</code>
 
| table name from which to query data
 
| table name from which to query data
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| query
+
| <code>query</code>
 
| query name defined in queries.xml
 
| query name defined in queries.xml
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| column{n}
+
| <code>column{n}</code>
 
| table column name from which value will be used
 
| table column name from which value will be used
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| [[target]]{n}
+
| <code>[[target]]{n}</code>
 
| [[target]] where the value from column will be stored
 
| [[target]] where the value from column will be stored
 
* Valid [[target|targets]]:
 
* Valid [[target|targets]]:
 
** any [[target]]
 
** any [[target]]
 
|-
 
|-
| key{n}
+
| <code>key{n}</code>
 
| key to use as values for query
 
| key to use as values for query
 
Can be:
 
Can be:
* [[Datatypes#text|text]]
+
* <code>[[Datatypes#text|text]]</code>
* [[Datatypes#number|number]]
+
* <code>[[Datatypes#number|number]]</code>
* [[Datatypes#status|status]]
+
* <code>[[Datatypes#status|status]]</code>
* [[Datatypes#dateTime|dateTime]]
+
* <code>[[Datatypes#dateTime|dateTime]]</code>
* [[Datatypes#pointer|pointer]]
+
* <code>[[Datatypes#pointer|pointer]]</code>
* [[Datatypes#assignment|assignment]]
+
* <code>[[Datatypes#assignment|assignment]]</code>
* [[Datatypes#date|date]]
+
* <code>[[Datatypes#date|date]]</code>
* [[Datatypes#time|time]]
+
* <code>[[Datatypes#time|time]]</code>
* [[Datatypes#counter|counter]]
+
* <code>[[Datatypes#counter|counter]]</code>
* [[Datatypes#rowsColumn|rowsColumn]]
+
* <code>[[Datatypes#rowsColumn|rowsColumn]]</code>
 
|-
 
|-
 
|}
 
|}
  
 
====Example====
 
====Example====
 +
:<code>assetItems</code> - table name<br>
 +
:<code>assetItemsByCode</code> - query name<br>
 +
:<code>assetItem_assetNumber,assetItem_nfcTag</code> - column names<br>
 +
:<code>@+id/assetItem_assetNumber,@+id/assetItem_nfcTag</code> - target<br>
 +
:<code>@+id/assetItem_code</code> - key<br>
 +
:; ⤷ <code>[gn:act_rawQueryToWidgets]|[assetItems,assetItemsByCode;assetItem_assetNumber, assetItem_nfcTag;@+id/assetItem_assetNumber,@+id/assetItem_nfcTag;@+id/assetItem_code]</code>
 +
 
=====queries.xml=====
 
=====queries.xml=====
 
<SyntaxHighlight lang="xml">
 
<SyntaxHighlight lang="xml">
Line 66: Line 73:
 
</SyntaxHighlight>
 
</SyntaxHighlight>
  
=====code=====
 
<code>assetItems</code> - table name<br>
 
<code>assetItemsByCode</code> - query name<br>
 
<code>assetItem_assetNumber,assetItem_nfcTag</code> - column names<br>
 
<code>@+id/assetItem_assetNumber,@+id/assetItem_nfcTag</code> - target<br>
 
<code>@+id/assetItem_code</code> - key<br><br>
 
<code>[gn:act_rawQueryToWidgets]|[assetItems,assetItemsByCode;assetItem_assetNumber,assetItem_nfcTag;@+id/assetItem_assetNumber,@+id/assetItem_nfcTag;@+id/assetItem_code]</code>
 
 
<hr>
 
<hr>
  
Line 84: Line 84:
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| table
+
| <code>table</code>
 
| table name from which to query data
 
| table name from which to query data
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| query
+
| <code>query</code>
 
| query name defined in queries.xml
 
| query name defined in queries.xml
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| column{n}
+
| <code>column{n}</code>
 
| table column name from which value will be used
 
| table column name from which value will be used
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| [[target]]{n}
+
| <code>[[target]]{n}</code>
 
| [[target]] where the value from column will be stored
 
| [[target]] where the value from column will be stored
 
* Valid [[target|targets]]:
 
* Valid [[target|targets]]:
Line 107: Line 107:
  
 
====Example====
 
====Example====
 +
:<code>users</code> - table name<br>
 +
:<code>allUsers</code> - query name<br>
 +
:<code>userName,userSurname</code> - column names<br>
 +
:<code>@variable/userName,@+id/gnEditTextUserSurname</code> - target<br>
 +
:; ⤷ <code>[gn:act_rawQueryToWidgets]|[users,allUsers;userName,userSurname;@variable/userName, @+id/gnEditTextUserSurname]</code>
 +
 
=====queries.xml=====
 
=====queries.xml=====
 
<SyntaxHighlight lang="xml">
 
<SyntaxHighlight lang="xml">
Line 116: Line 122:
 
</SyntaxHighlight>
 
</SyntaxHighlight>
  
=====code=====
 
<code>users</code> - table name<br>
 
<code>allUsers</code> - query name<br>
 
<code>userName,userSurname</code> - column names<br>
 
<code>@variable/userName,@+id/gnEditTextUserSurname</code> - target<br><br>
 
<code>[gn:act_rawQueryToWidgets]|[users,allUsers;userName,userSurname;@variable/userName,@+id/gnEditTextUserSurname]</code>
 
 
<hr>
 
<hr>
  
 
===Query that returns specific set of data based on limit and skip parameters===
 
===Query that returns specific set of data based on limit and skip parameters===
  
;<code>[gn:act_rawQueryToWidgets]|[table,query,limit,skip;column{n};target{n};key{n}]</code>
+
:;<code>[gn:act_rawQueryToWidgets]|[table,query,limit,skip;column{n};target{n};key{n}]</code>
  
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
+
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
|-
 
|-
 
! scope="col" | Parameter
 
! scope="col" | Parameter
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| table
+
| <code>table</code>
 
| table name from which to query data
 
| table name from which to query data
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| query
+
| <code>query</code>
 
| query name defined in queries.xml
 
| query name defined in queries.xml
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| limit
+
| <code>limit</code>
 
| [[source]] value which defines the number of returned rows
 
| [[source]] value which defines the number of returned rows
 
Can be:
 
Can be:
 
* string
 
* string
* [[GnEditText]]
+
* <code>[[GnEditText]]</code>
* [[Datatypes#text|text]]
+
* <code>[[Datatypes#text|text]]</code>
* [[Datatypes#number|number]]
+
* <code>[[Datatypes#number|number]]</code>
 
|-
 
|-
| skip
+
| <code>skip</code>
 
| [[source]] value which defines the number of skipped rows
 
| [[source]] value which defines the number of skipped rows
 
Can be:
 
Can be:
* string
+
* <code>string</code>
* [[GnEditText]]
+
* <code>[[GnEditText]]</code>
* [[Datatypes#text|text]]
+
* <code>[[Datatypes#text|text]]</code>
* [[Datatypes#number|number]]
+
* <code>[[Datatypes#number|number]]</code>
 
|-
 
|-
| column{n}
+
| <code>column{n}</code>
 
| table column name from which value will be used
 
| table column name from which value will be used
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| [[target]]{n}
+
| <code>[[target]]{n}</code>
 
| [[target]] where the value from column will be stored
 
| [[target]] where the value from column will be stored
 
* Valid [[target|targets]]:
 
* Valid [[target|targets]]:
 
** any [[target]]
 
** any [[target]]
 
|-
 
|-
| key{n}
+
| <code>key{n}</code>
 
| key to use as values for query
 
| key to use as values for query
 
Can be:
 
Can be:
* [[Datatypes#text|text]]
+
* <code>[[Datatypes#text|text]]</code>
* [[Datatypes#number|number]]
+
* <code>[[Datatypes#number|number]]</code>
* [[Datatypes#status|status]]
+
* <code>[[Datatypes#status|status]]</code>
* [[Datatypes#dateTime|dateTime]]
+
* <code>[[Datatypes#dateTime|dateTime]]</code>
* [[Datatypes#pointer|pointer]]
+
* <code>[[Datatypes#pointer|pointer]]</code>
* [[Datatypes#assignment|assignment]]
+
* <code>[[Datatypes#assignment|assignment]]</code>
* [[Datatypes#date|date]]
+
* <code>[[Datatypes#date|date]]</code>
* [[Datatypes#time|time]]
+
* <code>[[Datatypes#time|time]]</code>
* [[Datatypes#counter|counter]]
+
* <code>[[Datatypes#counter|counter]]</code>
* [[Datatypes#rowsColumn|rowsColumn]]
+
* <code>[[Datatypes#rowsColumn|rowsColumn]]</code>
 
|-
 
|-
 
|}
 
|}
  
 
====Example====
 
====Example====
 +
:<code>bebraObjekte</code> - table name<br>
 +
:<code>bebraObjekteDropdownFalseStatus</code> - query name<br>
 +
:<code>10</code> - limit parameter<br>
 +
:<code>@+id/skipNumber</code> - skip parameter<br>
 +
:<code>ObjektNummer</code> - column name<br>
 +
:<code>@+id/bebraReport_ObjektNummer</code> - target<br>
 +
:<code>@variable/statusFalse,@variable/null</code> - key<br>
 +
:; ⤷ <code>[gn:act_rawQueryToWidgets]|[bebraObjekte,bebraObjekteDropdownFalseStatus,10, @+id/skipNumber;ObjektNummer;@+id/bebraReport_ObjektNummer;@variable/statusFalse,@variable/null]</code>
 +
 
=====queries.xml=====
 
=====queries.xml=====
 
<SyntaxHighlight lang="xml">
 
<SyntaxHighlight lang="xml">
Line 195: Line 204:
 
   keys="Status,ObjektNummer"/>
 
   keys="Status,ObjektNummer"/>
 
</SyntaxHighlight>
 
</SyntaxHighlight>
=====code=====
+
 
<code>bebraObjekte</code> - table name<br>
 
<code>bebraObjekteDropdownFalseStatus</code> - query name<br>
 
<code>10</code> - limit parameter<br>
 
<code>@+id/skipNumber</code> - skip parameter<br>
 
<code>ObjektNummer</code> - column name<br>
 
<code>@+id/bebraReport_ObjektNummer</code> - target<br>
 
<code>@variable/statusFalse,@variable/null</code> - key<br><br>
 
<code>[gn:act_rawQueryToWidgets]|[bebraObjekte,bebraObjekteDropdownFalseStatus,10,@+id/skipNumber;ObjektNummer;@+id/bebraReport_ObjektNummer;@variable/statusFalse,@variable/null]</code>
 
 
<hr>
 
<hr>
  
 
===Query with keys and queryType and no limit, skip parameters===
 
===Query with keys and queryType and no limit, skip parameters===
  
;<code>[gn:act_rawQueryToWidgets]|[table,query,,,queryType;column{n};target{n};key{n}]</code>
+
:;<code>[gn:act_rawQueryToWidgets]|[table,query,,,queryType;column{n};target{n};key{n}]</code>
  
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
+
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
|-
 
|-
 
! scope="col" | Parameter
 
! scope="col" | Parameter
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| table
+
| <code>table</code>
 
| table name from which to query data
 
| table name from which to query data
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| query
+
| <code>query</code>
 
| query name defined in queries.xml
 
| query name defined in queries.xml
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| queryType
+
| <code>queryType</code>
 
| defines type of query to be executed (See [[#Query_types_for_db_queries|Query types for db queries]])
 
| defines type of query to be executed (See [[#Query_types_for_db_queries|Query types for db queries]])
 
|-
 
|-
| column{n}
+
| <code>column{n}</code>
 
| table column name from which value will be used
 
| table column name from which value will be used
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| [[target]]{n}
+
| <code>[[target]]{n}</code>
 
| [[target]] where the value from column will be stored
 
| [[target]] where the value from column will be stored
 
* Valid [[target|targets]]:
 
* Valid [[target|targets]]:
 
** any [[target]]
 
** any [[target]]
 
|-
 
|-
| key{n}
+
| <code>key{n}</code>
 
| key to use as values for query
 
| key to use as values for query
 
Can be:
 
Can be:
* [[Datatypes#text|text]]
+
* <code>[[Datatypes#text|text]]</code>
* [[Datatypes#number|number]]
+
* <code>[[Datatypes#number|number]]</code>
* [[Datatypes#status|status]]
+
* <code>[[Datatypes#status|status]]</code>
* [[Datatypes#dateTime|dateTime]]
+
* <code>[[Datatypes#dateTime|dateTime]]</code>
* [[Datatypes#pointer|pointer]]
+
* <code>[[Datatypes#pointer|pointer]]</code>
* [[Datatypes#assignment|assignment]]
+
* <code>[[Datatypes#assignment|assignment]]</code>
* [[Datatypes#date|date]]
+
* <code>[[Datatypes#date|date]]</code>
* [[Datatypes#time|time]]
+
* <code>[[Datatypes#time|time]]</code>
* [[Datatypes#counter|counter]]
+
* <code>[[Datatypes#counter|counter]]</code>
* [[Datatypes#rowsColumn|rowsColumn]]
+
* <code>[[Datatypes#rowsColumn|rowsColumn]]</code>
 
|-
 
|-
 
|}
 
|}
  
 
====Example====
 
====Example====
 +
:<code>bebraObjekte</code> - table name<br>
 +
:<code>bebraObjekteDropdownFalseStatus</code> - query name<br>
 +
:<code>sort</code> - queryType<br>
 +
:<code>ObjektNummer</code> - column name<br>
 +
:<code>@+id/bebraReport_ObjektNummer</code> - target<br>
 +
:<code>@variable/statusFalse,@variable/null</code> - key<br><br>
 +
:; ⤷ <code>[gn:act_rawQueryToWidgets]|[bebraObjekte,bebraObjekteDropdownFalseStatus,,,sort;ObjektNummer;@+id/bebraReport_ObjektNummer;@variable/statusFalse,@variable/null]</code>
 +
 
=====queries.xml=====
 
=====queries.xml=====
 
<SyntaxHighlight lang="xml">
 
<SyntaxHighlight lang="xml">
Line 264: Line 273:
 
   keys="Status,ObjektNummer"/>
 
   keys="Status,ObjektNummer"/>
 
</SyntaxHighlight>
 
</SyntaxHighlight>
=====code=====
+
 
<code>bebraObjekte</code> - table name<br>
 
<code>bebraObjekteDropdownFalseStatus</code> - query name<br>
 
<code>sort</code> - queryType<br>
 
<code>ObjektNummer</code> - column name<br>
 
<code>@+id/bebraReport_ObjektNummer</code> - target<br>
 
<code>@variable/statusFalse,@variable/null</code> - key<br><br>
 
<code>[gn:act_rawQueryToWidgets]|[bebraObjekte,bebraObjekteDropdownFalseStatus,,,sort;ObjektNummer;@+id/bebraReport_ObjektNummer;@variable/statusFalse,@variable/null]</code>
 
 
<hr>
 
<hr>
  
 
===Query by range===
 
===Query by range===
  
;<code>[gn:act_rawQueryToWidgets]|[table,query;column{n};target{n};startKey{n};endKey{n}]</code>
+
:;<code>[gn:act_rawQueryToWidgets]|[table,query;column{n};target{n};startKey{n};endKey{n}]</code>
  
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
+
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
|-
 
|-
 
! scope="col" | Parameter
 
! scope="col" | Parameter
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| table
+
| <code>table</code>
 
| table name from which to query data
 
| table name from which to query data
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| query
+
| <code>query</code>
 
| query name defined in queries.xml
 
| query name defined in queries.xml
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| column{n}
+
| <code>column{n}</code>
 
| table column name from which value will be used
 
| table column name from which value will be used
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
** hardcoded value
 
** hardcoded value
 
|-
 
|-
| [[target]]{n}
+
| <code>[[target]]{n}</code>
 
| [[target]] where the value from column will be stored
 
| [[target]] where the value from column will be stored
 
* Valid [[target|targets]]:
 
* Valid [[target|targets]]:
 
** any [[target]]
 
** any [[target]]
 
|-
 
|-
| startKey{n}
+
| <code>startKey{n}</code>
 
| key to use as value for query
 
| key to use as value for query
 
Can be:
 
Can be:
* [[Datatypes#text|text]]
+
* <code>[[Datatypes#text|text]]</code>
* [[Datatypes#number|number]]
+
* <code>[[Datatypes#number|number]]</code>
* [[Datatypes#status|status]]
+
* <code>[[Datatypes#status|status]]</code>
* [[Datatypes#dateTime|dateTime]]
+
* <code>[[Datatypes#dateTime|dateTime]]</code>
* [[Datatypes#pointer|pointer]]
+
* <code>[[Datatypes#pointer|pointer]]</code>
* [[Datatypes#assignment|assignment]]
+
* <code>[[Datatypes#assignment|assignment]]</code>
* [[Datatypes#date|date]]
+
* <code>[[Datatypes#date|date]]</code>
* [[Datatypes#time|time]]
+
* <code>[[Datatypes#time|time]]</code>
* [[Datatypes#counter|counter]]
+
* <code>[[Datatypes#counter|counter]]</code>
* [[Datatypes#rowsColumn|rowsColumn]]
+
* <code>[[Datatypes#rowsColumn|rowsColumn]]</code>
 
|-
 
|-
| endKey{n}
+
| <code>endKey{n}</code>
 
| key to use as value for query
 
| key to use as value for query
 
Can be:
 
Can be:
* [[Datatypes#text|text]]
+
* <code>[[Datatypes#text|text]]</code>
* [[Datatypes#number|number]]
+
* <code>[[Datatypes#number|number]]</code>
* [[Datatypes#status|status]]
+
* <code>[[Datatypes#status|status]]</code>
* [[Datatypes#dateTime|dateTime]]
+
* <code>[[Datatypes#dateTime|dateTime]]</code>
* [[Datatypes#pointer|pointer]]
+
* <code>[[Datatypes#pointer|pointer]]</code>
* [[Datatypes#assignment|assignment]]
+
* <code>[[Datatypes#assignment|assignment]]</code>
* [[Datatypes#date|date]]
+
* <code>[[Datatypes#date|date]]</code>
* [[Datatypes#time|time]]
+
* <code>[[Datatypes#time|time]]</code>
* [[Datatypes#counter|counter]]
+
* <code>[[Datatypes#counter|counter]]</code>
* [[Datatypes#rowsColumn|rowsColumn]]
+
* <code>[[Datatypes#rowsColumn|rowsColumn]]</code>
 
|-
 
|-
 
|}
 
|}
  
 
====Example====
 
====Example====
 +
:<code>notificationTypes</code> - table name<br>
 +
:<code>notificationTypesDropdown2</code> - query name<br>
 +
:<code>notificationType_typeOfNotification</code> - column name<br>
 +
:<code>@+id/typeOfNotification</code> - target<br>
 +
:<code>@variable/value9</code> - start key<br>
 +
:<code>@variable/valueMax</code> - end key<br>
 +
:; ⤷ <code>[gn:act_rawQueryToWidgets]|[notificationTypes, notificationTypesDropdown2;notificationType_typeOfNotification;@+id/typeOfNotification;@variable/value9;@variable/valueMax]</code>
 +
 
=====queries.xml=====
 
=====queries.xml=====
 
<SyntaxHighlight lang="xml">
 
<SyntaxHighlight lang="xml">
Line 344: Line 354:
 
/>
 
/>
 
</SyntaxHighlight>
 
</SyntaxHighlight>
=====code=====
+
 
<code>notificationTypes</code> - table name<br>
 
<code>notificationTypesDropdown2</code> - query name<br>
 
<code>notificationType_typeOfNotification</code> - column name<br>
 
<code>@+id/typeOfNotification</code> - target<br>
 
<code>@variable/value9</code> - start key<br>
 
<code>@variable/valueMax</code> - end key<br><br>
 
<code>[gn:act_rawQueryToWidgets]|[notificationTypes,notificationTypesDropdown2;notificationType_typeOfNotification;@+id/typeOfNotification;@variable/value9;@variable/valueMax]</code>
 
 
<hr>
 
<hr>
  
Line 360: Line 363:
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| regular
+
| <code>regular</code>
 
| standard query
 
| standard query
 
|-
 
|-
| sort
+
| <code>sort</code>
 
| query that returns all matches sorted i.e. if by <code>timestamp</code>, from earliest to latest.  
 
| query that returns all matches sorted i.e. if by <code>timestamp</code>, from earliest to latest.  
 
In [[Database#queries.xml|queries.xml]] query <code>keys=”key,key,...,lastKey”</code>, <code>lastkey</code> must be the column by which we want to sort
 
In [[Database#queries.xml|queries.xml]] query <code>keys=”key,key,...,lastKey”</code>, <code>lastkey</code> must be the column by which we want to sort
 
|-
 
|-
| sortreverse
+
| <code>sortreverse</code>
 
| query that returns all matches sorted i.e. if by <code>timestamp</code>, from latest to earliest.  
 
| query that returns all matches sorted i.e. if by <code>timestamp</code>, from latest to earliest.  
 
In [[Database#queries.xml|queries.xml]] query <code>keys=”key,key,...,lastKey”</code>, <code>lastkey</code> must be the column by which we want to sort
 
In [[Database#queries.xml|queries.xml]] query <code>keys=”key,key,...,lastKey”</code>, <code>lastkey</code> must be the column by which we want to sort
 
|-
 
|-
| sorttop
+
| <code>sorttop</code>
| query that returns single first result and is sorted like <code>sort</code> query
+
| query that returns single first result and is sorted as per <code>sort</code> query
 
|-
 
|-
| sortreversetop
+
| <code>sortreversetop</code>
| query that returns single first result and is sorted like <code>sortreverse</code> query
+
| query that returns single first result and is sorted as per <code>sortreverse</code> query
 
|-
 
|-
| paging
+
| <code>paging</code>
 
| query that returns results with <code>limit</code> and <code>skip</code>, unsorted
 
| query that returns results with <code>limit</code> and <code>skip</code>, unsorted
 
|-
 
|-
| count
+
| <code>count</code>
 
| count returns number of matching row results
 
| count returns number of matching row results
 
|-
 
|-
 
|}
 
|}

Revision as of 15:44, 12 July 2017

gn:act_rawQueryToWidgets

Description
Action used to query data from database from multiple columns and store value to multiple targets.
Action returns
boolean

Action signatures

Query with keys

[gn:act_rawQueryToWidgets]|[table,query;column{n};target{n};key{n}]
Parameter Description
table table name from which to query data
query query name defined in queries.xml
column{n} table column name from which value will be used
target{n} target where the value from column will be stored
key{n} key to use as values for query

Can be:

Example

assetItems - table name
assetItemsByCode - query name
assetItem_assetNumber,assetItem_nfcTag - column names
@+id/assetItem_assetNumber,@+id/assetItem_nfcTag - target
@+id/assetItem_code - key
[gn:act_rawQueryToWidgets]|[assetItems,assetItemsByCode;assetItem_assetNumber, assetItem_nfcTag;@+id/assetItem_assetNumber,@+id/assetItem_nfcTag;@+id/assetItem_code]
queries.xml
<query 
  id="assetItemsByCode"
  columns="
    assetItem_assetNumber,
    assetItem_code,
    assetItem_nfcTag,
    assetItem_assignment"
  keys="assetItem_code" /> 

Query without keys

[gn:act_rawQueryToWidgets]|[table,query;column{n};target{n}]
Parameter Description
table table name from which to query data
query query name defined in queries.xml
column{n} table column name from which value will be used
target{n} target where the value from column will be stored

Example

users - table name
allUsers - query name
userName,userSurname - column names
@variable/userName,@+id/gnEditTextUserSurname - target
[gn:act_rawQueryToWidgets]|[users,allUsers;userName,userSurname;@variable/userName, @+id/gnEditTextUserSurname]
queries.xml
<query 
  id="allUsers"
  columns=" 
    userName,
    userSurname" />

Query that returns specific set of data based on limit and skip parameters

[gn:act_rawQueryToWidgets]|[table,query,limit,skip;column{n};target{n};key{n}]
Parameter Description
table table name from which to query data
query query name defined in queries.xml
limit source value which defines the number of returned rows

Can be:

skip source value which defines the number of skipped rows

Can be:

column{n} table column name from which value will be used
target{n} target where the value from column will be stored
key{n} key to use as values for query

Can be:

Example

bebraObjekte - table name
bebraObjekteDropdownFalseStatus - query name
10 - limit parameter
@+id/skipNumber - skip parameter
ObjektNummer - column name
@+id/bebraReport_ObjektNummer - target
@variable/statusFalse,@variable/null - key
[gn:act_rawQueryToWidgets]|[bebraObjekte,bebraObjekteDropdownFalseStatus,10, @+id/skipNumber;ObjektNummer;@+id/bebraReport_ObjektNummer;@variable/statusFalse,@variable/null]
queries.xml
<query 
  id="bebraObjekteDropdownFalseStatus"
  columns="
    ObjektNummer,
    Status" 
  keys="Status,ObjektNummer"/>

Query with keys and queryType and no limit, skip parameters

[gn:act_rawQueryToWidgets]|[table,query,,,queryType;column{n};target{n};key{n}]
Parameter Description
table table name from which to query data
query query name defined in queries.xml
queryType defines type of query to be executed (See Query types for db queries)
column{n} table column name from which value will be used
target{n} target where the value from column will be stored
key{n} key to use as values for query

Can be:

Example

bebraObjekte - table name
bebraObjekteDropdownFalseStatus - query name
sort - queryType
ObjektNummer - column name
@+id/bebraReport_ObjektNummer - target
@variable/statusFalse,@variable/null - key

[gn:act_rawQueryToWidgets]|[bebraObjekte,bebraObjekteDropdownFalseStatus,,,sort;ObjektNummer;@+id/bebraReport_ObjektNummer;@variable/statusFalse,@variable/null]
queries.xml
<query 
  id="bebraObjekteDropdownFalseStatus"
  columns="
    ObjektNummer,
    Status" 
  keys="Status,ObjektNummer"/>

Query by range

[gn:act_rawQueryToWidgets]|[table,query;column{n};target{n};startKey{n};endKey{n}]
Parameter Description
table table name from which to query data
query query name defined in queries.xml
column{n} table column name from which value will be used
target{n} target where the value from column will be stored
startKey{n} key to use as value for query

Can be:

endKey{n} key to use as value for query

Can be:

Example

notificationTypes - table name
notificationTypesDropdown2 - query name
notificationType_typeOfNotification - column name
@+id/typeOfNotification - target
@variable/value9 - start key
@variable/valueMax - end key
[gn:act_rawQueryToWidgets]|[notificationTypes, notificationTypesDropdown2;notificationType_typeOfNotification;@+id/typeOfNotification;@variable/value9;@variable/valueMax]
queries.xml
<query 
  id="notificationTypesDropdown2" 
  columns="
    notificationType_typeOfNotification,
    notificationType_typeId"
  keys="notificationType_typeId"
/>	

Query types for db queries

Query type Description
regular standard query
sort query that returns all matches sorted i.e. if by timestamp, from earliest to latest.

In queries.xml query keys=”key,key,...,lastKey”, lastkey must be the column by which we want to sort

sortreverse query that returns all matches sorted i.e. if by timestamp, from latest to earliest.

In queries.xml query keys=”key,key,...,lastKey”, lastkey must be the column by which we want to sort

sorttop query that returns single first result and is sorted as per sort query
sortreversetop query that returns single first result and is sorted as per sortreverse query
paging query that returns results with limit and skip, unsorted
count count returns number of matching row results