From wiki.ginstr.com
Jump to: navigation, search
(Download attachment with callback)
(Download attachment with callback)
 
Line 49: Line 49:
 
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
  
===Download attachment with callback===
+
===Download attachment with callback (M103.8.0.5)===
  
 
:;<code>[gn:act_getAttachmentFromServer]|[tableName,rowId,columnName;callbackSourceId,callbackEvent]</code>
 
:;<code>[gn:act_getAttachmentFromServer]|[tableName,rowId,columnName;callbackSourceId,callbackEvent]</code>

Latest revision as of 16:14, 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 (M103.8.0.5)

[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
columnName Name of the column within the row which contains attachment information
  • Valid target should be of datatype text
timeout connection timeout
  • 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