m (formatting) |
|||
Line 9: | Line 9: | ||
===Query with keys=== | ===Query with keys=== | ||
− | ;<code>[gn:act_rawQueryCountToTarget]| [table,query;$count;target;key{n}]</code> | + | :;<code>[gn:act_rawQueryCountToTarget]| [table,query;$count;target;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 | ||
|- | |- | ||
− | | $count | + | | <code>$count</code> |
| special column identifier which returns count | | special column identifier which returns count | ||
|- | |- | ||
− | | [[target]] | + | | <code>[[target]]</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>meters</code> - table name<br> | ||
+ | :<code>metersByTimeStampAndEntity</code> - query name<br> | ||
+ | :<code>$count</code> - special column<br> | ||
+ | :<code>@+id/locationResultCount</code> - target<br> | ||
+ | :<code>@variable/entityList,@variable/true,@variable/startDate</code> - start keys<br> | ||
+ | :<code>@variable/entityList,@variable/true,@variable/endDate</code> - end keys<br> | ||
+ | :; ⤷ <code>[gn:act_rawQueryCountToTarget]|[gn:act_rawQueryCountToTarget]|[meters,metersByTimeStampAndEntity;$count;@+id/locationResultCount;@variable/entityList, @variable/true, @variable/startDate;@variable/entityList, @variable/true, @variable/endDate]</code> | ||
+ | |||
=====queries.xml===== | =====queries.xml===== | ||
<SyntaxHighlight lang="xml"> | <SyntaxHighlight lang="xml"> | ||
Line 61: | Line 69: | ||
</SyntaxHighlight> | </SyntaxHighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<hr> | <hr> | ||
− | ===Query with keys where the keys are split by SPLITKEYVALUES=== | + | ===Query with keys where the keys are split by <code>SPLITKEYVALUES</code>=== |
− | ;<code>[gn:act_rawQueryCountToTarget]| [table,query,viewType;$count;target;key{n}]</code> | + | :;<code>[gn:act_rawQueryCountToTarget]| [table,query,viewType;$count;target;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 | ||
|- | |- | ||
− | | viewType | + | | <code>viewType</code> |
| used for special purpose | | used for special purpose | ||
Can be: | Can be: | ||
* <code>SPLIKEYVALUES</code> - used to notify this action to split each key value by <code> </code> or <code>,</code> and to execute queries for each split key | * <code>SPLIKEYVALUES</code> - used to notify this action to split each key value by <code> </code> or <code>,</code> and to execute queries for each split key | ||
|- | |- | ||
− | | $count | + | | <code>$count</code> |
| special column identifier which returns count | | special column identifier which returns count | ||
|- | |- | ||
− | | [[target]] | + | | <code>[[target]]</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>residents</code> - table name<br> | ||
+ | :<code>residentsByNameOrSurnameOrRoomOrBuilding</code> - query name<br> | ||
+ | :<code>SPLITKEYVALUES</code> - viewType<br> | ||
+ | :<code>$count</code> - special column<br> | ||
+ | :<code>@+id/residentsResultCount</code> - target<br> | ||
+ | :<code>@+id/Sub_residentsNameSurname</code> - key<br> | ||
+ | :; ⤷ <code>[gn:act_rawQueryCountToTarget]|[residents, residentsByNameOrSurnameOrRoomOrBuilding, SPLITKEYVALUES;$count;@+id/residentsResultCount;@+id/residentsNameSurname]</code> | ||
+ | |||
=====queries.xml===== | =====queries.xml===== | ||
<SyntaxHighlight lang="xml"> | <SyntaxHighlight lang="xml"> | ||
Line 133: | Line 141: | ||
keys="resident_firstName,resident_lastName,resident_roomNo,resident_buildingCode" /> | keys="resident_firstName,resident_lastName,resident_roomNo,resident_buildingCode" /> | ||
</SyntaxHighlight> | </SyntaxHighlight> | ||
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<hr> | <hr> |
Revision as of 16:13, 12 July 2017
gn:act_rawQueryCountToTarget
- Description
- Action used to execute query counts the rows returned and stores result into a target.
- Action returns
- void
Action signatures
Query with keys
[gn:act_rawQueryCountToTarget]| [table,query;$count;target;key{n}]
Parameter Description table
table name from which to query data - Valid sources:
- hardcoded value
query
query name defined in queries.xml - Valid sources:
- hardcoded value
$count
special column identifier which returns count target
target where the value from column will be stored key{n}
key to use as values for query Can be:
- Valid sources:
Example
meters
- table namemetersByTimeStampAndEntity
- query name$count
- special column@+id/locationResultCount
- target@variable/entityList,@variable/true,@variable/startDate
- start keys@variable/entityList,@variable/true,@variable/endDate
- end keys
- ⤷
[gn:act_rawQueryCountToTarget]|[gn:act_rawQueryCountToTarget]|[meters,metersByTimeStampAndEntity;$count;@+id/locationResultCount;@variable/entityList, @variable/true, @variable/startDate;@variable/entityList, @variable/true, @variable/endDate]
- ⤷
queries.xml
<query id="metersByTimeStampAndEntity" columns=" meter_meterGroup, meter_economicEntity" keys="meter_economicEntity,meter_status,meter_currentReadingTimestamp" />
Query with keys where the keys are split by SPLITKEYVALUES
[gn:act_rawQueryCountToTarget]| [table,query,viewType;$count;target;key{n}]
Parameter Description table
table name from which to query data - Valid sources:
- hardcoded value
query
query name defined in queries.xml - Valid sources:
- hardcoded value
viewType
used for special purpose Can be:
SPLIKEYVALUES
- used to notify this action to split each key value by,
and to execute queries for each split key
$count
special column identifier which returns count target
target where the value from column will be stored key{n}
key to use as values for query Can be:
- Valid sources:
Example
residents
- table nameresidentsByNameOrSurnameOrRoomOrBuilding
- query nameSPLITKEYVALUES
- viewType$count
- special column@+id/residentsResultCount
- target@+id/Sub_residentsNameSurname
- key
- ⤷
[gn:act_rawQueryCountToTarget]|[residents, residentsByNameOrSurnameOrRoomOrBuilding, SPLITKEYVALUES;$count;@+id/residentsResultCount;@+id/residentsNameSurname]
- ⤷
queries.xml
<query id="residentsByNameOrSurnameOrRoomOrBuilding" columns=" resident_firstName, resident_lastName, resident_nfcTagUid, resident_roomNo, resident_buildingCode" type="INDEX" keys="resident_firstName,resident_lastName,resident_roomNo,resident_buildingCode" />