<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Oracle VB Studio and JET - Medium]]></title>
        <description><![CDATA[All about Oracle VBCS (Visual Builder Studio) and JET. - Medium]]></description>
        <link>https://medium.com/oracle-jet?source=rss----e91ffea63c1e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Oracle VB Studio and JET - Medium</title>
            <link>https://medium.com/oracle-jet?source=rss----e91ffea63c1e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:32:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/oracle-jet" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[VBS: Opportunities Layout — Custom Sales Stage Popup]]></title>
            <link>https://medium.com/oracle-jet/vbs-opportunities-layout-custom-sales-stage-popup-8c98bc2e564f?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/8c98bc2e564f</guid>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[oracle-visual-builder]]></category>
            <dc:creator><![CDATA[Steve Zebib]]></dc:creator>
            <pubDate>Tue, 03 Dec 2024 01:43:23 GMT</pubDate>
            <atom:updated>2024-12-13T18:10:51.153Z</atom:updated>
            <content:encoded><![CDATA[<h3>VBS: Opportunities Layout — Custom Sales Stage Popup</h3><p><strong><em>DISCLAIMER: </em></strong><em>The views expressed in this story are my own and do not necessarily reflect the views of Oracle.</em></p><h3>Overview</h3><p>This article describes how to create and enable a custom sales stage popup on the opportunities details page in Visual Builder Studio. The setup includes the following:</p><ul><li>Fragment: Create sales stage popup</li><li>Opportunities Details Page: Add the fragment</li><li>Opportunities Header Layout: Add an event to open the fragment when sales stage badge is clicked</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I1RPOcJ551y4HxslIU35OA.png" /></figure><h3>Setup</h3><h4>Fragment (Sales Stage Popup)</h4><ul><li>Create a fragment called “sales-stage-popup”.</li><li>The sales stage popup will show all sales stages and status for each stage (CURRENT, PENDING, COMPLETED).</li><li>Select current sales stage by clicking on sales stage.</li><li>NOTE: The input parameters for the fragment which need to be passed from from the container (opportunities layout) include: optyNumber, currentStgId, and salesStagesList.</li><li>In the fragment, copy all the code shown below including: Fragment JSON, HTML, JS, and Action Chains (JS).</li></ul><p><strong>JSON</strong></p><pre>{<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;eventListeners&quot;: {<br>    &quot;divClick&quot;: {<br>      &quot;chains&quot;: [<br>        {<br>          &quot;chain&quot;: &quot;updateSalesStageActionChain&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;stgId&quot;: &quot;[[ $current.data.StgId ]]&quot;<br>          }<br>        }<br>      ]<br>    },<br>    &quot;divClick2&quot;: {<br>      &quot;chains&quot;: [<br>        {<br>          &quot;chain&quot;: &quot;updateSalesStageActionChain&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;stgId&quot;: &quot;[[ $current.data.StgId ]]&quot;<br>          }<br>        }<br>      ]<br>    },<br>    &quot;divClick3&quot;: {<br>      &quot;chains&quot;: [<br>        {<br>          &quot;chain&quot;: &quot;updateSalesStageActionChain&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;stgId&quot;: &quot;[[ $current.data.StgId ]]&quot;<br>          }<br>        }<br>      ]<br>    },<br>    &quot;vbEnter&quot;: {<br>      &quot;chains&quot;: [<br>        {<br>          &quot;chain&quot;: &quot;updateSalesStageActionChain&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;stgId&quot;: &quot;{{ $variables.currentStgId }}&quot;<br>      }<br>        }<br>      ]<br>    }<br>  },<br>  &quot;events&quot;: {<br>    &quot;updateSalesStage&quot;: {<br>      &quot;propagationBehavior&quot;: &quot;container&quot;,<br>      &quot;description&quot;: &quot;Emits to container&quot;,<br>      &quot;payloadType&quot;: {<br>        &quot;OptyNumber&quot;: &quot;string&quot;,<br>        &quot;StgId&quot;: &quot;number&quot;<br>      }<br>    }<br>  },<br>  &quot;imports&quot;: {<br>    &quot;components&quot;: {<br>      &quot;oj-popup&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojpopup&quot;<br>      }<br>    }<br>  },<br>  &quot;types&quot;: {<br>    &quot;salesStageType&quot;: {<br>      &quot;Name&quot;: &quot;string&quot;,<br>      &quot;StgId&quot;: &quot;number&quot;,<br>      &quot;StgOrder&quot;: &quot;number&quot;<br>    }<br>  },<br>  &quot;variables&quot;: {<br>    &quot;currentSalesStage&quot;: {<br>      &quot;type&quot;: &quot;salesStageType&quot;,<br>      &quot;required&quot;: false,<br>      &quot;input&quot;: &quot;none&quot;<br>    },<br>    &quot;currentStgId&quot;: {<br>      &quot;type&quot;: &quot;number&quot;,<br>      &quot;required&quot;: true,<br>      &quot;input&quot;: &quot;fromCaller&quot;<br>    },<br>    &quot;dataReady&quot;: {<br>      &quot;type&quot;: &quot;boolean&quot;,<br>      &quot;defaultValue&quot;: false<br>    },<br>    &quot;optyNumber&quot;: {<br>      &quot;type&quot;: &quot;string&quot;,<br>      &quot;required&quot;: true,<br>      &quot;input&quot;: &quot;fromCaller&quot;<br>    },<br>    &quot;salesStagesList&quot;: {<br>      &quot;type&quot;: &quot;salesStageType[]&quot;,<br>      &quot;required&quot;: true,<br>      &quot;input&quot;: &quot;fromCaller&quot;<br><br>    },<br>    &quot;salesStageStatusList&quot;: {<br>      &quot;required&quot;: false,<br>      &quot;type&quot;: &quot;any[]&quot;,<br>      &quot;input&quot;: &quot;none&quot;<br>    },<br>    &quot;salesStageStatusListADP&quot;: {<br>      &quot;type&quot;: &quot;vb/ArrayDataProvider2&quot;,<br>      &quot;defaultValue&quot;: {<br>        &quot;data&quot;: &quot;{{ $variables.salesStageStatusList }}&quot;,<br>        &quot;itemType&quot;: &quot;any&quot;<br>      }<br>    }<br><br>  }<br>}</pre><p><strong>HTML</strong></p><pre>&lt;style&gt;<br>  .sales-stage {<br>    width: 170px;<br>    height: 150px;<br>    font-size: 14px;<br>    text-align: center;<br>    color: #FFF;<br>    margin: 4px;<br>    padding: 4px 4px 4px 16px;<br>    float: left;<br>    position: relative;<br>    background-color: var(--oj-core-neutral-1);<br>    cursor: pointer;<br>  }<br><br>  .sales-stage:after,<br>  .sales-stage:before {<br>    content: &quot; &quot;;<br>    position: absolute;<br>    top: 0;<br>    right: -16px;<br>    width: 0;<br>    height: 0;<br>    border-top: 76px solid transparent;<br>    border-bottom: 82px solid transparent;<br>    border-left: 17px solid var(--oj-core-neutral-1);<br>    z-index: 2;<br>  }<br><br>  .sales-stage:before {<br>    right: auto;<br>    left: 0;<br>    border-left: 16px solid #fff;<br>    z-index: 0;<br>  }<br><br>  .sales-stage:first-child:before,<br>  .sales-stage:last-child:after {<br>    border: none;<br>  }<br><br>  .sales-stage:first-child {<br>    border-top-left-radius: 24px;<br>    border-bottom-left-radius: 24px;<br>  }<br><br>  .sales-stage:last-child {<br>    border-top-right-radius: 24px;<br>    border-bottom-right-radius: 24px;<br>  }<br><br>  .sales-stage.current {<br>    color: #fff;<br>    background-color: var(--oj-core-info-1);<br>  }<br><br>  .sales-stage.current:after {<br>    border-left: 17px solid var(--oj-core-info-1);<br>  }<br><br>  .sales-stage.completed {<br>    color: #fff;<br>    background-color: var(--oj-core-success-1);<br>  }<br><br>  .sales-stage.completed:after {<br>    border-left: 17px solid var(--oj-core-success-1);<br>  }<br>&lt;/style&gt;<br><br>&lt;oj-popup id=&quot;popup-sales-stage&quot;&gt;<br>  &lt;div class=&quot;oj-flex oj-sm-align-items-center oj-sm-margin-6x&quot;&gt;<br>    &lt;oj-bind-if test=&quot;[[ $variables.dataReady ]]&quot;&gt;<br>      &lt;oj-bind-for-each data=&quot;[[ $variables.salesStageStatusListADP ]]&quot;&gt;<br>        &lt;template&gt;<br>          &lt;oj-bind-if test=&#39;[[ $current.data.Status === &quot;COMPLETED&quot; ]]&#39;&gt;<br>            &lt;div class=&quot;sales-stage completed&quot; on-click=&quot;[[$listeners.divClick]]&quot;&gt;<br>              &lt;div<br>                class=&quot;oj-flex oj-sm-align-items-center oj-sm-justify-content-center oj-sm-padding-2x&quot; style=&quot;width: 100%; height: 100%;&quot;&gt;<br>                &lt;img :src=&quot;[[ $extension.path + $fragment.functions.getSalesStageImageUrl($current.data.StgOrder) ]]&quot; width=&quot;100&quot; height=&quot;100&quot; style=&quot;border-radius: 50%;&quot;&gt;<br>                &lt;span class=&quot;oj-sm-margin-1x-top&quot;&gt;&lt;oj-bind-text value=&quot;[[ $current.data.Name ]]&quot;&gt;&lt;/oj-bind-text&gt;&lt;/span&gt;<br>              &lt;/div&gt;<br>            &lt;/div&gt;<br>          &lt;/oj-bind-if&gt;<br>          &lt;oj-bind-if test=&#39;[[ $current.data.Status === &quot;CURRENT&quot; ]]&#39;&gt;<br>            &lt;div class=&quot;sales-stage current&quot; on-click=&quot;[[$listeners.divClick2]]&quot;&gt;<br>              &lt;div<br>                class=&quot;oj-flex oj-sm-align-items-center oj-sm-justify-content-center oj-sm-padding-2x&quot; style=&quot;width: 100%; height: 100%;&quot;&gt;<br>                &lt;img :src=&quot;[[ $extension.path + $fragment.functions.getSalesStageImageUrl($current.data.StgOrder) ]]&quot; width=&quot;100&quot; height=&quot;100&quot; style=&quot;border-radius: 50%;&quot;&gt;<br>                &lt;span class=&quot;oj-sm-margin-1x-top&quot;&gt;&lt;oj-bind-text value=&quot;[[ $current.data.Name ]]&quot;&gt;&lt;/oj-bind-text&gt;&lt;/span&gt;<br>              &lt;/div&gt;<br>            &lt;/div&gt;<br>          &lt;/oj-bind-if&gt;<br>          &lt;oj-bind-if test=&#39;[[ $current.data.Status === &quot;PENDING&quot; ]]&#39;&gt;<br>            &lt;div class=&quot;sales-stage&quot; on-click=&quot;[[$listeners.divClick3]]&quot;&gt;<br>              &lt;div<br>                class=&quot;oj-flex oj-sm-align-items-center oj-sm-justify-content-center oj-sm-padding-2x&quot; style=&quot;width: 100%; height: 100%;&quot;&gt;<br>                &lt;img :src=&quot;[[ $extension.path + $fragment.functions.getSalesStageImageUrl($current.data.StgOrder) ]]&quot; width=&quot;100&quot; height=&quot;100&quot; style=&quot;border-radius: 50%;&quot;&gt;<br>                &lt;span class=&quot;oj-sm-margin-1x-top&quot;&gt;&lt;oj-bind-text value=&quot;[[ $current.data.Name ]]&quot;&gt;&lt;/oj-bind-text&gt;&lt;/span&gt;<br>              &lt;/div&gt;<br>            &lt;/div&gt;<br>          &lt;/oj-bind-if&gt;<br>        &lt;/template&gt;<br>      &lt;/oj-bind-for-each&gt;<br>    &lt;/oj-bind-if&gt;<br>  &lt;/div&gt;<br>&lt;/oj-popup&gt;</pre><p><strong>JS</strong></p><pre>define([], () =&gt; {<br>  &#39;use strict&#39;;<br><br>  class FragmentModule {<br>  }<br><br>  FragmentModule.prototype.processCurrentSalesStage = function (salesStagesList, stgId) {<br>    let salesStagesListCopy = JSON.parse(JSON.stringify(salesStagesList));<br>    let currentSalesStage;<br><br>    for (let salesStage of salesStagesListCopy) {<br>      if (salesStage.StgId === stgId) {<br>        currentSalesStage = salesStage;<br>        break;<br>      }<br>    }<br><br>    return currentSalesStage;<br>  };<br><br>  FragmentModule.prototype.updateSalesStagesStatusList = function (salesStagesList, currentSalesStage) {<br>    let salesStagesListCopy = JSON.parse(JSON.stringify(salesStagesList));<br>    let currentSalesStageCopy = JSON.parse(JSON.stringify(currentSalesStage));<br>    <br>    for (let salesStage of salesStagesListCopy) {<br>      if (salesStage.StgOrder &lt; currentSalesStageCopy.StgOrder) {<br>        salesStage.Status = &quot;COMPLETED&quot;;<br>      } else if (salesStage.StgOrder &gt; currentSalesStageCopy.StgOrder) {<br>        salesStage.Status = &quot;PENDING&quot;;<br>      } else if (salesStage.StgOrder === currentSalesStageCopy.StgOrder) {<br>        salesStage.Status = &quot;CURRENT&quot;;<br>      }<br>    }<br><br>    return salesStagesListCopy;<br>  };<br><br>  // NOTE: Add sales stages images in resources directory. You can use a different image for each sales stage based on StgOrder value.<br>  FragmentModule.prototype.getSalesStageImageUrl = function (stgOrder) {<br>    return &quot;resources/images/o_tag.png&quot;;<br>  };<br><br>  return FragmentModule;<br>});</pre><p><strong>Action Chain (updateSalesStageActionChain)</strong></p><pre>define([<br>  &#39;vb/action/actionChain&#39;,<br>  &#39;vb/action/actions&#39;,<br>  &#39;vb/action/actionUtils&#39;,<br>], (<br>  ActionChain,<br>  Actions,<br>  ActionUtils<br>) =&gt; {<br>  &#39;use strict&#39;;<br><br>  class updateSalesStageActionChain extends ActionChain {<br><br>    /**<br>     * @param {Object} context<br>     * @param {Object} params<br>     * @param {number} params.stgId <br>     */<br>    async run(context, { stgId }) {<br>      const { $fragment, $extension, $global, $functions, $variables } = context;<br><br>      $variables.dataReady = false;<br><br>      const processCurrentSalesStage = await $functions.processCurrentSalesStage($variables.salesStagesList, stgId);<br><br>      $fragment.variables.currentSalesStage = processCurrentSalesStage;<br><br>      await Actions.fireEvent(context, {<br>        event: &#39;updateSalesStage&#39;,<br>        payload: {<br>          OptyNumber: $variables.optyNumber,<br>          StgId: stgId,<br>        },<br>      });<br><br>      const callFunctionResult = await $fragment.functions.updateSalesStagesStatusList($fragment.variables.salesStagesList, $fragment.variables.currentSalesStage);<br><br>      $fragment.variables.salesStageStatusList = callFunctionResult;<br><br>      await Actions.fireDataProviderEvent(context, {<br>        refresh: null,<br>        target: $fragment.variables.salesStageStatusListADP,<br>      });<br><br>      $fragment.variables.dataReady = true;<br>    }<br>  }<br><br>  return updateSalesStageActionChain;<br>});</pre><h4>Opportunities Details Page</h4><ul><li>Go to App UIs &gt; Sales &gt; opportunities &gt; opportunities-detail</li><li>Duplicate the default layout and a section (e.g. salesStagePopupTemplate) which will contain the fragment.</li><li>Add the fragment (sales-stage-popup) to the template as shown below.</li></ul><pre>&lt;template id=&quot;salesStagePopupTemplate&quot;&gt;<br>  &lt;oj-vb-fragment bridge=&quot;[[vbBridge]]&quot; name=&quot;sales-stage-popup&quot;&gt;<br>    &lt;oj-vb-fragment-param name=&quot;optyNumber&quot; value=&quot;[[ $base.variables.puid ]]&quot;&gt;&lt;/oj-vb-fragment-param&gt;<br>    &lt;oj-vb-fragment-param name=&quot;currentStgId&quot; value=&quot;[[ $variables.currentStgId ]]&quot;&gt;&lt;/oj-vb-fragment-param&gt;<br>    &lt;oj-vb-fragment-param name=&quot;salesStagesList&quot; value=&quot;[[ $variables.salesStagesList ]]&quot;&gt;&lt;/oj-vb-fragment-param&gt;<br>  &lt;/oj-vb-fragment&gt;<br>&lt;/template&gt;</pre><ul><li>Note the input parameters that need to be passed to the fragment include: optyNumber (puid), currentStgId (number), and salesStagesList (array of salesStageType). For example:</li></ul><pre>optyNumber = &quot;10001&quot;;<br>currentStgId = 300000000323740;<br>salesStagesList = [<br>    {<br>        &quot;Name&quot;: &quot;01 - Qualification&quot;,<br>        &quot;StgId&quot;: 300000000323741,<br>        &quot;StgOrder&quot;: 1<br>    },<br>    {<br>        &quot;Name&quot;: &quot;02 - Discovery&quot;,<br>        &quot;StgId&quot;: 300000000323740,<br>        &quot;StgOrder&quot;: 2<br>    },<br>    {<br>        &quot;Name&quot;: &quot;03 - Building Vision&quot;,<br>        &quot;StgId&quot;: 300000000323742,<br>        &quot;StgOrder&quot;: 3<br>    },<br>    {<br>        &quot;Name&quot;: &quot;04 - Presentation&quot;,<br>        &quot;StgId&quot;: 300000000323739,<br>        &quot;StgOrder&quot;: 4<br>    },<br>    {<br>        &quot;Name&quot;: &quot;05 - Agreement&quot;,<br>        &quot;StgId&quot;: 300000000323736,<br>        &quot;StgOrder&quot;: 5<br>    },<br>    {<br>        &quot;Name&quot;: &quot;06 - Negotiation&quot;,<br>        &quot;StgId&quot;: 300000000323738,<br>        &quot;StgOrder&quot;: 6<br>    },<br>    {<br>        &quot;Name&quot;: &quot;07 - Closed&quot;,<br>        &quot;StgId&quot;: 300000000323737,<br>        &quot;StgOrder&quot;: 7<br>    }<br>]<br></pre><h4>Opportunities Header Layout</h4><ul><li>Go to Layout &gt; Sales &gt; Opportunities &gt; Header Layout</li><li>Duplicate the default layout and make sure the SalesStage field is set as the badgeFieldName.</li><li>Add the opportunitiesOnLoadHeaderEvent which triggers an action chain (opportunitiesOnLoadHeaderEventListener) as shown below. This action chain will add a click handler on the SalesStage field to open the sales stage popup. Make sure the ID of popup (e.g. popup-sales-stage) is the same as the ID used in the fragment.</li></ul><p><strong>Action Chain (opportunitiesOnLoadHeaderEventListener)</strong></p><pre>define([<br>  &#39;vb/action/actionChain&#39;,<br>  &#39;vb/action/actions&#39;,<br>  &#39;vb/action/actionUtils&#39;,<br>], (<br>  ActionChain,<br>  Actions,<br>  ActionUtils<br>) =&gt; {<br>  &#39;use strict&#39;;<br><br>  class opportunitiesOnLoadHeaderEventListener extends ActionChain {<br><br>    /**<br>     * @param {Object} context<br>     */<br>    async run(context) {<br>      const { $layout, $base, $extension, $responsive, $user } = context;<br><br>      const elements = document.getElementsByClassName(&quot;cx-badge-item&quot;);<br><br>      if (elements &amp;&amp; elements.length &gt; 0) {<br>        let element = elements.item(0);<br>        element.addEventListener(&#39;click&#39;, function() {<br>            const elementPopup = document.getElementById(&quot;popup-sales-stage&quot;);<br>            elementPopup.open();<br>        });<br>      }<br>    }<br>  }<br><br>  return opportunitiesOnLoadHeaderEventListener;<br>});</pre><h3>Test</h3><ul><li>Run the application and you should see the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I1RPOcJ551y4HxslIU35OA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c98bc2e564f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/vbs-opportunities-layout-custom-sales-stage-popup-8c98bc2e564f">VBS: Opportunities Layout — Custom Sales Stage Popup</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VB: Business Object API Security]]></title>
            <link>https://medium.com/oracle-jet/vb-business-object-api-security-8bcf099cb650?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/8bcf099cb650</guid>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-visual-builder]]></category>
            <dc:creator><![CDATA[Steve Zebib]]></dc:creator>
            <pubDate>Thu, 23 Jun 2022 04:41:48 GMT</pubDate>
            <atom:updated>2022-06-23T16:58:03.466Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER: </em></strong><em>The views expressed in this story are my own and do not necessarily reflect the views of Oracle.</em></p><h3>Overview</h3><p>This article describes business object security in Visual Builder. This includes the following:</p><ul><li>Roles: Authenticated User and Anonymous User</li><li>Access Control: Assigning roles to business object API endpoints</li><li>External Access: Accessing business object API outside of Visual Builder using Anonymous User</li></ul><p>Depending on your use case, some business objects may require user authentication rather than anonymous access. Security for each business object in your VB application must be configured separately.</p><h3>Roles</h3><p>The roles associated with business objects include:</p><ul><li>Authenticated User (default): Requires Basic authentication (username/password) to access business object endpoints.</li><li>Anonymous User: Requires Bearer authentication (access token) to access business object endpoints.</li></ul><h3>Access Control</h3><h4><strong>CRUD Operations</strong></h4><p>Furthermore, the following CRUD operations can be assigned one or both of the above roles:</p><ul><li>View: Access to business object GET endpoints.</li><li>Create: Access to business object POST endpoints.</li><li>Update: Access to business object PATCH endpoints.</li><li>Delete: Access to business object DELETE endpoints.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GHituFqlbkWmA2KQ-kI2gw.png" /><figcaption>Business Object Security Example</figcaption></figure><h4>Environments</h4><ul><li>Development: Only Authenticated User can access business object API endpoints.</li><li>Stage/Live: Authenticated User and/or Anonymous User can access business object API endpoints.</li></ul><h3>External Access</h3><ul><li>To access business object(s) endpoints outside of Visual Builder using Anonymous User following the below configuration.</li></ul><p>NOTE: Business Objects endpoints can be accessed outside of VB only for Staging and Live environments. Development environment CANNOT be accessed outside of VB.</p><h4>Configuration</h4><p><strong>Business Objects</strong></p><ul><li>For this example, we will create a business object called <em>Users </em>as shown below. Go to the Fields tab and add the following fields: name and email.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GsMw3Fk4xUYjeJsr.png" /></figure><ul><li>Go to the Security tab and check View for Anonymous User as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V24sMXPaBtRlC9pA.png" /></figure><ul><li>Go to Endpoints tab and copy the Data Staging URL under Resource APIs. Save URL for later step.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*02B5SivF6F68uV_r.png" /></figure><p><strong>Settings</strong></p><ul><li>Go to Settings (under top-right menu) then click on Business Objects tab. Under Security section, check the following: <strong>Allow anonymous access to business objects describe end point</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hln_tWCTAfL7JuZT.png" /></figure><ul><li>Click on ‘Get Access Token’ button and copy the Access Token Value as shown below. Save access token for later step.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w5UNxSArgBP7kseB.png" /></figure><ul><li>Stage the application.</li></ul><h4>Test</h4><ul><li>Using the Data Staging URL and access token from above steps, we can now make REST calls from outside of VB. We can try this in Postman as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40G3ucziZQMnH-KgsvgNmg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bcf099cb650" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/vb-business-object-api-security-8bcf099cb650">VB: Business Object API Security</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance Tips on Building Visual Builder Applications with Fusion REST Services]]></title>
            <link>https://medium.com/oracle-jet/performance-tips-on-building-visual-builder-applications-with-fusion-rest-services-abaca2917fac?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/abaca2917fac</guid>
            <category><![CDATA[enterprise]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[oracle-visual-builder]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[application-development]]></category>
            <dc:creator><![CDATA[Vivek Kumar]]></dc:creator>
            <pubDate>Fri, 27 May 2022 19:33:26 GMT</pubDate>
            <atom:updated>2022-05-27T19:46:01.729Z</atom:updated>
            <content:encoded><![CDATA[<p>I have been lucky to help a lot of Enterprise customers to build Visual Builder-based applications. Once these applications go live, I see a common pattern of complaints about performance issues. These complaints will show a lot of customer frustration as the investment is already made and customers do not expect Oracle applications to perform badly. Guess what? Often times it is the development practices that are the leading cause of the majority of those issues. I am mentioning a few key causes of these performance issues:</p><p><strong>Disclaimer: None of the ideas explained in this post is rocket science. However, they still cover the majority of the reasons for almost all those performance complaints.</strong></p><h4>Data Set Size</h4><p>ADF and Adaptive Search REST services by default have an optimized recordset size. This can be changed by the limit parameter. This parameter is blindly changed to a larger number such as 500 or in some cases 5000 in an attempt to get all the data.</p><p>This is not optimal. Beyond the visible viewport, users will have a hard time really making sense of that large data. Use either “load on scroll” (Twitter style) or actual buttons to load more data when the user needs to see more.</p><p>If you are trying to generate summary numbers based on 5000 rows accessible to the user then this is a big NO-NO. Do those calculations at the server-side and pull the summary numbers.</p><h4>Pull What You Really Need</h4><p>Similar to the above where you should optimize how many rows you pull, you should also pay close attention to which attributes/fields you need for these rows. So, if you need emp id and emp name then do not pull emp dept and 20 other attributes. I have seen like 200 attributes pulled when a user does not need more than 25.</p><p>This can massively reduce the payload size that server needs to process and the amount of data that travels via the network.</p><h4>Minimize Initial Page Load</h4><p>Enterprise applications are data intensive and often I observe 10+ service calls are made on page load. A number of calls may not be avoidable but calling them all before even the page finishes rendering is something that needs to be avoided. Carefully look into your code flow and see if some of those calls can be made later. A trick that does wonders is trying to load the read-only view of the page and hence only making the calls that need to pull data from a much smaller number of services. In Oracle’s World, a lot of LOV calls can be avoided initially and an edit mode can make those calls much later.</p><h4>Use Browser Caching</h4><p>A significant amount of data rarely changes in the enterprise applications and it is a common practice to try to pull everything from the server-side using those 15–20 API calls at the initial page load. Carefully examine what data truly needs to be pulled every single time. And make use of browser caching to cache things like LOV lists, configuration setups, etc.</p><h4>Read Documentation</h4><p>Oracle invests significantly in ensuring that released features are explained well via release guide or developer guide. Looking into can really help in finding those useful flags or parameters that can help in improved performance by applying those optimizations.</p><p>Just in case you are wondering where is VBCS in this post? Well, Visual Studio is the next generation of application development platform which is used by a large number of enterprise customers building applications in the Oracle ecosystem. And, the most popular way to consume data for these applications is REST services. Users often get into this false impression that Visual Studio has issues when the underlying issues are somewhere else.</p><blockquote>Please give me a few claps if you liked this post. :)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abaca2917fac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/performance-tips-on-building-visual-builder-applications-with-fusion-rest-services-abaca2917fac">Performance Tips on Building Visual Builder Applications with Fusion REST Services</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Should I stay in DMV line? Let's use ML]]></title>
            <link>https://medium.com/oracle-jet/should-i-stay-in-dmv-line-lets-use-ml-2519559dcc55?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/2519559dcc55</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[dmv]]></category>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[linear-regression]]></category>
            <dc:creator><![CDATA[Vivek Kumar]]></dc:creator>
            <pubDate>Wed, 20 Oct 2021 15:52:57 GMT</pubDate>
            <atom:updated>2021-10-20T15:52:57.734Z</atom:updated>
            <content:encoded><![CDATA[<p>So, nothing complex and an absolute beginner use case on how to use machine learning to do absolute simple predictions.</p><p>I went to DMV last week for my car title transfer from California to Texas. And, I realized I was absolutely low on my phone battery. So, decided to just in the line doing nothing and observe how fast is the line moving. After observing for a few min it was very clear that it is moving very unpredictably. Sometimes, it moves within 2 min and then won’t for like 10 min. As I had nothing else to do so decided to just take a note of the time whenever the line moves and people ahead of me. So, as an example, if I counted 26 people ahead of me and I see the person getting his turn in 2 min then it means it will take 50 min for my turn. And that’s what I did for the rest of a few hours until I got my turn. Here is what those notes look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*7ynmueypOOB0-7JKlXweSQ.png" /><figcaption>raw notes on line movement</figcaption></figure><p>When I came home, I thought to put those numbers in a simple linear regression model. The practical application would be to predict if it is worth standing in line by counting the number of people ahead and time when the DMV counter closes for the day. I used jupyter notebook and scikit-learn library to put those numbers in a regression model. The code looks like below:</p><pre>import numpy as np<br>import matplotlib.pyplot as plt<br>from sklearn.linear_model import LinearRegression<br>X = np.array([[25], [19], [15], [14], [10], [9],   [6], [5], [4], [3], [2], [1]])<br>y = np.array([[336],[294],[84], [130], [72], [136], [25], [8], [9], [2], [7], [11]])<br>reg = LinearRegression().fit(X, y)</pre><p>Super basic stuff as I said at the start of this post. It is simply putting the numbers as X and Y coordinates and fitting them to the model for the predictions. I also did plot using matplotlib library for some visualization which looks like below with code:</p><pre>plt.plot(X,y)<br>plt.xlabel(&#39;People ahead of me&#39;)<br>plt.ylabel(&#39;Estimated Min to get turn&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*FR4e6HrGK7BxfmLJMUiPnA.png" /></figure><p>This clearly shows that there is no direct correlation between the number of people ahead of me and the time it is taking to serve per customer by DMV. So, to use this model let&#39;s say there are 40 people ahead. I will use below to find estimated hours it will take:</p><pre>print(reg.predict(np.array([[40]]))/60, &#39;hours&#39;)</pre><pre>[[8.8225934]] hours</pre><p>So, this will clearly take beyond 8 hours to get the turn even when this situation is at the start of the office hours. Running it for 36 people comes to 7.8 hours. Which sort of translates that DMV can process 36 customers a day.</p><p>On a side note, once I got my turn I finally discovered why the line movement was so erratic. There were 4 agents but within15 min, I saw at least one agent was on a break all the time, and hence, the effective number was reduced to 3. Further, the agent who was serving me was called by another agent to discuss a special case with the customer she was serving. Agent serving me spent more than 5 min doing so and hence I was just standing there.</p><p>Overall, I had quite fun with this.</p><p><strong>NOTE</strong>: The idea of this post is to show the fun part of ML. In reality, the situations are much more complex and usually require a lot more data points and higher-order models to make more practical predictions. In fact, most of the time getting the right data and shaping it in a way ML model can make sense of it is a much bigger deal in this field.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2519559dcc55" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/should-i-stay-in-dmv-line-lets-use-ml-2519559dcc55">Should I stay in DMV line? Let&#39;s use ML</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VB: Parsing and Writing Excel Files]]></title>
            <link>https://medium.com/oracle-jet/vb-parsing-and-writing-excel-files-1044d697255d?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/1044d697255d</guid>
            <category><![CDATA[visual-builder]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[oracle-visual-builder]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <dc:creator><![CDATA[Steve Zebib]]></dc:creator>
            <pubDate>Wed, 20 Oct 2021 05:49:35 GMT</pubDate>
            <atom:updated>2021-10-20T07:21:41.453Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER: </em></strong><em>The views expressed in this story are my own and do not necessarily reflect the views of Oracle.</em></p><h3>Overview</h3><p>This article describes how to parse and write Excel files using <a href="https://github.com/sheetjs/sheetjs">SheetJS</a> in Oracle Visual Builder. We will implement the following features in this example:</p><ul><li>JSON to Excel: Parses JSON and generates Excel (.xlsx) file</li><li>Excel to JSON: Generates JSON based on Excel (.xlsx) file</li></ul><p>This tool is specifically useful to import and export data into VB more efficiently by using Excel files.</p><h3>Setup</h3><p><strong>Data</strong></p><ul><li>First, we need sample data to test our implementation. Create a <strong>contacts.json</strong> file under the <strong>resources/data</strong> directory with sample data shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*lofnqxqTDiD4sqiHyAf_uw.png" /></figure><pre>[<br>  {<br>    &quot;name&quot;: &quot;John Smith&quot;,<br>    &quot;title&quot;: &quot;CEO&quot;,<br>    &quot;company&quot;: &quot;Example&quot;,<br>    &quot;email&quot;: &quot;<a href="/service/mailto:john.smith@example.com">john.smith@example.com</a>&quot;<br>  },<br>  {<br>    &quot;name&quot;: &quot;Lisa Jones&quot;,<br>    &quot;title&quot;: &quot;EVP&quot;,<br>    &quot;company&quot;: &quot;Example&quot;,<br>    &quot;email&quot;: &quot;<a href="/service/mailto:lisa.jones@example.com">lisa.jones@example.com</a>&quot;<br>  },<br>  {<br>    &quot;name&quot;: &quot;Joshua Baker&quot;,<br>    &quot;title&quot;: &quot;CTO&quot;,<br>    &quot;company&quot;: &quot;Example&quot;,<br>    &quot;email&quot;: &quot;<a href="/service/mailto:joshua.baker@example.com">joshua.baker@example.com</a>&quot;<br>  }<br>]</pre><p><strong>SheetJS</strong></p><ul><li>Next, we need to import <a href="https://github.com/SheetJS/sheetjs/blob/master/xlsx.js"><strong>xlsx.js</strong></a><strong> </strong>(from SheetJS)<strong> </strong>into the <strong>resources/js</strong> directory as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*L92FHAHbyrJ4DJ87ZVgbsw.png" /></figure><p><strong>JSON</strong></p><ul><li>The Metadata below includes all variables, types, action chains, and events required for this web application. Copy the following into the <strong>main-start-page.json</strong> file:</li></ul><pre>{<br>  &quot;title&quot;: &quot;&quot;,<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;variables&quot;: {},<br>  &quot;metadata&quot;: {},<br>  &quot;types&quot;: {},<br>  &quot;chains&quot;: {},<br>  &quot;eventListeners&quot;: {<br>    &quot;ojButtonOjAction&quot;: {<br>      &quot;chains&quot;: [<br>        {<br>          &quot;chainId&quot;: &quot;exportExcelActionChain&quot;<br>        }<br>      ]<br>    },<br>    &quot;ojFilePickerOjSelect&quot;: {<br>      &quot;chains&quot;: [<br>        {<br>          &quot;chainId&quot;: &quot;importExcelActionChain&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;files&quot;: &quot;[[ Array.prototype.slice.call($event.detail.files) ]]&quot;<br>          }<br>        }<br>      ]<br>    }<br>  },<br>  &quot;imports&quot;: {<br>    &quot;components&quot;: {<br>      &quot;oj-button&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojbutton&quot;<br>      },<br>      &quot;oj-file-picker&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojfilepicker&quot;<br>      }<br>    }<br>  },<br>  &quot;events&quot;: {}<br>}</pre><p><strong>HTML</strong></p><ul><li>The HTML below includes diagram component with its templates. Copy the following into <strong>main-start-page.html</strong> file:</li></ul><pre>&lt;div class=&quot;oj-flex oj-sm-flex-direction-column oj-sm-align-items-flex-start&quot;&gt;<br> &lt;h4&gt;JSON to Excel&lt;/h4&gt;<br> &lt;oj-button chroming=&quot;callToAction&quot; on-oj-action=&quot;[[$listeners.ojButtonOjAction]]&quot; style=&quot;margin-right: 10px;&quot;&gt;Export<br>    Excel (.xlsx)&lt;/oj-button&gt;<br> &lt;h4&gt;Excel to JSON&lt;/h4&gt;<br> &lt;oj-file-picker select-on=&quot;click&quot; selection-mode=&quot;single&quot;<br>    accept=&#39;[&quot;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;]&#39;<br>    on-oj-select=&quot;[[$listeners.ojFilePickerOjSelect]]&quot;&gt;<br>  &lt;oj-button id=&quot;oj-button-1225781865-1-import&quot; slot=&#39;trigger&#39; chroming=&quot;callToAction&quot;&gt;Import Excel (.xlsx)<br>    &lt;/oj-button&gt;<br> &lt;/oj-file-picker&gt;<br>&lt;/div&gt;</pre><p><strong>JS</strong></p><ul><li>The JS below includes functions needed to initialize the diagram component. This includes functions which will be assigned to variables that are referenced by the component. Copy the following into <strong>main-start-page.js </strong>file:</li></ul><pre>define([&#39;resources/js/xlsx&#39;, &#39;text!resources/data/contacts.json&#39;], function (XLSX, jsonAsText) {</pre><pre>&#39;use strict&#39;;</pre><pre>// Reference: SheetJS <a href="https://github.com/sheetjs/sheetjs">https://github.com/sheetjs/sheetjs</a></pre><pre>const EXCEL_FILE_NAME = &#39;contacts.xlsx&#39;;<br> const SHEET_NAME = &#39;Sheet1&#39;;</pre><pre>var PageModule = function PageModule() {};</pre><pre>PageModule.prototype.exportExcel = function() {<br>  let dataArray = JSON.parse(jsonAsText);</pre><pre>// Create a new workbook<br>  var wb = XLSX.utils.book_new();</pre><pre>// Assign workbook properties<br>  wb.Props = {<br>   Title: &quot;Example&quot;,<br>   Subject: &quot;&quot;,<br>   Author: &quot;Example&quot;,<br>   CreatedDate: new Date()<br>  };</pre><pre>// Create worksheet<br>  wb.SheetNames.push(SHEET_NAME);</pre><pre>// Convert JSON to worksheet<br>  var ws = XLSX.utils.json_to_sheet(dataArray);</pre><pre>// Assign sheet to workbook<br>  wb.Sheets[SHEET_NAME] = ws;</pre><pre>// Create Excel file<br>  XLSX.writeFile(wb, EXCEL_FILE_NAME);<br> };</pre><pre>PageModule.prototype.importExcel = function(fileSet) {<br>  var readDataPromise = new Promise(function(resolve) {<br>   if (fileSet.length &gt; 0) {<br>    var excelFile = fileSet[0];<br>    if (excelFile.type === &#39;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&#39;) {<br>     var fileReader = new FileReader();<br>     fileReader.onload = function(fileReadEvent) {<br>      var data = fileReadEvent.target.result;<br>      parseData(data);<br>     };<br>     fileReader.readAsArrayBuffer(excelFile);<br>    }<br>   }<br>  });</pre><pre>return readDataPromise;<br> };</pre><pre>function parseData(arrayBuffer) {<br>  let dataArray = [];</pre><pre>// Get workbook<br>  var wb = XLSX.read(arrayBuffer, {<br>   type: &#39;array&#39;<br>  });</pre><pre>// Get worksheet<br>  // NOTE: This assumes the default sheet name is &quot;Sheet1&quot;<br>  var ws = wb.Sheets[SHEET_NAME];</pre><pre>if (ws) {<br>   // Convert worksheet to JSON<br>   dataArray = XLSX.utils.sheet_to_json(ws);<br>  }</pre><pre>console.log(dataArray);<br>  return dataArray;<br> }</pre><pre>return PageModule;<br>});</pre><h3>Test</h3><ul><li>Run the application and you should see the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EyrWmKCp9hkxbFkPOTVDpg.png" /></figure><ul><li>Click on ‘Export Excel’ button. This will parse the JSON data and generate <strong>contacts.xlsx </strong>file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nKor2-fPYghqAZ8bO7pIUA.png" /></figure><ul><li>Click on ‘Import Excel’ button and select <strong>contacts.xlsx</strong> (downloaded in previous step). This will read the <strong>contacts.xlsx </strong>file and convert to JSON.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opVuusiEG3RXR0H_5JXFWA.png" /></figure><h3>References</h3><p><a href="https://github.com/sheetjs/sheetjs">SheetJS</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1044d697255d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/vb-parsing-and-writing-excel-files-1044d697255d">VB: Parsing and Writing Excel Files</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VB: Dynamic List View with Drag and Drop]]></title>
            <link>https://medium.com/oracle-jet/vb-dynamic-list-view-with-drag-and-drop-16441f3fe25b?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/16441f3fe25b</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-visual-builder]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[visual-builder]]></category>
            <dc:creator><![CDATA[Steve Zebib]]></dc:creator>
            <pubDate>Fri, 06 Aug 2021 01:01:13 GMT</pubDate>
            <atom:updated>2021-10-20T05:52:21.543Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER: </em></strong><em>The views expressed in this story are my own and do not necessarily reflect the views of Oracle.</em></p><h3>Overview</h3><p>This article provides an example for how to generate multiple list view components with drag and drop enabled. The drag and drop is useful for moving items between different list views.</p><p>For this example, we will build a drag and drop dashboard for moving tasks from one status to another. This will include 3 separate lists one for each of the following statuses: Open, In Progress, and Closed. This example will also generate the list views dynamically when the application starts.</p><h3>Setup</h3><p>NOTE: All of the below files including the JSON, HTML, and JS can be found in the VBCS web application main page flow.</p><p><strong>JSON</strong></p><ul><li>The Metadata below includes all variables, types, action chains, and events required for this web application. Copy the following into the <strong>main-start-page.json</strong> file:</li></ul><pre>{<br>  &quot;title&quot;: &quot;&quot;,<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;variables&quot;: {<br>    &quot;dataReady&quot;: {<br>      &quot;type&quot;: &quot;boolean&quot;,<br>      &quot;defaultValue&quot;: false<br>    },<br>    &quot;treeDataProvider&quot;: {<br>      &quot;type&quot;: &quot;any&quot;<br>    }<br>  },<br>  &quot;metadata&quot;: {},<br>  &quot;types&quot;: {},<br>  &quot;chains&quot;: {<br>    &quot;initActionChain&quot;: {<br>      &quot;variables&quot;: {},<br>      &quot;root&quot;: &quot;callFunctionBuildTree&quot;,<br>      &quot;actions&quot;: {<br>        &quot;callFunctionBuildTree&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/callModuleFunctionAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;module&quot;: &quot;[[ $functions ]]&quot;,<br>            &quot;functionName&quot;: &quot;buildTree&quot;,<br>            &quot;returnType&quot;: &quot;any&quot;,<br>            &quot;params&quot;: []<br>          },<br>          &quot;outcomes&quot;: {<br>            &quot;success&quot;: &quot;assignVariablesTreeDataProvider&quot;<br>          }<br>        },<br>        &quot;assignVariablesReady&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/assignVariablesAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;$page.variables.dataReady&quot;: {<br>              &quot;source&quot;: true<br>            }<br>          }<br>        },<br>        &quot;assignVariablesTreeDataProvider&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/assignVariablesAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;$page.variables.treeDataProvider&quot;: {<br>              &quot;source&quot;: &quot;{{ $chain.results.callFunctionBuildTree }}&quot;,<br>              &quot;reset&quot;: &quot;empty&quot;<br>            }<br>          },<br>          &quot;outcomes&quot;: {<br>            &quot;success&quot;: &quot;assignVariablesReady&quot;<br>          }<br>        }<br>      }<br>    }<br>  },<br>  &quot;eventListeners&quot;: {<br>    &quot;vbEnter&quot;: {<br>      &quot;chains&quot;: [<br>        {<br>          &quot;chainId&quot;: &quot;initActionChain&quot;,<br>          &quot;parameters&quot;: {}<br>        }<br>      ]<br>    }<br>  },<br>  &quot;imports&quot;: {<br>    &quot;components&quot;: {<br>      &quot;oj-input-date&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojdatetimepicker&quot;<br>      },<br>      &quot;oj-list-item-layout&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojlistitemlayout&quot;<br>      },<br>      &quot;oj-list-view&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojlistview&quot;<br>      }<br>    }<br>  },<br>  &quot;events&quot;: {}<br>}</pre><p><strong>HTML</strong></p><ul><li>The HTML below includes diagram component with its templates. Copy the following into <strong>main-start-page.html</strong> file:</li></ul><pre>&lt;oj-bind-if test=&quot;[[ $variables.dataReady ]]&quot;&gt;<br> &lt;div id=&quot;container&quot; class=&quot;oj-flex oj-sm-flex-wrap-nowrap&quot;&gt;<br>  &lt;oj-bind-for-each data=&quot;[[ $variables.treeDataProvider ]]&quot;&gt;<br>   &lt;template&gt;<br>    &lt;div class=&quot;oj-flex oj-sm-flex-direction-column&quot; style=&quot;border-right: 1px solid lightgrey;&quot;&gt;<br>     &lt;div<br>      class=&quot;oj-flex oj-sm-align-items-center oj-sm-align-self-center stage-header oj-sm-justify-content-space-between oj-sm-flex-wrap-nowrap&quot;&gt;<br>      &lt;div class=&quot;oj-typography-body-md oj-typography-bold stage-header-text&quot;&gt;<br>       &lt;oj-bind-text<br>        value=&quot;[[ $current.data.statusName + &#39; (&#39; + $functions.getCount($current.data.items) + &#39;) &#39; ]]&quot;&gt;&lt;/oj-bind-text&gt;<br>      &lt;/div&gt;<br>     &lt;/div&gt;<br>     &lt;div class=&quot;oj-flex oj-sm-flex-direction-column oj-sm-flex-wrap-nowrap oj-sm-align-items-center&quot;&gt;<br>      &lt;div class=&quot;oj-flex oj-sm-flex-direction-column&quot;&gt;<br>       &lt;oj-list-view :id=&quot;[[ $current.data.statusId ]]&quot;<br>        data=&quot;[[$functions.buildADP($current.data.statusId,$current.data.items)]]&quot;<br>        dnd.drop.items.data-types=&#39;[&quot;application/ojlistviewitems+json&quot;]&#39;<br>        dnd.drop.items.drop=&quot;[[$functions.handleDrop($current.data.statusId)]]&quot;<br>        dnd.drag.items.data-types=&#39;[&quot;application/ojlistviewitems+json&quot;]&#39;<br>        dnd.drag.items.drag-start=&quot;[[$functions.handleDragStart($current.data.statusId)]]&quot;<br>        dnd.drag.items.drag-end=&quot;[[$functions.handleDragEnd($current.data.statusId)]]&quot;<br>        style=&quot;min-height: 500px; min-width: 250px;&quot;&gt;<br>        &lt;template slot=&quot;itemTemplate&quot; data-oj-as=&quot;item&quot;&gt;<br>         &lt;li&gt;<br>          &lt;oj-list-item-layout&gt;<br>           &lt;div<br>            class=&quot;oj-panel oj-flex oj-sm-flex-direction-column oj-sm-justify-content-space-between opty-card&quot;&gt;<br>            &lt;div<br>             class=&quot;oj-flex oj-sm-align-items-center oj-sm-justify-content-center&quot;&gt;<br>             &lt;div role=&quot;button&quot; tabindex=&quot;0&quot;<br>              class=&quot;oj-sm-align-self-center oj-sm-margin-4x-horizontal oj-listview-drag-handle&quot;&gt;&lt;/div&gt;<br>            &lt;/div&gt;<br>            &lt;div class=&quot;oj-flex&quot; style=&quot;padding: 5px&quot;&gt;<br>             &lt;div class=&quot;oj-text-color-primary&quot;&gt;<br>              &lt;oj-bind-text value=&quot;[[ item.data.Name  ]]&quot;&gt;&lt;/oj-bind-text&gt;<br>             &lt;/div&gt;<br>            &lt;/div&gt;<br>            &lt;div class=&quot;oj-flex-bar oj-sm-align-items-center&quot;<br>             style=&quot;height:40px; padding:5px&quot;&gt;<br>             &lt;div class=&quot;oj-flex oj-sm-flex-direction-column oj-flex-bar-start&quot;&gt;<br>              &lt;div<br>               class=&quot;oj-flex-item oj-sm-12 oj-text-color-secondary oj-md-12&quot;&gt;<br>               &lt;oj-input-date <br>                value=&quot;[[ item.data.EffectiveDate ]]&quot; readonly=&quot;true&quot;<br>                disabled=&quot;true&quot;&gt;&lt;/oj-input-date&gt;<br>              &lt;/div&gt;<br>             &lt;/div&gt;<br>             &lt;div class=&quot;oj-flex oj-sm-flex-direction-column oj-flex-bar-end&quot;&gt;<br>              &lt;span class=&quot;oj-flex-item oj-sm-flex-initial vb-icon vb-icon-ellipsis&quot;&gt;&lt;/span&gt;<br>             &lt;/div&gt;<br>            &lt;/div&gt;<br>           &lt;/div&gt;<br>          &lt;/oj-list-item-layout&gt;<br>         &lt;/li&gt;<br>        &lt;/template&gt;<br>       &lt;/oj-list-view&gt;<br>      &lt;/div&gt;<br>     &lt;/div&gt;<br>    &lt;/div&gt;<br>   &lt;/template&gt;<br>  &lt;/oj-bind-for-each&gt;<br> &lt;/div&gt;<br>&lt;/oj-bind-if&gt;</pre><p><strong>JS</strong></p><ul><li>The JS below includes functions needed to initialize the diagram component. This includes functions which will be assigned to variables that are referenced by the component. Copy the following into <strong>main-start-page.js </strong>file:</li></ul><pre>define([&quot;require&quot;, &quot;knockout&quot;, &quot;ojs/ojbootstrap&quot;, &quot;ojs/ojarraytreedataprovider&quot;, &quot;ojs/ojarraydataprovider&quot;, &quot;ojs/ojknockout&quot;, &quot;ojs/ojlistviewdnd&quot;], function(<br> require, ko, ojbootstrap_1, ArrayTreeDataProvider, ArrayDataProvider) {<br> &#39;use strict&#39;;</pre><pre>var treeDataArray;<br> var statusMap = new Map();<br> var dataTypes = &quot;application/ojlistviewitems+json&quot;;<br> var dataArrayMap = new Map();<br> var handleDragStartMap = new Map();<br> var handleDragEndMap = new Map();<br> var handleDropMap = new Map();</pre><pre>var statusArray = [{<br>   &quot;Id&quot;: 1,<br>   &quot;Name&quot;: &quot;Open&quot;<br>  },<br>  {<br>   &quot;Id&quot;: 2,<br>   &quot;Name&quot;: &quot;In Progress&quot;<br>  },<br>  {<br>   &quot;Id&quot;: 3,<br>   &quot;Name&quot;: &quot;Closed&quot;<br>  }<br> ];</pre><pre>var dataArray = [{<br>   &quot;Name&quot;: &quot;Task #1&quot;,<br>   &quot;Id&quot;: 10001,<br>   &quot;EffectiveDate&quot;: &quot;2021-08-01T00:00:00.000+0000&quot;,<br>   &quot;StatusId&quot;: 3<br>  },<br>  {<br>   &quot;Name&quot;: &quot;Task #2&quot;,<br>   &quot;Id&quot;: 10002,<br>   &quot;EffectiveDate&quot;: &quot;2021-08-01T00:00:00.000+0000&quot;,<br>   &quot;StatusId&quot;: 3<br>  },<br>  {<br>   &quot;Name&quot;: &quot;Task #3&quot;,<br>   &quot;Id&quot;: 10003,<br>   &quot;EffectiveDate&quot;: &quot;2021-08-01T00:00:00.000+0000&quot;,<br>   &quot;StatusId&quot;: 2<br>  },<br>  {<br>   &quot;Name&quot;: &quot;Task #4&quot;,<br>   &quot;Id&quot;: 10004,<br>   &quot;EffectiveDate&quot;: &quot;2021-08-01T00:00:00.000+0000&quot;,<br>   &quot;StatusId&quot;: 2<br>  },<br>  {<br>   &quot;Name&quot;: &quot;Task #5&quot;,<br>   &quot;Id&quot;: 10005,<br>   &quot;EffectiveDate&quot;: &quot;2021-08-01T00:00:00.000+0000&quot;,<br>   &quot;StatusId&quot;: 1<br>  }<br> ];</pre><pre>var PageModule = function PageModule() {};</pre><pre>PageModule.prototype.buildTree = function() {<br>  for (let i = 0; i &lt; statusArray.length; i++) {<br>   let status = statusArray[i];<br>   if (!statusMap.has(status.Id)) {<br>    let data = {<br>     &quot;statusId&quot;: status.Id,<br>     &quot;statusName&quot;: status.Name,<br>     &quot;items&quot;: []<br>    };</pre><pre>statusMap.set(status.Id, data);<br>   }<br>  };</pre><pre>treeDataArray = processArray(dataArray);</pre><pre>return new ArrayTreeDataProvider(treeDataArray, {<br>   keyAttributes: &#39;id&#39;,<br>   keyAttributesScope: &#39;siblings&#39;,<br>   childrenAttribute: &#39;items&#39;<br>  });<br> };</pre><pre>function processArray(array) {<br>  if (array) {<br>   for (let i = 0; i &lt; array.length; i++) {<br>    let item = array[i];</pre><pre>if (item) {<br>     let data = statusMap.get(item.StatusId);<br>     data.items.push(item);<br>     data.count = data.items.length;</pre><pre>statusMap.set(item.StatusId, data);<br>    }<br>   };<br>  };</pre><pre>let updatedArray = [...statusMap.values()];<br>  updatedArray.sort((a, b) =&gt; (a.statusId &gt; b.statusId) ? 1 : -1);</pre><pre>return ko.observableArray(updatedArray);<br> };</pre><pre>PageModule.prototype.getCount = function(array) {<br>  let count = 0;</pre><pre>if (array) {<br>   count = array.length;<br>  }</pre><pre>return count;<br> };</pre><pre>PageModule.prototype.buildADP = function(statusId, array) {<br>  this.dataArray = ko.observableArray(array);<br>  dataArrayMap.set(statusId, this.dataArray);</pre><pre>let dataProvider = new ArrayDataProvider(this.dataArray, {<br>   keyAttributes: &#39;Id&#39;<br>  });</pre><pre>return dataProvider;<br> };</pre><pre>PageModule.prototype.handleDragStart = function(statusId) {<br>  // Handle drag start from drag and drop with mouse/touch.<br>  let handleDragStart = (event, context) =&gt; {<br>   const dataStr = event.dataTransfer.getData(dataTypes);<br>   const data = JSON.parse(dataStr);<br>   this.sourceItemId = context.items[0].Id;<br>   this.sourceStatusId = context.items[0].StatusId;<br>  };</pre><pre>handleDragStartMap.set(statusId, handleDragStart);<br>  return handleDragStart;<br> };</pre><pre>PageModule.prototype.handleDragEnd = function(statusId) {<br>  // Handle drag end from drag and drop with mouse/touch.<br>  let handleDragEnd = (event) =&gt; {<br>   if (event.dataTransfer.dropEffect !== &quot;none&quot;) {}<br>  };</pre><pre>handleDragEndMap.set(statusId, handleDragEnd);<br>  return handleDragEnd;<br> };</pre><pre>PageModule.prototype.handleDrop = function(statusId) {<br>  let handleDrop = (event, context) =&gt; {<br>   event.preventDefault();<br>   let index = -1;<br>   if (context.item) {<br>    const itemContext = document.getElementById(statusId).getContextByNode(context.item);<br>    index = itemContext.index;<br>    if (context.position === &quot;after&quot;) {<br>     index += 1;<br>    }<br>   }</pre><pre>handleDataTransfer(event.dataTransfer, index, statusId);<br>  };</pre><pre>// Handle drop from drag and drop,<br>  let handleDataTransfer = (dataTransfer, index, statusId) =&gt; {<br>   const dataStr = dataTransfer.getData(dataTypes);<br>   const data = JSON.parse(dataStr)[0];<br>   if (this.sourceStatusId != statusId) {<br>    insertTargetItem(data, index, statusId);<br>    removeSourceItem(this.sourceItemId, this.sourceStatusId);<br>   }<br>  };</pre><pre>// Insert item into array.  This is invoked by drop.<br>  let insertTargetItem = (data, index, targetStatusId) =&gt; {<br>   const arr = dataArrayMap.get(targetStatusId);</pre><pre>data.StatusId = targetStatusId;</pre><pre>if (index === -1) {<br>    arr.push(data);<br>   } else {<br>    arr.splice(index, 0, data);<br>   }</pre><pre>arr.valueHasMutated();<br>   treeDataArray.valueHasMutated();<br>  };</pre><pre>// Remove item from array.  This is invoked by drop.<br>  let removeSourceItem = (itemId, sourceStatusId) =&gt; {<br>   const arr = dataArrayMap.get(sourceStatusId);<br>   if (arr) {<br>    arr.remove(function(item) {<br>     return item.Id === itemId;<br>    });<br>    arr.valueHasMutated();<br>    treeDataArray.valueHasMutated();<br>   }<br>  };</pre><pre>handleDropMap.set(statusId, handleDrop);<br>  return handleDrop;<br> };</pre><pre>return PageModule;<br>});</pre><h3>Test</h3><ul><li>Run the application and you should see the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vEYNx89cGtWDhrvFR-7W7A.png" /></figure><ul><li>Drag and drop an item from one status to another. For example, we will move Task #3 from ‘In Progress’ to ‘Closed’ status as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xBCOyagJ2pVyXXaN663iag.png" /></figure><h3>References</h3><p><a href="https://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=listView&amp;demo=withTableDndListView">Oracle JET Cookbook — List View Drag and Drop</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16441f3fe25b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/vb-dynamic-list-view-with-drag-and-drop-16441f3fe25b">VB: Dynamic List View with Drag and Drop</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VB: JET Diagram Component Implementation]]></title>
            <link>https://medium.com/oracle-jet/vb-jet-diagram-component-implementation-82b1f4c053d2?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/82b1f4c053d2</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[oracle-visual-builder]]></category>
            <category><![CDATA[visual-builder]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <dc:creator><![CDATA[Steve Zebib]]></dc:creator>
            <pubDate>Fri, 23 Jul 2021 18:48:59 GMT</pubDate>
            <atom:updated>2021-08-04T16:33:22.179Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER: </em></strong><em>The views expressed in this story are my own and do not necessarily reflect the views of Oracle.</em></p><h3>Overview</h3><p>This article provides an example on how to implement the JET Diagram component in Oracle Visual Builder. This component is useful for displaying nested containers or hierarchy.</p><h3>Setup</h3><p>All of the below files including the JSON, HTML, and JS can be found in the VBCS web application main page flow.</p><p><strong>JSON</strong></p><ul><li>The Metadata below includes all variables, types, action chains, and events required for this web application. Copy the following into the <strong>main-start-page.json</strong> file:</li></ul><pre>{<br>  &quot;title&quot;: &quot;&quot;,<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;variables&quot;: {<br>    &quot;expandedNodes&quot;: {<br>      &quot;type&quot;: &quot;any&quot;<br>    },<br>    &quot;layoutFunc&quot;: {<br>      &quot;type&quot;: &quot;any&quot;<br>    },<br>    &quot;linkDataProvider&quot;: {<br>      &quot;type&quot;: &quot;any&quot;<br>    },<br>    &quot;nodeDataProvider&quot;: {<br>      &quot;type&quot;: &quot;any&quot;<br>    }<br>  },<br>  &quot;metadata&quot;: {},<br>  &quot;types&quot;: {},<br>  &quot;chains&quot;: {<br>    &quot;initActionChain&quot;: {<br>      &quot;description&quot;: &quot;&quot;,<br>      &quot;variables&quot;: {},<br>      &quot;root&quot;: &quot;callFunctionInit&quot;,<br>      &quot;actions&quot;: {<br>        &quot;callFunctionInit&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/callModuleFunctionAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;module&quot;: &quot;[[ $functions ]]&quot;,<br>            &quot;functionName&quot;: &quot;init&quot;<br>          },<br>          &quot;outcomes&quot;: {<br>            &quot;success&quot;: &quot;callFunctionGetExpandedNodes&quot;<br>          }<br>        },<br>        &quot;callFunctionGetExpandedNodes&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/callModuleFunctionAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;module&quot;: &quot;[[ $functions ]]&quot;,<br>            &quot;functionName&quot;: &quot;getExpandedNodes&quot;,<br>            &quot;returnType&quot;: &quot;any&quot;<br>          },<br>          &quot;outcomes&quot;: {<br>            &quot;success&quot;: &quot;callFunctionGetLayoutFunc&quot;<br>          }<br>        },<br>        &quot;callFunctionGetLayoutFunc&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/callModuleFunctionAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;module&quot;: &quot;[[ $functions ]]&quot;,<br>            &quot;functionName&quot;: &quot;getLayoutFunc&quot;,<br>            &quot;returnType&quot;: &quot;any&quot;<br>          },<br>          &quot;outcomes&quot;: {<br>            &quot;success&quot;: &quot;callFunctionGetLinkDataProvider&quot;<br>          }<br>        },<br>        &quot;callFunctionGetLinkDataProvider&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/callModuleFunctionAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;module&quot;: &quot;[[ $functions ]]&quot;,<br>            &quot;functionName&quot;: &quot;getLinkDataProvider&quot;,<br>            &quot;returnType&quot;: &quot;any&quot;<br>          },<br>          &quot;outcomes&quot;: {<br>            &quot;success&quot;: &quot;callFunctionGetNodeDataProvider&quot;<br>          }<br>        },<br>        &quot;callFunctionGetNodeDataProvider&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/callModuleFunctionAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;module&quot;: &quot;[[ $functions ]]&quot;,<br>            &quot;functionName&quot;: &quot;getNodeDataProvider&quot;,<br>            &quot;returnType&quot;: &quot;any&quot;<br>          },<br>          &quot;outcomes&quot;: {<br>            &quot;success&quot;: &quot;assignVariablesExpandedNodes&quot;<br>          }<br>        },<br>        &quot;assignVariablesExpandedNodes&quot;: {<br>          &quot;module&quot;: &quot;vb/action/builtin/assignVariablesAction&quot;,<br>          &quot;parameters&quot;: {<br>            &quot;$page.variables.expandedNodes&quot;: {<br>              &quot;source&quot;: &quot;{{ $chain.results.callFunctionGetExpandedNodes }}&quot;<br>            },<br>            &quot;$page.variables.layoutFunc&quot;: {<br>              &quot;source&quot;: &quot;{{ $chain.results.callFunctionGetLayoutFunc }}&quot;<br>            },<br>            &quot;$page.variables.linkDataProvider&quot;: {<br>              &quot;source&quot;: &quot;{{ $chain.results.callFunctionGetLinkDataProvider }}&quot;<br>            },<br>            &quot;$page.variables.nodeDataProvider&quot;: {<br>              &quot;source&quot;: &quot;{{ $chain.results.callFunctionGetNodeDataProvider }}&quot;<br>            }<br>          }<br>        }<br>      }<br>    }<br>  },<br>  &quot;eventListeners&quot;: {<br>    &quot;vbEnter&quot;: {<br>      &quot;chains&quot;: [<br>        {<br>          &quot;chainId&quot;: &quot;initActionChain&quot;,<br>          &quot;parameters&quot;: {}<br>        }<br>      ]<br>    }<br>  },<br>  &quot;imports&quot;: {<br>    &quot;components&quot;: {<br>      &quot;oj-diagram&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojdiagram&quot;<br>      },<br>      &quot;oj-diagram-link&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojdiagram&quot;<br>      },<br>      &quot;oj-diagram-node&quot;: {<br>        &quot;path&quot;: &quot;ojs/ojdiagram&quot;<br>      }<br>    }<br>  }<br>}</pre><p><strong>HTML</strong></p><ul><li>The HTML below includes diagram component with its templates. Copy the following into <strong>main-start-page.html</strong> file:</li></ul><pre>&lt;div id=&quot;componentDemoContent&quot; style=&quot;min-width: 100%;&quot;&gt;<br>&lt;oj-diagram id=&#39;diagram-container&#39; node-data=&#39;[[$variables.nodeDataProvider]]&#39; link-data=&#39;[[$variables.linkDataProvider]]&#39; layout=&#39;[[ $variables.layoutFunc ]]&#39; animation-on-data-change=&#39;auto&#39; animation-on-display=&#39;auto&#39; max-zoom=&#39;2.0&#39; promoted-link-behavior=&#39;full&#39; expanded=&quot;{{ $variables.expandedNodes }}&quot;&gt;<br>&lt;template slot=&quot;nodeTemplate&quot; data-oj-as=&quot;node&quot;&gt;<br>&lt;oj-diagram-node label=&#39;[[node.data.name]]&#39; icon.width=&#39;100&#39; icon.height=&#39;60&#39; icon.shape=&#39;rectangle&#39;<br>icon.color=&#39;#f9f9f9&#39; icon.border-radius=&#39;1px&#39; icon.border<br>width=&#39;0.5&#39; icon.border-color=&#39;#444444&#39;<br>short-desc=&#39;[[node.data.name]]&#39;&gt;<br>&lt;/oj-diagram-node&gt;<br>&lt;/template&gt;<br>&lt;template slot=&quot;linkTemplate&quot; data-oj-as=&quot;link&quot;&gt;<br>&lt;oj-diagram-link start-node=&quot;[[link.data.startNode]]&quot; end-node=&quot;[[link.data.endNode]]&quot; start-connector-type=&quot;none&quot; end-connector-type=&quot;none&quot; short-desc=&#39;[[link.data.name]]&#39;&gt;<br>&lt;/oj-diagram-link&gt;<br>&lt;/template&gt;<br>&lt;/oj-diagram&gt;<br>&lt;/div&gt;</pre><p><strong>JS</strong></p><ul><li>The JS below includes functions needed to initialize the diagram component. This includes functions which will be assigned to variables that are referenced by the component. Copy the following into <strong>main-start-page.js </strong>file:</li></ul><pre>define([&quot;require&quot;, &quot;knockout&quot;, &quot;ojs/ojbootstrap&quot;,<br>&quot;ojs/ojarraydataprovider&quot;, &quot;ojs/ojarraytreedataprovider&quot;, &quot;ojs/ojknockout-keyset&quot;, &quot;ojs/ojknockout&quot;, &quot;ojs/ojdiagram&quot;],<br>function (require, ko, ojbootstrap_1, ArrayDataProvider,     ArrayTreeDataProvider, ojknockout_keyset_1) {</pre><pre>&#39;use strict&#39;;</pre><pre>class DemoContainerLayout {<br>/**<br>* Main function that performs container layout (Layout entry point)<br>* Top level nodes are positioned horizontally. Nodes inside containers are positioned vertically.<br>* @param {DvtDiagramLayoutContext} layoutContext object that defines a context for layout call<br>*/</pre><pre>static containerLayout(layoutContext) {<br>const nodeCount = layoutContext.getNodeCount();<br>let currX = 0;<br>for (let ni = 0; ni &lt; nodeCount; ni++) {<br> const node = layoutContext.getNodeByIndex(ni);<br> if (node.isDisclosed() &amp;&amp; node.getChildNodes()) {<br>DemoContainerLayout._layoutVertical(layoutContext,  node.getChildNodes());<br>}</pre><pre>const bounds = node.getContentBounds();</pre><pre>node.setPosition({ x: currX, y: -bounds.y - bounds.h * 0.5 });<br>DemoContainerLayout._positionLabel(node);<br>currX += bounds.w + 50;<br>}</pre><pre>//position the links<br>const linkCount = layoutContext.getLinkCount();<br>for (let i = 0; i &lt; linkCount; i++) {<br>DemoContainerLayout._createLink(layoutContext, layoutContext.getLinkByIndex(i));<br>}<br>}</pre><pre>/**<br>* Layout child nodes vertically<br>* @param {DvtDiagramLayoutContext} layoutContext layout context<br>* @param {array} nodes nodes array<br>*/</pre><pre>static _layoutVertical(layoutContext, nodes) {<br>const padding = 20;<br>let currX = 0;<br>let currY = 0;</pre><pre>const nodeCount = nodes.length;<br>for (let ni = 0; ni &lt; nodeCount; ni++) {<br>const node = nodes[ni];<br>if (node.isDisclosed() &amp;&amp; node.getChildNodes()) {<br>DemoContainerLayout._layoutVertical(layoutContext, node.getChildNodes());<br>}</pre><pre>const bounds = node.getContentBounds();<br>node.setPosition({ x: currX - bounds.x - bounds.w * 0.5, y: currY });</pre><pre>DemoContainerLayout._positionLabel(node);<br>currY += bounds.h + padding;<br>}<br>}</pre><pre>/**<br>* Helper function creates a curved link between nodes<br>* @param {DvtDiagramLayoutContext} layoutContext Object that defines a context for layout call<br>* @param {DvtDiagramLayoutContextLink} link Link object<br>*/</pre><pre>static _createLink(layoutContext, link) {<br>const startId = link.getStartId();<br>const endId = link.getEndId();<br>const node1 = layoutContext.getNodeById(startId);<br>const node2 = layoutContext.getNodeById(endId);<br>const commonContainerId = layoutContext.getCommonContainer(startId, endId);<br>const n1Position = node1.getRelativePosition(commonContainerId);<br>const n2Position = node2.getRelativePosition(commonContainerId);<br>link.setCoordinateSpace(commonContainerId);</pre><pre>const n1Bounds = node1.getBounds();<br>const n2Bounds = node2.getBounds();<br>let startX, startY, endX, endY;</pre><pre>//find centers<br>const cn1X = n1Position.x + 0.5 * n1Bounds.w;<br>const cn2X = n2Position.x + 0.5 * n2Bounds.w;</pre><pre>if (Math.abs(cn1X - cn2X) &lt; 10) {</pre><pre>//vertical nodes<br>const cn1Y = 0.5 * (n1Position.y + n1Bounds.h);<br>const cn2Y = 0.5 * (n2Position.y + n2Bounds.h);<br>startX = n1Position.x + 0.5 * n1Bounds.w;<br>endX = n2Position.x + 0.5 * n2Bounds.w;</pre><pre>if (cn1Y &lt; cn2Y) {<br>startY = n1Position.y + n1Bounds.h + link.getStartConnectorOffset();<br>endY = n2Position.y - link.getEndConnectorOffset();<br>}</pre><pre>else {<br>startY = n1Position.y - link.getEndConnectorOffset();<br>endY = n2Position.y + n2Bounds.h + link.getStartConnectorOffset();<br>}<br>link.setPoints(DemoContainerLayout._createVerticalLinkPath(startX, startY, endX, endY));</pre><pre>} else {<br>//horizontal</pre><pre>if (cn1X &lt; cn2X) {<br>//left to right<br>startX =<br>n1Position.x +<br>n1Bounds.x +<br>n1Bounds.w +<br>link.getStartConnectorOffset();<br>endX = n2Position.x - link.getEndConnectorOffset();</pre><pre>} else {<br>//right to left<br>startX = n1Position.x - link.getStartConnectorOffset();<br>endX = n2Position.x + n2Bounds.x + n2Bounds.w + link.getEndConnectorOffset();<br>}</pre><pre>startY = n1Position.y + n1Bounds.y + 0.5 * n1Bounds.h;<br>endY = n2Position.y + n2Bounds.y + 0.5 * n2Bounds.h;</pre><pre>link.setPoints(DemoContainerLayout._createSideLinkPath(startX, startY, endX, endY));<br>}</pre><pre>//center label on link<br>const labelBounds = link.getLabelBounds();<br>if (labelBounds) {<br>const labelX = startX;<br>const labelY = startY - labelBounds.h;<br>//link.setLabelPosition(new DvtDiagramPoint(labelX, labelY));<br>link.setLabelPosition({ x: labelX, y: labelY });<br>}<br>}</pre><pre>/**<br>* Helper function creates a curved link that connects nodes sides<br>* The function uses quadratic Bezier to create a curve<br>* @param {number} startX X coordinate for the link start* @param {number} startY Y coordinate for the link start<br>* @param {number} endX X coordinate for the link end<br>* @param {number} endY Y coordinate for the link end<br>*/</pre><pre>static _createSideLinkPath(startX, startY, endX, endY) {<br>const path = [&quot;M&quot;, startX, startY];<br>const midX = startX + 0.5 * (endX - startX);<br>const midY = startY + 0.5 * (endY - startY);<br>const c1X = midX; // X coordinate for the first control point<br>const c1Y = startY; // Y coordinate for the first control point<br>const c2X = midX; // X coordinate for the second control point<br>const c2Y = endY; // Y coordinate for the second control point<br>path.push(&quot;Q&quot;);<br>path.push(c1X);<br>path.push(c1Y);<br>path.push(midX);<br>path.push(midY);<br>path.push(&quot;Q&quot;);<br>path.push(c2X);<br>path.push(c2Y);<br>path.push(endX);<br>path.push(endY);</pre><pre>return path;</pre><pre>}</pre><pre>/**<br>* Helper function creates a plain link that connects nodes bottom to top<br>* @param {number} startX X coordinate for the link start<br>* @param {number} startY Y coordinate for the link start<br>* @param {number} endX X coordinate for the link end<br>* @param {number} endY Y coordinate for the link end<br>*/</pre><pre>static _createVerticalLinkPath(startX, startY, endX, endY) {<br>const path = [&quot;M&quot;, startX, startY];<br>path.push(&quot;L&quot;);<br>path.push(endX);<br>path.push(endY);</pre><pre>return path;<br>}</pre><pre>/**<br>* Helper function that sets label position in the middle of the diagram node<br>* @param {DvtDiagramLayoutContextNode} node object that defines node context for the layout<br>*/</pre><pre>static _positionLabel(node) {<br>const nodeBounds = node.getContentBounds();<br>const nodePos = node.getPosition();<br>const nodeLabelBounds = node.getLabelBounds();<br>let labelY;</pre><pre>if (nodeLabelBounds) {</pre><pre>if (node.isDisclosed()) {<br>//position label in the middle of top 20 px of the node<br>labelY = nodeBounds.y + nodePos.y + 0.5 * (20 - nodeLabelBounds.h);<br>} else {<br>//position label in the middle of the node<br>labelY = nodeBounds.y + nodePos.y + 0.5 * (nodeBounds.h - nodeLabelBounds.h);<br>}</pre><pre>const labelX = nodeBounds.x + nodePos.x + 0.5 * nodeBounds.w;<br>node.setLabelPosition({ x: labelX, y: labelY });<br>node.setLabelHalign(&quot;center&quot;);<br>}<br>}<br>}</pre><pre>var PageModule = function PageModule() { };</pre><pre>var data = {<br>&quot;nodes&quot;: [{<br>&quot;id&quot;: &quot;N0&quot;,<br>&quot;name&quot;: &quot;North America&quot;<br>},<br>{<br>&quot;id&quot;: &quot;N1&quot;,<br>&quot;name&quot;: &quot;Country&quot;,<br>&quot;nodes&quot;: [{<br>&quot;id&quot;: &quot;N01&quot;,<br>&quot;name&quot;: &quot;US&quot;<br>}]<br>},<br>{<br>&quot;id&quot;: &quot;N2&quot;,<br>&quot;name&quot;: &quot;Regions&quot;,<br>&quot;nodes&quot;: [{<br>&quot;id&quot;: &quot;N20&quot;,<br>&quot;name&quot;: &quot;Northeast&quot;,<br>&quot;nodes&quot;: [{<br>&quot;id&quot;: &quot;N201&quot;,<br>&quot;name&quot;: &quot;Mid Atlantic&quot;<br>},<br>{<br>&quot;id&quot;: &quot;N202&quot;,<br>&quot;name&quot;: &quot;New England&quot;<br>}]<br>},<br>{<br>&quot;id&quot;: &quot;N21&quot;,<br>&quot;name&quot;: &quot;Midwest&quot;,<br>&quot;nodes&quot;: [{<br>&quot;id&quot;: &quot;N212&quot;,<br>&quot;name&quot;: &quot;West North Central&quot;<br>},<br>{<br>&quot;id&quot;: &quot;N211&quot;,<br>&quot;name&quot;: &quot;East North Central&quot;<br>}]<br>},<br>{<br>&quot;id&quot;: &quot;N22&quot;,<br>&quot;name&quot;: &quot;South&quot;,<br>&quot;nodes&quot;: [{<br>&quot;id&quot;: &quot;N221&quot;,<br>&quot;name&quot;: &quot;West North Central&quot;<br>},<br>{<br>&quot;id&quot;: &quot;N222&quot;,<br>&quot;name&quot;: &quot;East North Central&quot;<br>},<br>{<br>&quot;id&quot;: &quot;N223&quot;,<br>&quot;name&quot;: &quot;South Atlantic&quot;<br>}]<br>},<br>{<br>&quot;id&quot;: &quot;N23&quot;,<br>&quot;name&quot;: &quot;West&quot;,<br>&quot;nodes&quot;: [{<br>&quot;id&quot;: &quot;N231&quot;,<br>&quot;name&quot;: &quot;Pacific&quot;<br>},<br>{<br>&quot;id&quot;: &quot;N232&quot;,<br>&quot;name&quot;: &quot;Mountain&quot;<br>}]<br>}]<br>}],<br>&quot;links&quot;: [{<br>&quot;id&quot;: &quot;L0&quot;,<br>&quot;startNode&quot;: &quot;N0&quot;,<br>&quot;endNode&quot;: &quot;N1&quot;<br>},<br>{<br>&quot;id&quot;: &quot;L1&quot;,<br>&quot;startNode&quot;: &quot;N1&quot;,<br>&quot;endNode&quot;: &quot;N2&quot;<br>}]<br>};</pre><pre>var nodeDataProvider;<br>var linkDataProvider;<br>var expandedNodes;<br>var layoutFunc;</pre><pre>PageModule.prototype.getNodeDataProvider = function () {<br> return nodeDataProvider;<br>};</pre><pre>PageModule.prototype.getLinkDataProvider = function () {<br> return linkDataProvider;</pre><pre>};</pre><pre>PageModule.prototype.getExpandedNodes = function () {<br> return expandedNodes;<br>};</pre><pre>PageModule.prototype.getLayoutFunc = function () {<br> return layoutFunc;<br>};</pre><pre>PageModule.prototype.init = function () {<br> class DiagramModel {</pre><pre>constructor() {<br>nodeDataProvider = new ArrayTreeDataProvider(data.nodes, {   keyAttributes: &quot;id&quot;,<br>childrenAttribute: &quot;nodes&quot;,<br>});<br>linkDataProvider = new ArrayDataProvider(data.links, {<br>keyAttributes: &quot;id&quot;,<br>});</pre><pre>expandedNodes = new ojknockout_keyset_1.ObservableKeySet().add([&quot;N0&quot;, &quot;N1&quot;, &quot;N2&quot;]);<br>layoutFunc = DemoContainerLayout.containerLayout;<br>}<br>}</pre><pre>ojbootstrap_1.whenDocumentReady().then(() =&gt; {<br>ko.applyBindings(new DiagramModel(), document.getElementById(&quot;diagram-container&quot;));<br>});};</pre><pre>return PageModule;<br>});</pre><h3>Test</h3><ul><li>Run the application and you should see the diagram shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7KBR4OZPc0leOgE8l0s1zA.png" /></figure><h3>References</h3><p><a href="https://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=diagram&amp;demo=containers">Oracle JET Cookbook — Diagram Component</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82b1f4c053d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/vb-jet-diagram-component-implementation-82b1f4c053d2">VB: JET Diagram Component Implementation</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VB: Array Data Provider (ADP)]]></title>
            <link>https://medium.com/oracle-jet/vb-array-data-provider-adp-30f7f23e68a8?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/30f7f23e68a8</guid>
            <category><![CDATA[visual-builder]]></category>
            <category><![CDATA[oracle-visual-builder]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[oracle]]></category>
            <dc:creator><![CDATA[Steve Zebib]]></dc:creator>
            <pubDate>Thu, 06 May 2021 16:38:25 GMT</pubDate>
            <atom:updated>2022-07-12T21:06:09.312Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER: </em></strong><em>The views expressed in this story are my own and do not necessarily reflect the views of Oracle.</em></p><h3>Overview</h3><p>This article describes how to create and use Array Data Provider (ADP) type in Oracle Visual Builder. ADP provides more flexibility to populate and manipulate data than Service Data Provider (SDP). ADP data can be set from business objects, service connections, or static data.</p><p>In this article, we will demonstrate how to initialize and use ADPs in a VB web application. We will show the following three separate examples:</p><ul><li><strong>ADP — Business Object</strong></li><li><strong>ADP — Static Data</strong></li><li><strong>ADP — Static Data (JS Function)</strong></li></ul><h3>ADP — Business Object</h3><p>Create an ADP variable and load data from a business object.</p><ul><li>Create a <em>Contact</em> business object as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rKbmTDjJhfs_p1aqE-7qSQ.png" /><figcaption>Business Object — Contact</figcaption></figure><ul><li>Create a variable type called <em>contact</em> that includes all fields from <em>Contact</em> business object.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wVyslHXVRH5bA7PInsSdpA.png" /><figcaption>Type — Contact</figcaption></figure><ul><li>Create an ADP variable called <em>contactListADP</em> and select Assign Data Later. Set Item Type to <em>contact </em>and Key Attributes to <em>email.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AsKQvwnTcXAC_u6Atng9zQ.png" /></figure><ul><li>Create an action chain called <em>loadContactsActionChain</em> to populate data for <em>contactListADP.</em></li><li>Call REST API endpoint get all from <em>Contact</em> business object.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDMH2UT14VvZ1bkJV3SY3g.png" /></figure><ul><li>Assign response from REST API to <em>contactsListADP</em> data field as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ZsYYf26gMrlde0CMyd69Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3znTWxbtkpMsoQL3Tv-vzQ.png" /></figure><ul><li>Create an event listener of type vbEnter which calls the action chain created above <em>loadContactsActionChain. </em>This will populate the ADP with data when page has been initialized.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FCJY9LsjVwswbkEn--aiOg.png" /></figure><ul><li>Now we can use our ADP by adding the following HTML:</li></ul><pre>&lt;div class=&quot;oj-flex&quot;&gt;<br>   &lt;oj-table scroll-policy=&quot;loadMoreOnScroll&quot; class=&quot;oj-flex-item   oj-sm-12 oj-md-12&quot; data=&quot;[[ $variables.contactsListADP ]]&quot; columns=&#39;[{&quot;headerText&quot;:&quot;firstName&quot;,&quot;field&quot;:&quot;firstName&quot;},{&quot;headerText&quot;:&quot;lastName&quot;,&quot;field&quot;:&quot;lastName&quot;},{&quot;headerText&quot;:&quot;email&quot;,&quot;field&quot;:&quot;email&quot;},{&quot;headerText&quot;:&quot;phoneNumber&quot;,&quot;field&quot;:&quot;phoneNumber&quot;},{&quot;headerText&quot;:&quot;title&quot;,&quot;field&quot;:&quot;title&quot;},{&quot;headerText&quot;:&quot;company&quot;,&quot;field&quot;:&quot;company&quot;}]&#39;&gt;<br>   &lt;/oj-table&gt;<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PoeVmWG5lro619e-3tirAA.png" /></figure><ul><li>Run the application</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2lC__JxUCyV5DSjpS9T4jg.png" /></figure><h3>ADP — Static Data</h3><p>Create an ADP variable and bind to another variable with static data.</p><ul><li>Create an array of object type called <em>regionList. </em>Add the following default value:</li></ul><pre>[<br>    {<br>        &quot;region&quot;: &quot;us-east&quot;,<br>        &quot;name&quot;: &quot;US-East&quot;<br>    },<br>    {<br>        &quot;region&quot;: &quot;us-central&quot;,<br>        &quot;name&quot;: &quot;US-Central&quot;<br>    },<br>    {<br>        &quot;region&quot;: &quot;us-west&quot;,<br>        &quot;name&quot;: &quot;US-West&quot;<br>    }<br>]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZTqs_6myPfapemiT_4Tcg.png" /></figure><ul><li>Create an ADP variable called <em>regionListADP. S</em>elect Bind Data to Variable and set to <em>regionList</em>. Set Item Type to <em>customType </em>and Key Attributes to <em>region.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qgV0qAjVqg-MjMqdVRns6w.png" /></figure><ul><li>Now we can use our ADP by adding the following HTML:</li></ul><pre>&lt;div class=&quot;oj-flex&quot;&gt;<br> &lt;oj-select-single label-hint=&quot;Region&quot; class=&quot;oj-flex-item oj-sm-12  oj-md-4 oj-form-control-max-width-md&quot;<br>data=&quot;[[ $variables.regionListADP ]]&quot; item-text=&quot;name&quot;&gt;<br> &lt;/oj-select-single&gt;<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8pQlfJBau1uJZkN9_2ITcg.png" /></figure><ul><li>Run the application</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQ_M-hHvJvj0Lj57QWPZ7g.png" /></figure><h3>ADP — Static Data (JS Function)</h3><p>Create an ADP using JS function and load static data.</p><ul><li>Create a variable of type Any called <em>regionListADP.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAk4t2511yRFKs8oMsXoEA.png" /></figure><ul><li>Add the following JS:</li></ul><pre>define([&quot;ojs/ojarraydataprovider&quot;], function(ArrayDataProvider) {<br>&#39;use strict&#39;;</pre><pre> var dataArray = [<br>  {&quot;region&quot;: &quot;us-east&quot;, &quot;name&quot;: &quot;US-East&quot;},<br>  {&quot;region&quot;: &quot;us-central&quot;, &quot;name&quot;: &quot;US-Central&quot;},<br>  {&quot;region&quot;: &quot;us-west&quot;, &quot;name&quot;: &quot;US-West&quot;}<br> ];</pre><pre> var PageModule = function PageModule() {};</pre><pre> PageModule.prototype.createADP = function() {<br>  return new ArrayDataProvider(<br>    dataArray, { keyAttributes:  &quot;region&quot; });<br> };</pre><pre> return PageModule;</pre><pre>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*NPtFR5egX1aPCvD5IFmthQ.png" /></figure><ul><li>Create an action chain called <em>loadRegionsActionChain</em> to populate data for <em>regionListADP.</em></li><li>Call JS function <em>createADP</em> and set the return type to Any.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hhtNHNPZ0dQZD9e-OlB6MA.png" /></figure><ul><li>Assign the JS function result to <em>regionListADP.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Mn3gHU4SGqP1GvB2PAmXg.png" /></figure><ul><li>Create an event listener of type vbEnter which calls the action chain created above <em>loadRegionsActionChain. </em>This will populate the ADP with data when page has been initialized.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-P13jAZSkhIvPAgckLDkxg.png" /></figure><ul><li>Now we can use our ADP by adding the following HTML:</li></ul><pre>&lt;div class=&quot;oj-flex&quot;&gt;<br> &lt;oj-select-single label-hint=&quot;Region&quot; class=&quot;oj-flex-item oj-sm-12  oj-md-4 oj-form-control-max-width-md&quot;<br>data=&quot;[[ $variables.regionListADP ]]&quot; item-text=&quot;name&quot;&gt;<br> &lt;/oj-select-single&gt;<br>&lt;/div&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8pQlfJBau1uJZkN9_2ITcg.png" /></figure><ul><li>Run the application</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQ_M-hHvJvj0Lj57QWPZ7g.png" /></figure><h3>References</h3><p><a href="https://docs.oracle.com/en/cloud/paas/integration-cloud/visual-developer/array-data-provider.html">Oracle Visual Builder — Array Data Provider</a></p><p><a href="https://www.oracle.com/webfolder/technetwork/jet/jsdocs/ArrayDataProvider.html">Oracle JET JS Docs — Array Data Provider</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30f7f23e68a8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/vb-array-data-provider-adp-30f7f23e68a8">VB: Array Data Provider (ADP)</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VB: Custom Events]]></title>
            <link>https://medium.com/oracle-jet/vb-custom-events-6df875fb4fef?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/6df875fb4fef</guid>
            <category><![CDATA[oracle-visual-builder]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[saas]]></category>
            <dc:creator><![CDATA[Steve Zebib]]></dc:creator>
            <pubDate>Sun, 18 Apr 2021 20:00:57 GMT</pubDate>
            <atom:updated>2021-04-18T20:01:26.126Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER: </em></strong><em>The views expressed in this story are my own and do not necessarily reflect the views of Oracle.</em></p><h3>Overview</h3><p>This article describes how to create and utilize custom events in Oracle Visual Builder. Custom events can be defined in a page, flow, or application and can be used in various ways such as:</p><ul><li>Trigger an action chain via custom event from another action chain or JS function</li><li>Navigate between flows in your application</li></ul><p>Pages → Flows → Application</p><ul><li>Pages can access custom events at page (self), flow, and application level.</li><li>Flows can access custom events at flow (self), and application level.</li><li>Application can access custom events at application (self) level.</li></ul><p>For this example, we will create a custom event at the page level that will be triggered from both an action chain and JS function.</p><h3>Setup</h3><p><strong>Custom Event</strong></p><ul><li>Create a custom event at the page level called <em>pageEvent with </em>a payload containing parameter<em> message </em>as show below<em>.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w3Iwu9csjGUEPMHKHikhKA.png" /></figure><ul><li>Create an action chain called <em>pageEventActionChain </em>with a variable message (string) as show below. This action chain will fire a notification to show the input message.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*USwJdjsgbX_P2riLHNaCyQ.png" /></figure><ul><li>Create an event listener for the event <em>pageEvent </em>that triggers the action chain <em>pageEventActionChain</em> as show below. Be sure to map the message parameter from custom event to the message parameter in action chain.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sMbYMRMTfvm30zaiA9rGZA.png" /></figure><p><strong>JS Function</strong></p><ul><li>Copy the following into JS file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*ADk0Q1QNsGrKIuWyVoWiHw.png" /></figure><pre>define([], function() {</pre><pre>&#39;use strict&#39;;</pre><pre>var eventHelper;</pre><pre>var PageModule = function PageModule(context) {</pre><pre>eventHelper = context.getEventHelper();</pre><pre>};</pre><pre>PageModule.prototype.triggerCustomEvent = function() {</pre><pre>// Do something here</pre><pre>// Trigger custom event</pre><pre>eventHelper.fireCustomEvent(&#39;pageEvent&#39;, {message: &quot;Page custom event triggered from JS Function.&quot;});</pre><pre>};</pre><pre>return PageModule;</pre><pre>});</pre><p><strong>Action Chains</strong></p><ul><li>Create an action chain called <em>triggerEventActionChain </em>that fires the <em>pageEvent. </em>Be sure to set pass value for <em>message</em> parameter.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rKm6oETRc5fmq6Prd2gaEg.png" /></figure><ul><li>Create an action chain called <em>triggerEventJSFunctionActionChain</em> that calls the JS function<em> triggerCustomEvent.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rxRFrOre0w1XIr696leE1Q.png" /></figure><p><strong>Action Chains</strong></p><ul><li>Add the following HTML with two buttons. One button will trigger the action chain <em>triggerEventActionChain </em>and the other button will trigger action chain <em>triggerEventJSFunctionActionChain.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfVOiWfYc0xY2eoQC08FZA.png" /></figure><pre>&lt;div class=&quot;oj-flex oj-sm-flex-direction-column oj-sm-align-items-flex-start&quot;&gt;</pre><pre>&lt;oj-button class=&quot;oj-button-lg&quot; on-oj-action=&quot;[[$listeners.ojButtonOjAction]]&quot;&gt;Page Custom Event (Action Chain)&lt;/oj-button&gt;</pre><pre>&lt;oj-button class=&quot;oj-button-lg&quot; on-oj-action=&quot;[[$listeners.ojButtonOjAction2]]&quot;&gt;Page Custom Event (JS Function)&lt;/oj-button&gt;</pre><pre>&lt;/div&gt;</pre><h3>Test</h3><ul><li>Run the application. Click on buttons and notifications should be displayed (triggered via custom event).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eTdeW2CEJSqaZeTX9RYm_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AzpJB7KJoluf6Gfxk9nmjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n-zmVkDR1RmBkPJfffYNsA.png" /></figure><h3>References</h3><p><a href="https://docs.oracle.com/en/cloud/paas/integration-cloud/visual-developer/custom-and-built-events.html">Oracle Visual Builder — Custom Events</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6df875fb4fef" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/vb-custom-events-6df875fb4fef">VB: Custom Events</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VB: Store and Download Files]]></title>
            <link>https://medium.com/oracle-jet/store-and-download-files-in-vbcs-7cc6d12857eb?source=rss----e91ffea63c1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/7cc6d12857eb</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[visual-builder]]></category>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-visual-builder]]></category>
            <dc:creator><![CDATA[Steve Zebib]]></dc:creator>
            <pubDate>Fri, 05 Feb 2021 00:21:31 GMT</pubDate>
            <atom:updated>2021-02-26T17:24:39.707Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER: </em></strong><em>The views expressed in this story are my own and do not necessarily reflect the views of Oracle.</em></p><h3>Overview</h3><p>This article describes how to store and download files from the <em>Resources</em> directory in Oracle Visual Builder.</p><h3>Setup</h3><p>NOTE: For this example, we will store a file called <em>Test.docx</em> in the <em>Resources</em> directory and then download it using a button.</p><p><strong>Resources</strong></p><ul><li>Right click on the <em>Resources</em> directory and click <em>Import </em>as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*XmnEmekzy61nbFzbRLC7Vw.png" /></figure><ul><li>Set the name of sub-directory (e.g. /resources/files) and then upload the file (e.g. Test.docx).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*yLVS_PVtR8fgiLMch-igSg.png" /></figure><ul><li>After importing, the file should be in the resources directory as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*Lz8NaNYc6-upMlynGpYcAQ.png" /></figure><p><strong>Action Chain</strong></p><ul><li>Create an action chain that opens the file URL. In this case, the URL is</li></ul><pre>[[ $application.path + &#39;resources/files/Test.docx&#39; ]]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rSjRCaSIfNXgX7lzmU2JVw.png" /></figure><p><strong>HTML</strong></p><ul><li>Create a button with an ojAction event that calls the above action chain.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M0HNRWphMv5yqHDXhM1FdA.png" /></figure><pre>&lt;div class=&quot;oj-flex&quot;&gt;<br>  &lt;div class=&quot;oj-flex-item oj-sm-12 oj-md-12&quot;&gt;<br>    &lt;oj-button on-oj-action=&quot;[[$listeners.ojButtonOjAction]]&quot;&gt;Download&lt;/oj-button&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><h3>Test</h3><ul><li>Run the application and click on the <em>Download</em> button. The file should be downloaded on your local computer as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vosMABwEO_z-ISjY5K47Tg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cc6d12857eb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-jet/store-and-download-files-in-vbcs-7cc6d12857eb">VB: Store and Download Files</a> was originally published in <a href="https://medium.com/oracle-jet">Oracle VB Studio and JET</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>