<?xml version="1.0" encoding="UTF-8"?>
<!-- The definition of the application. -->
<loading-instructions xmlns="http://semanta.cz/schema/xf3/load">
<loading-instruction>
<!-- The unique job identifier, called from the API. -->
<job-id>load-alteryx-countries</job-id>
<!-- every job can have sub-jobs, creating a hierarchical loaded structures. In this example, we load a top level folder containing one County entry per record in the stage table. -->
<for-each-row>
<sub-job-id>mainFolder</sub-job-id>
<!-- The query to retrieve data from the stage table, to map to Connect's UI configuration. -->
<of-query>
<sql>
<connection-id>master</connection-id>
<query-body>select 1</query-body>
</sql>
</of-query>
<!-- For each row in the dataset returned from the query, an entry is created. In this example, there is only one row in the dataset, so only the top level folder entry is created. -->
<define-entry>
<!-- The definition of the entry type. -->
<app>folder</app>
<!-- The unique identifier of the parent entry, which must already exist to hold the entry being created. In this example, we use the Data Source folder ID, creating sub-folder. -->
<parent>f19f38ae-1c68-49f9-8654-288b92284bab</parent>
<parent-field>subfolders</parent-field>
<!-- The unique identifier of the entry, usually the UUID taken from the source system. In this example, we use a hash created out of string "counties". -->
<xid>$lu.toXidEncoded("counties")</xid>
<!-- The name of the entry as it is displayed in Connect's UI. -->
<name>Countries Example</name>
<!-- Set individual fields by defining the fieldcode of the application and the associated value from the datasource. In this example, the values are hardcoded. -->
<fields>
<![CDATA[
#set($foldertype="county")
#set($entrytypelist="type:county")
#set($platformDescription="<p>SDK Sample Countries.</p>")
#set($displaytype="smallcard")
#set($displaytype_readable="Small Card")
#set($displaytypeallentries="smallcard")
#set($displaytypeallentries_readable="Small Card")
#set($displaytypefolder="smallcard")
#set($displaytypefolder_readable="Small Card")
#set($integrationcode="promoteInstances")
#set($entriesgroupname="Promote Instances")
#set($subfoldersgroupname="Subfolders")
#set($allentriesgroupname="Counties")
]]>
</fields>
<!-- do not touch fields are fields which should be editable in UI and should not be touch (overwritten) by the loading job -->
<!-- usually description, owner are such fields -->
<do-not-touch>
<!--@import fragment="common-dont-touch"-->
<field>MainThumbnail</field>
<field>orderbytype</field>
<field>orderascending</field>
<field>entryOwner</field>
</do-not-touch>
<for-each-row>
<!-- this is the tick how to add attachment, in this case thumbnail of the folder -->
<add-attachment>
<xid>$lu.toXidEncoded("counties-icon")</xid>
<name>Alteryx_Counties.png</name>
<field-code>MainIcon</field-code>
<base64content>
<!-- Set to an icon encoded in base64 code (https://www.base64encode.org/). The icon will be used to visually represent your application. -->
</base64content>
</add-attachment>
</for-each-row>
</define-entry>
</for-each-row>
<!-- so right now, we have created just one folder -->
<!-- right now we are going to iterate on dataset of Counties and create a record for each County -->
<for-each-row>
<sub-job-id>countriesList</sub-job-id>
<!-- get datset of Counties (from the stage table EXT_COUNTRIES) -->
<of-query>
<sql>
<connection-id>master</connection-id>
<query-body>
<![CDATA[
SELECT name, key FROM EXT_COUNTRIES
]]>
</query-body>
</sql>
</of-query>
<!-- and now create entry one per each row from dataset -->
<define-entry>
<!-- creating entry of "county" app we have defined in previous chapter -->
<app>county</app>
<!-- start under folder created in previous step -->
<parent>$lu.toXidEncoded("counties")</parent>
<parent-field>entries</parent-field>
<!-- create uuid out of the county name -->
<xid>$lu.toXidEncoded("${name}")</xid>
<!-- county name -->
<name>${name}</name>
<!-- set values for the entry -->
<!-- in our case we are setting just one which is description, others are parameters for setting displaying behavior of the folder, entries, subentries and are not important for this example too much -->
<fields>
<![CDATA[
#set($description="${key}")
#set($foldertype="folder")
#set($entrytypelist="folder")
#set($platformDescription="<p>SDK Example.</p>")
#set($displaytype="table")
#set($displaytype_readable="Table")
#set($displaytypeallentries="table")
#set($displaytypeallentries_readable="Table")
#set($displaytypefolder="smallcard")
#set($displaytypefolder_readable="Small Card")
#set($integrationcode="")
#set($entriesgroupname="Promote Owners")
#set($subfoldersgroupname="Subfolders")
#set($allentriesgroupname="County List")
]]>
</fields>
<do-not-touch>
<!--@import fragment="common-dont-touch"-->
<field>entryOwner</field>
</do-not-touch>
</define-entry>
</for-each-row>
</loading-instruction>
</loading-instructions>