From wiki.ginstr.com
Revision as of 08:02, 2 April 2020 by Danijel (talk | contribs) (ACTION MESSAGES)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Load number of records of table

Widget is used to load total number(count) of records stored in a database table and to 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
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 attribute gn:act_beforeLoad as:
gn:act_beforeLoad="[gn:act_trigger]|[@+id/idOfCurrentWidget,gn:act_set]"
gn:act_set="Common widget 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:
[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:
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"
ACTION MESSAGES
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_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=""/>