From wiki.ginstr.com
Jump to: navigation, search
m (Mark moved page Gn:act setVariable to gn:act setVariable)
Line 3: Line 3:
 
[[Category:Action_Library]]
 
[[Category:Action_Library]]
  
<code>[[gn:act_setVariable]]</code> loads value from target and stores it to variable.
+
;Description: Action used to load value from target and stores it to variable.
  
;Can be used on widgets: any widget
+
;Action returns: void
 +
==Action signatures==
  
;Event trigger for action: no event, must be used in action set or conditional action.
+
===Load value to variable===
  
;Can be used as: a [[:Category:Actions#Action_types|no event action]]
+
;<code>[gn:act_setVariable]|[target,source]</code>
  
;Additional required attributes on bound widget: none
+
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 +
|-
 +
! scope="col" | Parameter
 +
! scope="col" | Description
 +
|-
 +
| [[target]]
 +
| [[target]] where the value will be stored
 +
* Valid [[target|targets]]:
 +
** any [[:Category:variables|variable]]
 +
|-
 +
| [[source]]
 +
| [[source]] from where the value will be used
 +
* Valid [[source|sources]]:
 +
** any [[source]]
 +
|-
 +
|}
  
==Action signature==
+
====Example====
;<code>[gn:act_setVariable]|[@variable/variableId,target]</code>
+
<code>@variable/admin</code> - [[:Category:variables|variable]]<br>
==Value field content==
+
<code>true</code> - hardcoded value<br><br>
;<code>@variable/variableId</code>: id of the variable which value will be stored to
+
<code>[gn:act_setVariable]|[@variable/admin,true]</code>
;<code>target</code>: id of widget from which value needs to be taken
+
<hr>
It is possible to take value stored in target and set it to variable. At present following ways to set variable are possible from either [[#widgets|widgets]] or [[#variables|variables]].
 
===widgets===
 
From widgets <code>“@+id/widgetId“</code> to variable supported:
 
*to variable <code>type=”string”</code> from:
 
**<code>[[GnEditText]]</code>
 
**<code>[[GnDropDown]]</code> – stores selected dropdown item value
 
**<code>[[GnTextView]]</code>
 
**<code>[[GnPhoneAction]]</code> – stores to widget value defined by action type (i.e. <code>[[GnPhoneAction#gn:s_phone|gn:s_phone]]</code>, <code>[[GnPhoneAction#gn:s_email|gn:s_email]]</code>,..)
 
*to variable <code>type=”integer”</code> from <code>[[GnEditText]]</code>
 
*to variable <code>type=”long”</code> from:
 
**<code>[[GnEditText]]</code>, <code>[http://developer.android.com/reference/android/widget/EditText.html EditText]</code>
 
**<code>[[GnTextView]]</code>
 
**<code>[http://developer.android.com/reference/android/widget/DatePicker.html DatePicker]</code>, <code>[[GnDatePicker]]</code>
 
**<code>[[GnDateTimePicker]]</code>
 
*to variable <code>type=”boolean”</code> from:
 
**<code>[[GnEditText]]</code>
 
**<code>[[GnCheckBox]]</code>
 
*to variable <code>type=”text”</code> from:
 
**<code>[[GnEditText]]</code>
 
**<code>[[GnDropDown]]</code> – stores selected dropdown item value
 
**<code>[[GnTextView]]</code>
 
**<code>[[GnPhoneAction]]</code> – stores to widget value defined by action type (i.e. <code>[[GnPhoneAction#gn:s_phone|gn:s_phone]]</code>, <code>[[GnPhoneAction#gn:s_email|gn:s_email]]</code>,..)
 
*to variable <code>type=”number”</code> from:
 
**<code>[[GnEditText]]</code>
 
**<code>[[GnTextView]]</code>
 
*to variable <code>type=”status”</code> from:
 
**<code>[[GnEditText]]</code>
 
**<code>[[GnCheckBox]]</code>
 
*to variable <code>type=”dateTime”</code> from:
 
**<code>[[GnEditText]]</code>
 
**<code>[http://developer.android.com/reference/android/widget/DatePicker.html DatePicker]</code>, <code>[[GnDatePicker]]</code>
 
**<code>[[GnDateTimePicker]]</code>
 
*to variable <code>type=”date”</code> from:
 
**<code>[[GnEditText]]</code>
 
**<code>[http://developer.android.com/reference/android/widget/DatePicker.html DatePicker]</code>, <code>[[GnDatePicker]]</code>
 
*to variable <code>type=”phoneNumbers”</code> from:
 
**<code>[[GnEditText]]</code> – value will get stored as single phone number to variable
 
**<code>[[GnPhoneNumber]]</code>
 
**<code>[[GnPhoneAction]]</code> – value will get stored as single phone number to variable when widget action is set to <code>[[GnPhoneAction#gn:s_phone|gn:s_phone]]</code> or <code>[[GnPhoneAction#gn:s_sms|gn:s_sms]]</code>
 
*to variable <code>type=”pointer”</code> from:
 
**<code>[[GnDropDown]]</code> – selects item by pointer id, if it’s <code>null</code> then by value
 
**<code>[[GnEditText]]</code> – value will be set as pointer id and pointer value will be <code>null</code>
 
*to variable <code>type=”signature”</code> from <code>[[GnCaptureSignature]]</code>
 
*to variable <code>type=”pictures”</code> from <code>[[GnMediaAction]]</code>
 
*to variable <code>type=”audio”</code> from <code>[[GnMediaAction]]</code>
 
*to variable <code>type=”video”</code> from <code>[[GnMediaAction]]</code>
 
*to variable <code>type=”documents”</code> to <code>[[GnMediaAction]]</code>
 
*to variable <code>type=”email”</code> from:
 
**<code>[[GnEditText]]</code> – value will get stored as single email to variable
 
**<code>[[GnEmail]]</code>
 
**<code>[[GnPhoneAction]]</code> – stores to widget value defined by action type <code>[[GnPhoneAction#gn:s_email|gn:s_email]]</code>
 
*to variable <code>type=”Gps”</code> from <code>[[GnEditText]]</code>
 
 
 
===variables===
 
*from <code>@variable/someVariableId</code> to identical type variable
 
::i.e. from variable <code>“text”</code> to variable <code>“text”</code>
 

Revision as of 10:12, 10 March 2017

gn:act_setVariable

Description
Action used to load value from target and stores it to variable.
Action returns
void

Action signatures

Load value to variable

[gn:act_setVariable]|[target,source]
Parameter Description
target target where the value will be stored
source source from where the value will be used

Example

@variable/admin - variable
true - hardcoded value

[gn:act_setVariable]|[@variable/admin,true]