Load number of records of table
Widget is used to load total number(count) of records stored in database "reports" table and set value into a widget.
Widget is hidden.
Widget id, ${gbamID}
:
actionLoadNumberOfRecordsTable
Back to GBAM widgets table
Datatypes
Value is stored into compatible widgets which are text
or number
datatype. Widgets which are not of same datatype should not be shown in the list of targets available to store the information.
Predefined user data
PreLoaded
Properties panel
User will configure this data in properties panels of selected widget:
GENERAL
- "label",
${widgetLabel}
VALIDATIONS
- -
internal validators
- -
ACTION
- "save number of rows to",
${targetWidgetId}
retrieved number of rows is stored into target widget - "on event" triggers the action in common widget code at specific event. Events are are listed in a dropdown can be:
screen load
widget code is added into root node of the screen in attributegn:act_beforeLoad
as:
gn:act_beforeLoad="[gn:act_trigger]|[@+id/idOfCurrentWidget,gn:act_set]" gn:act_set="Common widget code"
Button save
, trigger code:
[gn:act_trigger]|[@+id/idOfCurrentWidget,gn:act_set]
- as attribute to Button save widget:
gn:act_set="Common widget code"
- needs to be added to widget Button save at:
- Two options when to execute:
before
, then insert the trigger code after this line${listWidgetToVariable}
in snippet at Button_save#GBAM_Code_Variables:after
, then insert the trigger code after this line[gn:act_resetVariables]|[${listofVariableIds1}];
in snippet at Button_save#GBAM_Code_Variables
Button clean widgets
, trigger code:
[gn:act_trigger]|[@+id/idOfCurrentWidget,gn:act_set]
- as attribute to Button clean widgets widget:
gn:act_set="Common widget code"
- Two options when to execute:
before
, then insert the code after this line[gn:act_cleanWidgets]|[${listofWidgetIds}],[gn:act_resetVariables]|[${listofVariableIds}]
in snippet at Button_clean_widgets#GBAM_Code_Variablesafter
, then insert the code after this line[gn:act_cleanWidgets]|[${listofWidgetIds}],[gn:act_resetVariables]|[${listofVariableIds}]
in snippet at Button_clean_widgets#GBAM_Code_Variables
Button query
, trigger code:
- Two options when to execute:
- Two options when to execute:
[gn:act_trigger]|[@+id/idOfCurrentWidget,gn:act_set]
- as attribute to Button query widget:
gn:act_set="Common widget code"
before
, then insert the code before this line[gn:act_if]|[[gn:act_rawQueryToWidgets]|[...
in snippet at Button_query#GBAM_Code_Variablesafter
, then insert the code before this line[gn:act_hideKeyboard]|[]
in snippet at Button_query#GBAM_Code_Variables
ACTION MESSAGES
- "on no rights",
${$noReadRightsToast}
DATABASE
- -
Code snippets
GBAM Code Variables
Variables which are used in code snippet below but not defined in user modifiable inputs.
${widgetID}
,{variableId}
is generated based on the${widgetID}
${tableName}
${resultVariable}
, value is stored into variable after query before setting it to widget${targetWidgetId}
Common widget code
screen.xml
[gn:act_if]|[[gn:act_hasTableRights]|[${tableName}!=R]-- [gn:act_toast]|[@string/${$noReadRightsToast}]; [gn:act_break]|[]], [gn:act_cleanWidgets]|[@+id/${listOfWidgetIdsExceptQueryKey}], [gn:act_if]|[[gn:act_rawQueryCountToTarget]|[${tableName},${widgetID}${tableName};$count;@variable/${resultVariable};]-- [gn:act_getVariableToWidget]|[@variable/${resultVariable},@+id/${targetWidgetId}] ::]
queries.xml
Add to queries.xml :
<query id="${widgetID}${tableName}" columns=""/>