gn:act_copyDataNew
- Description
- Action used to copy content from source to target. Content that is copied ALWAYS REPLACES the content in target. Source and target have to be of same datatype unless there is a supported conversion.
- For supported conversions see table below.
- Action returns
- boolean,
true
if content was successfully copied otherwisefalse
Source Target pointer
text
text
pointer
email
pointer
email
text
number
pointer
text
number
date
long
dateTime
long
enum
text
fingerprint
rows
Action signatures
Copy data
[gn:act_copyDataNew]|[actionType;source(indexSource)(columnSource),target(indexTarget)(columnTarget)]
Parameter Description actionType
optionalsource type of copy operation. By default is
set
.It requires widget to have attibutegn:updateRowsKeyColumn
defined (currently only GnTableView supports it. It is recommended to useupdate
action type when setting data into widgets that hold collections such as GnListView , GnTableView, GnDropDown, where inflation(parsing) of views takes place.source
source from where the value will be copied target
target where the value will be stored indexSource
indexTarget
optionalsource or target which will be used as index for source and target, needs to be an integer
columnSource
columnTarget
optionalsource or target which will be used as column name within a row or complex datatype.
- Examples of row operation signatures from rows to rows datatype with index
[gn:act_copyDataNew]|[@variable/rows,@variable/targetRows]
[gn:act_copyDataNew]|[@variable/rows(indexSource)(),@variable/targetRows]
[gn:act_copyDataNew]|[@variable/rows(indexSource)(),@variable/targetRows(indexTarget)()]
- Examples of row operation signatures from rows to rows datatype with column
[gn:act_copyDataNew]|[@variable/rows()(columnSource),@variable/targetRows()(columnTarget)]
source and target have single row
- Examples of row operation signatures from rows to rows datatype with index and column
[gn:act_copyDataNew]|[@variable/rows(indexSource)(columnSource),@variable/targetRows(indexTarget)(columnTarget)]
[gn:act_copyDataNew]|[@variable/rows()(columnSource),@variable/targetRows(indexTarget)(columnTarget)]
source has single row[gn:act_copyDataNew]|[@variable/rows(indexSource)(columnSource),@variable/targetRows()(columnTarget)]
target has single row
- Examples of datatype internal operation signatures with index and column
[gn:act_copyDataNew]|[@variable/emails,@variable/emailsNew]
[gn:act_copyDataNew]|[@variable/emails(indexSource)(columnSource),@variable/text]
[gn:act_copyDataNew]|[@variable/emails()(columnSource),@variable/text]
source has single row[gn:act_copyDataNew]|[@variable/emails(indexSource)(),@variable/emailsNew]
[gn:act_copyDataNew]|[@variable/enum()(key),@variable/enumText]
[gn:act_copyDataNew]|[@variable/enum()(value),@variable/enumText]
(M104)
- Example of datatype pointer to datatype text (extraction of email)
[gn:act_copyDataNew]|[@variable/employee_userIdPointer()(value),@variable/employee_testEmail]
[gn:act_copyDataNew]|[@variable/employee_testEmail()(email),@variable/employee_testEmailText]
Example 1
initial value
@variable/allReportRows
- 3 rows with 10 columns each@variable/allReportRowsCopy
- empty
variables.xml
<variable id="allReportRows" type="rows"/> <variable id="allReportRowsCopy" type="rows"/>
screen.xml
<com.ginstr.widgets.GnEditText android:id="@+id/screen_integerNumberLabel_input" android:layout_height="wrap_content" android:layout_width="match_parent" gn:dataType="number" gn:inputType="NUMBER" gn:s_decimalFormat="#" gn:s_sourceType="input" gn:style="@style/numberInteger_input"/> <FrameLayout android:id="@+id/exampleFrame" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" gn:act_set="[gn:act_copyDataNew]|[@variable/allReportRows(@+id/screen_integerNumberLabel_input)(),@variable/allReportRowsCopy]" />
after action execution
if numerical value i.e. 0 was defined at widget @+id/screen_integerNumberLabel_input
@variable/allReportRowsCopy
- 0'th row from@variable/allReportRows
Example 2
initial value
@variable/allReportRows
- 3 rows with 10 columns each@variable/allReportRowsCopy
- empty
variables.xml
<variable id="allReportRows" type="rows"/> <variable id="allReportRowsCopy" type="rows"/>
screen.xml
<com.ginstr.widgets.GnEditText android:id="@+id/screen_integerNumberLabel_input" android:layout_height="wrap_content" android:layout_width="match_parent" gn:dataType="number" gn:inputType="NUMBER" gn:s_decimalFormat="#" gn:s_sourceType="input" gn:style="@style/numberInteger_input"/> <FrameLayout android:id="@+id/exampleFrame" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" gn:act_set="[gn:act_copyDataNew]|[@variable/allReportRows(@+id/screen_integerNumberLabel_input)(),@variable/allReportRowsCopy]" />
after action execution
if numerical value i.e. 0 was defined at widget @+id/screen_integerNumberLabel_input
@variable/allReportRowsCopy
- 0'th row from@variable/allReportRows
if widget@+id/screen_integerNumberLabel_input
is empty
@variable/allReportRowsCopy
- all rows from@variable/allReportRows
Example 3
initial value
@+id/screen_mediaPhotoLabel_button
- widget contains 3 images loaded from database@+id/screen_textLabel_fileInfo
- empty input field
screen.xml
<com.ginstr.widgets.GnMediaAction android:id="@+id/screen_mediaPhotoLabel_button" android:layout_height="wrap_content" android:layout_width="wrap_content" gn:act_setAfterMediaTaken="[gn:act_copyDataNew]|[@+id/screen_mediaPhotoLabel_button,@+id/screen_mediaPhotoLabel_gallery]" gn:dataType="pictures" gn:maxMediaTaken="5" gn:s_actionType="photo" gn:singleValueMode="false" gn:style="@style/mediaPhoto_button"/> <com.ginstr.widgets.GnEditText android:id="@+id/screen_textLabel_fileInfo" android:layout_height="wrap_content" android:layout_width="match_parent" gn:dataType="text" gn:s_hint="@string/fileInfo" gn:s_sourceType="input" gn:style="@style/textEditable_input"/> <FrameLayout android:id="@+id/exampleFrame" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" gn:act_set="[gn:act_copyDataNew]|[@+id/screen_mediaPhotoLabel_button(0)(filename),@+id/screen_textLabel_fileInfo]" />
after action execution
@+id/screen_textLabel_fileInfo
- input field will show name of the first file that is stored in@+id/screen_mediaPhotoLabel_button
widget
Example 4
initial value
@variable/takeover_fuelLevel
- source variable contains enum DT value
screen.xml
[gn:act_copyDataNew]|[@variable/takeover_fuelLevel()(key),@variable/takeover_fuelLevelTextKey];
after action execution
@variable/takeover_fuelLevelTextKey
- target variable which will store text value from@variable/takeover_fuelLevel
based on key
Example 5
initial value
@variable/stopPointsRows
- source variable contains rows DT , one of columns in those rows is "sequenceNumber" which is unique
screen.xml
<com.ginstr.widgets.GnTableView android:id="@+id/stopPointsRows" android:layout_width="match_parent" android:layout_height="match_parent" gn:rowXmlDefinition="travellingExpensesDaily_row.xml" gn:updateRowsKeyColumn="sequenceNumber"/> <FrameLayout android:id="@+id/myCallbackBlock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" gn:act_set="[gn:act_copyDataNew]|[update;@variable/stopPointsRows,@+id/stopPointsRows]"/>
after action execution
@+id/stopPointsRows
- target widget contains updated values which are matched based onsequenceNumber
. Mapping from columns to widgets in row is performed is done by matching widget id's with column names.