From wiki.ginstr.com
Jump to: navigation, search

gn:act_rawQueryCountToTarget

Description
Action used to execute query by queries defined in queries.xml to count the rows returned and stores result into a target.
Action returns
boolean

Action signatures

Query no keys

[gn:act_rawQueryCountToTarget]|[table,query;$count;target]
Parameter Description
table table name from which to query data
  • Valid sources:
    • hardcoded value - to be able to query the table from the external app use @externalTable/appId_tableId syntax
query query name defined in queries.xml
$count special column identifier which returns count
target target where the value from column will be stored

Example

meters - table name
metersByTimeStampAndEntity - query name
$count - special column
@+id/locationResultCount - target
[gn:act_rawQueryCountToTarget]|[meters,metersByTimeStampAndEntity;$count;@+id/locationResultCount]

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]|[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" />