From wiki.ginstr.com
Jump to: navigation, search
(VALIDATIONS)
(ACTION MESSAGES)
 
Line 54: Line 54:
  
 
======ACTION MESSAGES======
 
======ACTION MESSAGES======
* "on no rights", [[GBAMRulesForIDGeneration#STRING_RESOURCE_ID.27S_.40string.2F|<code>${$noReadRightsToast}</code>]]
+
* "message in case of missing read rights", [[GBAMRulesForIDGeneration#STRING_RESOURCE_ID.27S_.40string.2F|<code>${$noReadRightsToast}</code>]]
* "on no result", [[GBAMRulesForIDGeneration#STRING_RESOURCE_ID.27S_.40string.2F|<code>${$noResultToast}</code>]]
+
* "message shown in case the query initiated by a QR-code scan does not return any result", [[GBAMRulesForIDGeneration#STRING_RESOURCE_ID.27S_.40string.2F|<code>${$noResultToast}</code>]]
  
 
=====DATABASE=====
 
=====DATABASE=====

Latest revision as of 08:47, 6 April 2020

Qr text read only query / horizontal

Widget is used for scanning and querying barcode values. Value will be stored as datatype TEXT.

Widget id, ${gbamID} see alignment

Back to GBAM widgets table

Datatypes

Value is stored from widget to database as text datatype.

Predefined user data

PreLoaded

Properties panel

User will configure this data in properties panels of selected widget:

GENERAL
VALIDATIONS
<columnText>
    <len>null|>=0|<=10000</len>
</columnText>
  • "unique", check uniqueness when widget gets saved into db, having "is part of database" checked, add to configuration.xml:
    <columnText unique="true|false"></columnText>
ACTION
  • "choose query type", ${queryType} based on query type different queries will be activated. current query types:
    • query single result singleResult
    • query sorted result sortedResult
  • "widgets to load", ${listOfDbWidgets}, list of comma separated ${widgetID} widget id's. All widgets on screen which have checkbox "is part of database", user can change selection.
  • "sort key", visible only if query sorted result is selected ${sortByWidgetId} by default it's equal to GnEditText android:id value of current widget . User can change it to any widget which have checkbox "is part of database".
  • "clean widgets on no result", cleans widgets that receive result if nothing is returned ${cleanWidgetsOnNoResult}, only if checkbox selected. By default is selected
ACTION MESSAGES
DATABASE
  • "is part of database", checkbox option by default is set as checked. When checked database column is created for this widget.
  • "additional ginstr web column settings":
  • "align text", radio button options with values: "left", "middle", "right", add to configuration.xml:
<columnText>
    <horizontalAlignment>left|center|right</horizontalAlignment>
</columnText>
  • "list of allowed values" array with list of allowed values, add to configuration.xml:
<columnText>
  <valuesList>
    <value>val1</value>
    <value>val2</value>
  </valuesList>
</columnText>
  • "pattern", add to configuration.xml:
<columnText>
    <pattern errorMessage="invalidTextTableValue">[0-9A-Z]{3}</pattern>
</columnText>
  • "related unique columns", add to configuration.xml:
<columnText>
    <uniqueInsideList>
        <reference>
          <table>refTableId1</table>
          <column>refColumnField1</column>
        </reference>
        <reference>
          <table>refTableId2</table>
          <column>refColumnField2</column>
        </reference>
    </uniqueInsideList>
</columnText>

Code snippets

GBAM Code Variables

Variables which are used in code snippet below but not defined in user modifiable inputs.

  • ${widgetID}
  • ${tableName}
  • ${variableToWidgetList} = ${[gn:act_getVariableToWidget]|@variable/${widgetID},@+id/${widgetID}];} - repeats as many times as is the number of widgets with "is part of database" checked, last repetition does not have ";" , except widget@+id/${widgetID}_input
  • ${reloadAutoFilledWidgetsIfDateTimeWidgetsPresent} = ${[gn:act_reloadAutoFilledWidgets]|[@+id/${dateTimeWidgetAsSortKey}];} - it should only exist if Timestamp widget is added to screen
  • ${listOfWidgetIdsExceptQueryKey} - all widgets on screen which have checkbox "is part of database", except GnEditText node android:id=@+id/${widgetID}_input of buttonQuery widget which is used as key.
  • ${listofVariableIds} - comma separated list of @variable/${widgetID}. Represents all variables (related to widgets) which have checkbox "is part of database", except @variable/${widgetID}_input
  • ${listOfDbColumnIds} - comma separated list of ${columnName} column names. Represents all widgets/variables which have checkbox "is part of database", except @+id/${widgetID}_input
  • ${keyDbColumn} - column name of GnEditText node widget which used as key
  • ${sortByWidgetId} is only added if ${queryType} = sortedResult
 [gn:act_setVariable]|[@variable/${sortByWidgetId},@+id/${sortByWidgetId}],
  • ${queryType} = singleResult
[gn:act_rawQueryToWidgets]|[${tableName},${widgetID}_input;${listOfDbColumnIds};${listofVariableIds};@variable/${widgetID}_input]


in queries.xml, ${queriesXml}=

    <query
        id="${widgetID}_input${tableName}" 
        columns="${listOfDbColumnIds}"
        keys="${keyDbColumn}"/>
  • ${queryType} = sortedResult
[gn:act_rawQueryToWidgets]|[${tableName},${widgetID}_input${tableName},,,sortreversetop;${listOfDbColumnIds};${listofVariableIds};@variable/${widgetID}_input,@variable/${sortByWidgetId}]


in queries.xml, ${queriesXml}=

    <query
        id="${widgetID}_input${tableName}" 
        columns="${listOfDbColumnIds}"
        keys="${keyDbColumn},${sortDbColumn}"/>
  • ${cleanWidgetsOnNoResult} following code for clean is added if checkbox is selected:
    [gn:act_cleanWidgets]|[@+id/${listOfWidgetIdsExceptQueryKey}],
    [gn:act_resetVariables]|[@variable/${listOfDbWidgets}]

Available layouts

vertical layout

Common widget code

<!--qrTextReadOnlyQuery-->
<com.ginstr.widgets.GnTextView
    android:id="@+id/${widgetID}_label"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/${widgetID}"
    gn:style="@style/qrTextReadOnlyQuery_label"/>
   
<com.ginstr.widgets.GnEditText
   android:id="@+id/${widgetID}_input"
   android:layout_height="wrap_content"
   android:layout_width="match_parent"
   gn:s_customLayoutXml="widget_en_qrcode_read_only.xml"
   gn:dataType="text"
   gn:s_hint="@string/${widgetID}Hint"
   gn:s_sourceType="qr"
   gn:act_setOnQr="
	[gn:act_if]|[[gn:act_hasTableRights]|[${tableName}!=R]--
		  [gn:act_toast]|[@string/${$noReadRightsToast}];
		  [gn:act_break]|[]],
	[gn:act_if]|[[gn:act_validateScreen]|[@+id/${widgetID}_input]--::[gn:act_break]|[]],
	[gn:act_cleanWidgets]|[@+id/${listOfWidgetIdsExceptQueryKey}],
	[gn:act_resetVariables]|[@variable/${listOfDbWidgets}],
	${reloadAutoFilledWidgetsIfDateTimeWidgetsPresent},
	[gn:act_setVariable]|[@variable/${widgetID}_input,@+id/${widgetID}_input],
        ${sortByWidgetId},
	[gn:act_if]|[${queryType}--
		${variableToWidgetList}
	::
                ${cleanWidgetsOnNoResult},
		[gn:act_toast]|[@string/$noResultToast]],
	[gn:act_hideKeyboard]|[]"/>

horizonal layout

<!--qrTextReadOnlyQueryHorizontal-->
<com.ginstr.widgets.GnTextView
    android:id="@+id/${widgetID}_label"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/${widgetID}"
    gn:style="@style/qrTextReadOnlyQueryHorizontal_label"/>
   
<com.ginstr.widgets.GnEditText
   android:id="@+id/${widgetID}_input"
   android:layout_height="wrap_content"
   android:layout_width="match_parent"
   gn:s_customLayoutXml="widget_en_qrcode_read_only_horizontal.xml"
   gn:dataType="text"
   gn:s_hint="@string/${widgetID}Hint"
   gn:s_sourceType="qr"
   gn:act_setOnQr="
	[gn:act_if]|[[gn:act_hasTableRights]|[${tableName}!=R]--
		  [gn:act_toast]|[@string/${$noReadRightsToast}];
		  [gn:act_break]|[]],
	[gn:act_if]|[[gn:act_validateScreen]|[@+id/${widgetID}_input]--::[gn:act_break]|[]],
	[gn:act_cleanWidgets]|[@+id/${listOfWidgetIdsExceptQueryKey}],
	[gn:act_resetVariables]|[@variable/${listOfDbWidgets}],
	${reloadAutoFilledWidgetsIfDateTimeWidgetsPresent},
	[gn:act_setVariable]|[@variable/${widgetID}_input,@+id/${widgetID}_input],
        ${sortByWidgetId},
	[gn:act_if]|[${queryType}--
		${variableToWidgetList}
	::
                ${cleanWidgetsOnNoResult},
		[gn:act_toast]|[@string/$noResultToast]],
	[gn:act_hideKeyboard]|[]"/>

strings.xml

Lines to be added for each language.

<string name="${widgetID}">${widgetLabel}</string>

queries.xml

Add to queries.xml : ${queriesXml}

Internal controls layout for widget (vertical)

Internal controls layout for widget (horizontal)