From wiki.ginstr.com
Revision as of 16:13, 12 July 2017 by Mark (talk | contribs) (formatting)
Jump to: navigation, search

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
query query name defined in queries.xml
$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:

Example

meters - table name
metersByTimeStampAndEntity - 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
query query name defined in queries.xml
viewType used for special purpose

Can be:

  • SPLIKEYVALUES - used to notify this action to split each key value by or , 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:

Example

residents - table name
residentsByNameOrSurnameOrRoomOrBuilding - query name
SPLITKEYVALUES - 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" />