From wiki.ginstr.com
Jump to: navigation, search
(Action signatures)
(Download attachment with callback)
Line 51: Line 51:
 
===Download attachment with callback===
 
===Download attachment with callback===
  
:;<code>[gn:act_getAttachmentFromServer]|[tableName,rowId,columnName]</code>
+
:;<code>[gn:act_getAttachmentFromServer]|[tableName,rowId,columnName;callbackSourceId,callbackEvent]</code>
  
 
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
Line 64: Line 64:
 
|<code>rowId</code>
 
|<code>rowId</code>
 
|internal id of row which contains attachment information.
 
|internal id of row which contains attachment information.
 +
* Valid [[target|target]] should be of datatype <code>text</code>
 +
|-
 +
|<code>timeout</code>
 +
|connection timeout
 
* Valid [[target|target]] should be of datatype <code>text</code>
 
* Valid [[target|target]] should be of datatype <code>text</code>
 
|-
 
|-
 
|<code>columnName</code>
 
|<code>columnName</code>
 
|Name of the column within the row which contains attachment information
 
|Name of the column within the row which contains attachment information
 +
* Valid [[target|target]] should be of datatype <code>text</code>
 +
|-
 +
|<code>callbackSourceId</code>
 +
|widget which contains callbackEvent
 +
|-
 +
|<code>callbackEvent</code>
 +
|callback event which contains a set of actions which will be executed after the file is downloaded
 
* Valid [[target|target]] should be of datatype <code>text</code>
 
* Valid [[target|target]] should be of datatype <code>text</code>
 
|}
 
|}
  
 
====Example====
 
====Example====
=====variables.xml=====
+
:<code>systems</code> - tableName<br>
<syntaxhighlight lang="xml">
+
:<code>@+id/recordId</code> - rowId<br>
<variable id="rowId" type="text">e0567dffe-7775-467c-8f56-6641a9ac3eb8</variable>
+
:<code>@variable/system_documentsNotReplicatingColumnName</code> - columnName<br>
<variable id="columnName" type="text">photos</variable>
+
:<code>5000</code> - timeout<br>
</syntaxhighlight>
+
:<code>@+id/getAttachmentFromServerSync</code> - callbackSourceId<br>
 
+
:<code>gn:act_set1</code> - callbackEvent<br>
=====screen.xml=====
+
:; ⤷ <code>[gn:act_getAttachmentFromServer]|[systems,@+id/recordId,@variable/system_documentsNotReplicatingColumnName,5000;@+id/getAttachmentFromServerSync,gn:act_set1]</code>
<syntaxhighlight lang="xml">
+
<hr>
<FrameLayout
 
    android:id="@+id/exampleFrame"
 
    android:layout_width="wrap_content"
 
    android:layout_height="wrap_content"
 
    android:visibility="gone"
 
    gn:act_set="[gn:act_getAttachmentFromServer]|[coffeeMachinesMaintenance,@variable/rowId,@variable/columnName]" />
 
</syntaxhighlight>
 
  
 
After action execution images will be stored locally into appId/userData/attachments folder
 
After action execution images will be stored locally into appId/userData/attachments folder

Revision as of 16:08, 4 June 2020

added in Milestone 101.6

gn:act_getAttachmentFromServer

Description
Action is used to download attachment asynchronously (M103.8) from the server when replication is not enabled for attachments.
Action returns
void

Action signatures

Download attachment

[gn:act_getAttachmentFromServer]|[tableName,rowId,columnName]
Parameter Description
tableName table name as defined in configuration.xml from which the document will be retrieved
  • Value should be hardcoded - to be able to query the table from the external app use @externalTable/appId_tableId syntax
rowId internal id of row which contains attachment information.
  • Valid target should be of datatype text
columnName Name of the column within the row which contains attachment information
  • Valid target should be of datatype text

Example

variables.xml
<variable id="rowId" type="text">e0567dffe-7775-467c-8f56-6641a9ac3eb8</variable>
<variable id="columnName" type="text">photos</variable>
screen.xml
<FrameLayout
    android:id="@+id/exampleFrame"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
    gn:act_set="[gn:act_getAttachmentFromServer]|[coffeeMachinesMaintenance,@variable/rowId,@variable/columnName]" />

After action execution images will be stored locally into appId/userData/attachments folder

Download attachment with callback

[gn:act_getAttachmentFromServer]|[tableName,rowId,columnName;callbackSourceId,callbackEvent]
Parameter Description
tableName table name as defined in configuration.xml from which the document will be retrieved
  • Value should be hardcoded - to be able to query the table from the external app use @externalTable/appId_tableId syntax
rowId internal id of row which contains attachment information.
  • Valid target should be of datatype text
timeout connection timeout
  • Valid target should be of datatype text
columnName Name of the column within the row which contains attachment information
  • Valid target should be of datatype text
callbackSourceId widget which contains callbackEvent
callbackEvent callback event which contains a set of actions which will be executed after the file is downloaded
  • Valid target should be of datatype text

Example

systems - tableName
@+id/recordId - rowId
@variable/system_documentsNotReplicatingColumnName - columnName
5000 - timeout
@+id/getAttachmentFromServerSync - callbackSourceId
gn:act_set1 - callbackEvent
[gn:act_getAttachmentFromServer]|[systems,@+id/recordId,@variable/system_documentsNotReplicatingColumnName,5000;@+id/getAttachmentFromServerSync,gn:act_set1]

After action execution images will be stored locally into appId/userData/attachments folder