<?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[Stories by Tyler Kolota on Medium]]></title>
        <description><![CDATA[Stories by Tyler Kolota on Medium]]></description>
        <link>https://medium.com/@takolota?source=rss-36bd2c22c8d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*oAvJysKXk1I9sqnzMSfkew.jpeg</url>
            <title>Stories by Tyler Kolota on Medium</title>
            <link>https://medium.com/@takolota?source=rss-36bd2c22c8d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 21:41:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@takolota/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Left Join JSON Arrays (Power Automate & Office Scripts)]]></title>
            <link>https://medium.com/@takolota/left-join-json-arrays-power-automate-office-scripts-6f65f58a7eba?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f65f58a7eba</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[power-automate]]></category>
            <category><![CDATA[microsoft-power-platform]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[low-code]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 20:12:08 GMT</pubDate>
            <atom:updated>2026-03-18T20:12:08.636Z</atom:updated>
            <content:encoded><![CDATA[<p>Want to cut actions required to update a data-set in Power Automate by 2–3x?<br>Need to left join and/or merge two JSON arrays?<br>I’ve got an Office Script &amp; flow set-up for you.</p><p>This is building from a previous blog post about upserting two JSON arrays using an Azure Function (<a href="https://medium.com/@takolota/power-automate-upsert-json-array-dfa937d800be">https://medium.com/@takolota/power-automate-upsert-json-array-dfa937d800be</a>), but I thought a left join may be more helpful and an Office Script that avoids premium HTTP calls may interest a wider audience of users.</p><h4><strong>Basic Left Join JSON Arrays Example</strong></h4><p>Inputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*kJ4xCaM07OUtEw7n7MPvbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*rVyZ3it7TOpu_c-B3t4qJA.png" /></figure><p>Run Outputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*ABzwkm_y9t7VHewa9WigkA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*OlVoMF3ZrbKrqomwpHSgpw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*JThc4XKFgy5lwukUN_FupA.png" /></figure><h4><strong>Large Left Join JSON Arrays Example</strong></h4><p>Some of you may know that Office Scripts have a 2MB data input &amp; 2MB data output limit. This may limit the usefulness of the more basic set-up to smaller JSON arrays, but I have built an example that automatically makes less than 2MB chunks &amp; joins/updates each chunk in the script before recombining them for a final output. Although this introduces an Apply to Each loop, it is still much, much more efficient than iterating over one record at a time, because if your average record is like 300 characters, then each loop will automatically chunk &amp; process them in batches of 1500. So if you have a 12000 record JSON array then instead of 12000 loop runs &amp; 12000 action calls it will run 8 loops of 4 actions for a total of 32 action calls.</p><p>Inputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XIOWy83y967wGSnPkGP81Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-dMWqP-CnDlFYxk2lH-Bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vi7Q0ea0aV-ACOK2jpuAoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2oXbfr_O2gXOcQGr74H-YQ.png" /></figure><p>Run Outputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*6viE0H5e8siqQ1rDnqfwhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*ggNnpCE99B7tC02TGYr7Vw.png" /></figure><h4><strong>Get This Office Script &amp; Flow Examples</strong></h4><p>Office Script:</p><pre>/**<br> * Office Script: Left Join JSON Array<br> * Performs a left join of initial_json with update_json on a primary key.<br> * - All records from initial_json are preserved.<br> * - Matching records from update_json are merged in; unmatched get nulls.<br> * - Duplicate column names (excluding the primary key) are auto-renamed with _1, _2, etc.<br> * - One-to-many: multiple initial rows with the same key all get the update data.<br> * - Keys in update_json with no match in initial_json are discarded (left join).<br> * Strictly typed: No &#39;any&#39; keyword used.<br> */<br>function main(<br>    workbook: ExcelScript.Workbook,<br>    primary_key: string,<br>    initial_json: UpsertObject[],<br>    update_json: UpsertObject[]<br>): UpsertObject[] {<br><br>    if (!primary_key || !initial_json || !update_json) {<br>        return initial_json;<br>    }<br><br>    type FlexibleObject = Record&lt;string, string | number | boolean | null | undefined&gt;;<br><br>    const initialArr = initial_json as FlexibleObject[];<br>    const updateArr = update_json as FlexibleObject[];<br><br>    // 1. Collect all column names from initial_json (ordered, deduplicated)<br>    const initialColumns: string[] = [];<br>    initialArr.forEach(item =&gt; {<br>        Object.keys(item).forEach(key =&gt; {<br>            if (key !== &#39;DummyReferenceDoNotUse&#39; &amp;&amp; initialColumns.indexOf(key) === -1) {<br>                initialColumns.push(key);<br>            }<br>        });<br>    });<br><br>    // 2. Collect extra columns from update_json (those not in initial_json, excl. primary key)<br>    //    For columns that conflict with initial_json columns (other than the primary key),<br>    //    assign a deduplicated alias: colName_1, colName_2, etc.<br>    //<br>    //    updateColumnMap: original update key -&gt; alias used in output<br>    const updateColumnMap = new Map&lt;string, string&gt;();<br><br>    // Track all names already committed to the output schema to avoid collisions<br>    const usedNames = new Set&lt;string&gt;(initialColumns);<br><br>    updateArr.forEach(item =&gt; {<br>        Object.keys(item).forEach(key =&gt; {<br>            if (key === &#39;DummyReferenceDoNotUse&#39;) return;<br>            if (updateColumnMap.has(key)) return; // already mapped<br><br>            if (key === primary_key) {<br>                // Primary key is not duplicated — it comes from initial_json<br>                return;<br>            }<br><br>            if (!usedNames.has(key)) {<br>                // No conflict: use the name as-is<br>                updateColumnMap.set(key, key);<br>                usedNames.add(key);<br>            } else {<br>                // Conflict: find the next available _N suffix<br>                let suffix = 1;<br>                let candidate = `${key}_${suffix}`;<br>                while (usedNames.has(candidate)) {<br>                    suffix++;<br>                    candidate = `${key}_${suffix}`;<br>                }<br>                updateColumnMap.set(key, candidate);<br>                usedNames.add(candidate);<br>            }<br>        });<br>    });<br><br>    // 3. Build the ordered list of update-side columns to append (aliases, excl. primary key)<br>    const updateAliases: string[] = [];<br>    updateColumnMap.forEach((alias) =&gt; {<br>        updateAliases.push(alias);<br>    });<br><br>    // 4. Build update lookup map: primary key value -&gt; aliased FlexibleObject<br>    //    Values are stored under their output aliases.<br>    const updateMap = new Map&lt;string, FlexibleObject&gt;();<br>    updateArr.forEach(item =&gt; {<br>        const val = item[primary_key];<br>        if (val === undefined || val === null) return;<br><br>        const aliasedRecord: FlexibleObject = {};<br>        updateColumnMap.forEach((alias, originalKey) =&gt; {<br>            aliasedRecord[alias] = item.hasOwnProperty(originalKey) ? item[originalKey] : null;<br>        });<br><br>        updateMap.set(val.toString(), aliasedRecord);<br>    });<br><br>    // 5. Build a null-fill record for update columns (used when no match found)<br>    const nullUpdateRecord: FlexibleObject = {};<br>    updateAliases.forEach(alias =&gt; {<br>        nullUpdateRecord[alias] = null;<br>    });<br><br>    // 6. Left join: for each initial record, merge the matching update record (or nulls)<br>    const result = initialArr.map(record =&gt; {<br>        const keyValue = record[primary_key];<br>        const keyValueStr = keyValue !== undefined &amp;&amp; keyValue !== null ? keyValue.toString() : &quot;&quot;;<br><br>        const updateRecord = updateMap.has(keyValueStr)<br>            ? updateMap.get(keyValueStr)!<br>            : nullUpdateRecord;<br><br>        // Build output: start with all initial fields, then append update aliases<br>        const output: FlexibleObject = {};<br><br>        initialColumns.forEach(col =&gt; {<br>            output[col] = record.hasOwnProperty(col) ? record[col] : null;<br>        });<br><br>        updateAliases.forEach(alias =&gt; {<br>            output[alias] = updateRecord[alias] !== undefined ? updateRecord[alias] : null;<br>        });<br><br>        return output;<br>    });<br><br>    return result as UpsertObject[];<br>}<br><br>/**<br> * Interface for Power Automate compatibility.<br> * This ensures the &#39;Run script&#39; action shows array input fields.<br> */<br>interface UpsertObject {<br>    &#39;DummyReferenceDoNotUse&#39;?: string | undefined;<br>}</pre><p>Note with this Office Script if you need to re-insert a JSONarray / array dynamic content then you will want to make sure the right-side button is toggled to an array input instead of a single input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*iIUxOzZ13NxYnDYGknCXkA.png" /></figure><p>Classic Flow Designer Copy &amp; Paste:</p><p>(Basic Left Join)</p><pre>{&quot;id&quot;:&quot;9da0e3ba-47f5-45e5-adcf-cbdb3805d1f7&quot;,&quot;brandColor&quot;:&quot;#8C3900&quot;,&quot;connectionReferences&quot;:{&quot;shared_excelonlinebusiness&quot;:{&quot;connection&quot;:{&quot;id&quot;:&quot;/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness/connections/shared-excelonlinebu-edf5182a-4e6c-408f-9608-3549e9c0a372&quot;}}},&quot;connectorDisplayName&quot;:&quot;Control&quot;,&quot;icon&quot;:&quot;data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=&quot;,&quot;isTrigger&quot;:false,&quot;operationName&quot;:&quot;Basic_Left_Join_JSON_Arrays&quot;,&quot;operationDefinition&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;UpdateJSON&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:[{&quot;A&quot;:1,&quot;B&quot;:11,&quot;D&quot;:11,&quot;Str&quot;:&quot;one&quot;},{&quot;A&quot;:2,&quot;B&quot;:22,&quot;D&quot;:22,&quot;Str&quot;:&quot;two&quot;},{&quot;A&quot;:4,&quot;B&quot;:44,&quot;D&quot;:44,&quot;Str&quot;:&quot;four&quot;}],&quot;runAfter&quot;:{&quot;Select_InitialJSON_Keys&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;cdf6c15d-e183-4687-a965-1266a9bca1cf&quot;}},&quot;Run_script&quot;:{&quot;type&quot;:&quot;ApiConnection&quot;,&quot;inputs&quot;:{&quot;host&quot;:{&quot;connection&quot;:{&quot;name&quot;:&quot;@json(decodeBase64(triggerOutputs().headers[&#39;X-MS-APIM-Tokens&#39;]))[&#39;$connections&#39;][&#39;shared_excelonlinebusiness&#39;][&#39;connectionId&#39;]&quot;}},&quot;method&quot;:&quot;post&quot;,&quot;body&quot;:{&quot;primary_key&quot;:&quot;@{outputs(&#39;KeyColumnName&#39;)}&quot;,&quot;initial_json&quot;:&quot;@outputs(&#39;InitialJSON&#39;)&quot;,&quot;update_json&quot;:&quot;@outputs(&#39;UpdateJSON&#39;)&quot;},&quot;path&quot;:&quot;/officescripting/api/unattended/run/@{encodeURIComponent(&#39;b!y2rxipfTvUi7ALZMiyxLa89aQqkbMORMksjFtKI_dfKgJA8V37mjQICJm9mYgy-T&#39;)}/@{encodeURIComponent(encodeURIComponent(&#39;01JWBUU4FNIHX7QF2HB5BYHH4LWP7RNYZ6&#39;))}&quot;,&quot;queries&quot;:{&quot;source&quot;:&quot;me&quot;,&quot;scriptId&quot;:&quot;ms-officescript%3A%2F%2Fonedrive_business_itemlink%2F01JWBUU4FAYNPX5Z5CPVDZPGNDNOPSDJTC&quot;},&quot;authentication&quot;:{&quot;type&quot;:&quot;Raw&quot;,&quot;value&quot;:&quot;@json(decodeBase64(triggerOutputs().headers[&#39;X-MS-APIM-Tokens&#39;]))[&#39;$ConnectionKey&#39;]&quot;}},&quot;runAfter&quot;:{&quot;UpdateJSON&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;outputs(&#39;KeyColumnName&#39;) | outputs(&#39;InitialJSON&#39;) | outputs(&#39;UpdateJSON&#39;)&quot;,&quot;metadata&quot;:{&quot;01JWBUU4FNIHX7QF2HB5BYHH4LWP7RNYZ6&quot;:&quot;/PowerAutomateFiles/Workbook20241003032923.xlsx&quot;,&quot;operationMetadataId&quot;:&quot;da06d422-fd7c-4d46-889a-95ab3b93b01c&quot;,&quot;flowSystemMetadata&quot;:{&quot;swaggerOperationId&quot;:&quot;RunScriptProd&quot;}}},&quot;Select_Results_Updates&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Run_script&#39;)?[&#39;result&#39;]&quot;,&quot;select&quot;:{&quot;A&quot;:&quot;@item()?[&#39;A&#39;]&quot;,&quot;B&quot;:&quot;@item()?[&#39;B_1&#39;]&quot;,&quot;D&quot;:&quot;@item()?[&#39;D&#39;]&quot;,&quot;Str&quot;:&quot;@item()?[&#39;Str&#39;]&quot;}},&quot;runAfter&quot;:{&quot;Run_script&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;body(&#39;Run_script&#39;)?[&#39;result&#39;] | item()?[&#39;A&#39;] | item()?[&#39;B_1&#39;] | item()?[&#39;D&#39;] | item()?[&#39;Str&#39;]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;320b8620-6c41-425c-b085-8c4bcc7d06a7&quot;}},&quot;Select_InitialJSON_Keys&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;InitialJSON&#39;)&quot;,&quot;select&quot;:&quot;@item()?[outputs(&#39;KeyColumnName&#39;)]&quot;},&quot;runAfter&quot;:{&quot;InitialJSON&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;outputs(&#39;InitialJSON&#39;) | item()?[outputs(&#39;KeyColumnName&#39;)]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;fc0c3420-b00d-4aac-bee6-c0f51d94cf89&quot;}},&quot;Filter_array_Creates&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;UpdateJSON&#39;)&quot;,&quot;where&quot;:&quot;@not(contains(body(&#39;Select_InitialJSON_Keys&#39;), item()?[outputs(&#39;KeyColumnName&#39;)]))&quot;},&quot;runAfter&quot;:{&quot;Select_Results_Updates&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;outputs(&#39;UpdateJSON&#39;) | body(&#39;Select_InitialJSON_Keys&#39;) does not contain item()?[outputs(&#39;KeyColumnName&#39;)]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;fedfbc2f-3dfb-46b6-946b-29eb98b05391&quot;}},&quot;KeyColumnName&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;A&quot;,&quot;runAfter&quot;:{},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;93b17026-dd1c-4f3e-bae8-5d5e170434a3&quot;}},&quot;InitialJSON&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:[{&quot;A&quot;:1,&quot;B&quot;:0},{&quot;A&quot;:1,&quot;B&quot;:1},{&quot;A&quot;:2,&quot;B&quot;:2},{&quot;A&quot;:3,&quot;B&quot;:3}],&quot;runAfter&quot;:{&quot;KeyColumnName&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;39b380b8-87bf-48f0-b0ed-e5ce5714f96d&quot;}}},&quot;runAfter&quot;:{},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;fd091f54-293f-4a81-96e6-6b8524340eb9&quot;}}}</pre><p>(Large Left Join)</p><pre>{&quot;id&quot;:&quot;bc94949c-809f-4916-90a2-b250302f7661&quot;,&quot;brandColor&quot;:&quot;#8C3900&quot;,&quot;connectionReferences&quot;:{&quot;shared_excelonlinebusiness&quot;:{&quot;connection&quot;:{&quot;id&quot;:&quot;/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness/connections/shared-excelonlinebu-edf5182a-4e6c-408f-9608-3549e9c0a372&quot;}}},&quot;connectorDisplayName&quot;:&quot;Control&quot;,&quot;icon&quot;:&quot;data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=&quot;,&quot;isTrigger&quot;:false,&quot;operationName&quot;:&quot;Large_Left_Join_JSON_Arrays&quot;,&quot;operationDefinition&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;Apply_to_each&quot;:{&quot;type&quot;:&quot;Foreach&quot;,&quot;foreach&quot;:&quot;@chunk(outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;], div(900000, div(add(length(string(outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;])), length(string(outputs(&#39;Parameters&#39;)?[&#39;UpdateJSON&#39;]))), length(outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;]))))&quot;,&quot;actions&quot;:{&quot;Select_InitialJSON_Keys_3&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@items(&#39;Apply_to_each&#39;)&quot;,&quot;select&quot;:&quot;@item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]&quot;},&quot;runAfter&quot;:{},&quot;description&quot;:&quot;items(&#39;Apply_to_each&#39;) | item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;ce5417c5-a3d1-4704-947e-9015a5311451&quot;}},&quot;Filter_array_Update_JSON_With_Same_Keys&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;Parameters&#39;)?[&#39;UpdateJSON&#39;]&quot;,&quot;where&quot;:&quot;@contains(body(&#39;Select_InitialJSON_Keys_3&#39;), item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]])&quot;},&quot;runAfter&quot;:{&quot;Select_InitialJSON_Keys_3&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;outputs(&#39;Parameters&#39;)?[&#39;UpdateJSON&#39;] | body(&#39;Select_InitialJSON_Keys_3&#39;) | item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;7fcca60f-3460-4eb4-a81b-07597d47e2d3&quot;}},&quot;Run_script_2&quot;:{&quot;type&quot;:&quot;ApiConnection&quot;,&quot;inputs&quot;:{&quot;host&quot;:{&quot;connection&quot;:{&quot;name&quot;:&quot;@json(decodeBase64(triggerOutputs().headers[&#39;X-MS-APIM-Tokens&#39;]))[&#39;$connections&#39;][&#39;shared_excelonlinebusiness&#39;][&#39;connectionId&#39;]&quot;}},&quot;method&quot;:&quot;post&quot;,&quot;body&quot;:{&quot;primary_key&quot;:&quot;@{outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]}&quot;,&quot;initial_json&quot;:&quot;@items(&#39;Apply_to_each&#39;)&quot;,&quot;update_json&quot;:&quot;@body(&#39;Filter_array_Update_JSON_With_Same_Keys&#39;)&quot;},&quot;path&quot;:&quot;/officescripting/api/unattended/run/@{encodeURIComponent(&#39;b!y2rxipfTvUi7ALZMiyxLa89aQqkbMORMksjFtKI_dfKgJA8V37mjQICJm9mYgy-T&#39;)}/@{encodeURIComponent(encodeURIComponent(&#39;01JWBUU4FNIHX7QF2HB5BYHH4LWP7RNYZ6&#39;))}&quot;,&quot;queries&quot;:{&quot;source&quot;:&quot;me&quot;,&quot;scriptId&quot;:&quot;ms-officescript%3A%2F%2Fonedrive_business_itemlink%2F01JWBUU4FAYNPX5Z5CPVDZPGNDNOPSDJTC&quot;},&quot;authentication&quot;:{&quot;type&quot;:&quot;Raw&quot;,&quot;value&quot;:&quot;@json(decodeBase64(triggerOutputs().headers[&#39;X-MS-APIM-Tokens&#39;]))[&#39;$ConnectionKey&#39;]&quot;}},&quot;runAfter&quot;:{&quot;Filter_array_Update_JSON_With_Same_Keys&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;] | items(&#39;Apply_to_each&#39;) | body(&#39;Filter_array_Update_JSON_With_Same_Keys&#39;)&quot;,&quot;metadata&quot;:{&quot;01JWBUU4FNIHX7QF2HB5BYHH4LWP7RNYZ6&quot;:&quot;/PowerAutomateFiles/Workbook20241003032923.xlsx&quot;,&quot;operationMetadataId&quot;:&quot;26ea83c2-89e9-4ea1-b55a-8f60de1811e5&quot;,&quot;flowSystemMetadata&quot;:{&quot;swaggerOperationId&quot;:&quot;RunScriptProd&quot;}}},&quot;Result&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@body(&#39;Run_script_2&#39;)?[&#39;result&#39;]&quot;,&quot;runAfter&quot;:{&quot;Run_script_2&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;body(&#39;Run_script_2&#39;)?[&#39;result&#39;]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;6f7ed668-7499-402b-8f91-8d5e766510f5&quot;}}},&quot;runAfter&quot;:{&quot;Select_InitialJSON_Keys_2&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;2MB limit, about 1,000,000 characters, minus 100,000 buffer&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;77244769-b71a-4c18-9409-68c2a301d159&quot;}},&quot;Parameters&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:{&quot;KeyColumnName&quot;:&quot;A&quot;,&quot;InitialJSON&quot;:[{&quot;A&quot;:1,&quot;B&quot;:0},{&quot;A&quot;:1,&quot;B&quot;:1},{&quot;A&quot;:2,&quot;B&quot;:2},{&quot;A&quot;:3,&quot;B&quot;:3}],&quot;UpdateJSON&quot;:[{&quot;A&quot;:1,&quot;B&quot;:11,&quot;D&quot;:11,&quot;Str&quot;:&quot;one&quot;},{&quot;A&quot;:2,&quot;B&quot;:22,&quot;D&quot;:22,&quot;Str&quot;:&quot;two&quot;},{&quot;A&quot;:4,&quot;B&quot;:44,&quot;D&quot;:44,&quot;Str&quot;:&quot;four&quot;}]},&quot;runAfter&quot;:{},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;95e09536-90eb-4d4e-ad04-9cf1bbf5a375&quot;}},&quot;Select_InitialJSON_Keys_2&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;]&quot;,&quot;select&quot;:&quot;@item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]&quot;},&quot;runAfter&quot;:{&quot;Parameters&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;] | item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;ce5417c5-a3d1-4704-947e-9015a5311451&quot;}},&quot;Filter_array_All_Creates&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;Parameters&#39;)?[&#39;UpdateJSON&#39;]&quot;,&quot;where&quot;:&quot;@not(contains(body(&#39;Select_InitialJSON_Keys_2&#39;), item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]))&quot;},&quot;runAfter&quot;:{&quot;Select_All_Updates&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;outputs(&#39;Parameters&#39;)?[&#39;UpdateJSON&#39;] | body(&#39;Select_InitialJSON_Keys_2&#39;) does not contain item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;7c6f28d1-beff-41aa-85eb-d49af41de842&quot;}},&quot;Select_All_Updates&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@json(replace(replace(replace(string(outputs(&#39;Result&#39;)), &#39;}],[{&#39;, &#39;},{&#39;), &#39;[[{&#39;, &#39;[{&#39;), &#39;}]]&#39;, &#39;}]&#39;))&quot;,&quot;select&quot;:{&quot;A&quot;:&quot;@item()?[&#39;A&#39;]&quot;,&quot;B&quot;:&quot;@item()?[&#39;B_1&#39;]&quot;,&quot;D&quot;:&quot;@item()?[&#39;D&#39;]&quot;,&quot;Str&quot;:&quot;@item()?[&#39;Str&#39;]&quot;}},&quot;runAfter&quot;:{&quot;Apply_to_each&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;json(replace(replace(replace(string(outputs(&#39;Result&#39;)), &#39;}],[{&#39;, &#39;},{&#39;), &#39;[[{&#39;, &#39;[{&#39;), &#39;}]]&#39;, &#39;}]&#39;)) | item()?[&#39;A&#39;] | item()?[&#39;B_1&#39;] | item()?[&#39;D&#39;] | item()?[&#39;Str&#39;]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;5c9ff0f1-853b-49b4-b4de-8a843446a4d3&quot;}}},&quot;runAfter&quot;:{&quot;Basic_Left_Join_JSON_Arrays&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;fd091f54-293f-4a81-96e6-6b8524340eb9&quot;}}}</pre><p>New Flow Designer Copy &amp; Paste:</p><p>(Basic Left Join)</p><pre>{&quot;nodeId&quot;:&quot;Basic_Left_Join_JSON_Arrays&quot;,&quot;serializedValue&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;KeyColumnName&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;A&quot;},&quot;InitialJSON&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:[{&quot;A&quot;:1,&quot;B&quot;:0},{&quot;A&quot;:1,&quot;B&quot;:1},{&quot;A&quot;:2,&quot;B&quot;:2},{&quot;A&quot;:3,&quot;B&quot;:3}],&quot;runAfter&quot;:{&quot;KeyColumnName&quot;:[&quot;Succeeded&quot;]}},&quot;UpdateJSON&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:[{&quot;A&quot;:1,&quot;B&quot;:11,&quot;D&quot;:11,&quot;Str&quot;:&quot;one&quot;},{&quot;A&quot;:2,&quot;B&quot;:22,&quot;D&quot;:22,&quot;Str&quot;:&quot;two&quot;},{&quot;A&quot;:4,&quot;B&quot;:44,&quot;D&quot;:44,&quot;Str&quot;:&quot;four&quot;}],&quot;runAfter&quot;:{&quot;Select_InitialJSON_Keys&quot;:[&quot;Succeeded&quot;]}},&quot;Select_InitialJSON_Keys&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;InitialJSON&#39;)&quot;,&quot;select&quot;:&quot;@item()?[outputs(&#39;KeyColumnName&#39;)]&quot;},&quot;runAfter&quot;:{&quot;InitialJSON&quot;:[&quot;Succeeded&quot;]}},&quot;Run_script&quot;:{&quot;type&quot;:&quot;OpenApiConnection&quot;,&quot;inputs&quot;:{&quot;parameters&quot;:{&quot;source&quot;:&quot;me&quot;,&quot;drive&quot;:&quot;b!y2rxipfTvUi7ALZMiyxLa89aQqkbMORMksjFtKI_dfKgJA8V37mjQICJm9mYgy-T&quot;,&quot;file&quot;:&quot;01JWBUU4FNIHX7QF2HB5BYHH4LWP7RNYZ6&quot;,&quot;scriptId&quot;:&quot;ms-officescript%3A%2F%2Fonedrive_business_itemlink%2F01JWBUU4FAYNPX5Z5CPVDZPGNDNOPSDJTC&quot;,&quot;ScriptParameters/primary_key&quot;:&quot;@outputs(&#39;KeyColumnName&#39;)&quot;,&quot;ScriptParameters/initial_json&quot;:&quot;@outputs(&#39;InitialJSON&#39;)&quot;,&quot;ScriptParameters/update_json&quot;:&quot;@outputs(&#39;UpdateJSON&#39;)&quot;},&quot;host&quot;:{&quot;apiId&quot;:&quot;/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness&quot;,&quot;connection&quot;:&quot;shared_excelonlinebusiness&quot;,&quot;operationId&quot;:&quot;RunScriptProd&quot;}},&quot;runAfter&quot;:{&quot;UpdateJSON&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;01JWBUU4FNIHX7QF2HB5BYHH4LWP7RNYZ6&quot;:&quot;/PowerAutomateFiles/Workbook20241003032923.xlsx&quot;,&quot;tableId&quot;:null}},&quot;Select_Results_Updates&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;Run_script&#39;)?[&#39;body/result&#39;]&quot;,&quot;select&quot;:{&quot;A&quot;:&quot;@item()?[&#39;A&#39;]&quot;,&quot;B&quot;:&quot;@item()?[&#39;B_1&#39;]&quot;,&quot;D&quot;:&quot;@item()?[&#39;D&#39;]&quot;,&quot;Str&quot;:&quot;@item()?[&#39;Str&#39;]&quot;}},&quot;runAfter&quot;:{&quot;Run_script&quot;:[&quot;Succeeded&quot;]}},&quot;Filter_array_Creates&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;UpdateJSON&#39;)&quot;,&quot;where&quot;:&quot;@not(contains(body(&#39;Select_InitialJSON_Keys&#39;),item()?[outputs(&#39;KeyColumnName&#39;)]))&quot;},&quot;runAfter&quot;:{&quot;Select_Results_Updates&quot;:[&quot;Succeeded&quot;]}}},&quot;runAfter&quot;:{}},&quot;allConnectionData&quot;:{&quot;Run_script&quot;:{&quot;connectionReference&quot;:{&quot;api&quot;:{&quot;id&quot;:&quot;/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness&quot;},&quot;connection&quot;:{&quot;id&quot;:&quot;/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness/connections/shared-excelonlinebu-edf5182a-4e6c-408f-9608-3549e9c0a372&quot;},&quot;connectionName&quot;:&quot;shared-excelonlinebu-edf5182a-4e6c-408f-9608-3549e9c0a372&quot;},&quot;referenceKey&quot;:&quot;shared_excelonlinebusiness&quot;}},&quot;staticResults&quot;:{},&quot;isScopeNode&quot;:true,&quot;mslaNode&quot;:true}</pre><p>(Large Left Join)</p><pre>{&quot;nodeId&quot;:&quot;Large_Left_Join_JSON_Arrays&quot;,&quot;serializedValue&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;Parameters&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:{&quot;KeyColumnName&quot;:&quot;A&quot;,&quot;InitialJSON&quot;:[{&quot;A&quot;:1,&quot;B&quot;:0},{&quot;A&quot;:1,&quot;B&quot;:1},{&quot;A&quot;:2,&quot;B&quot;:2},{&quot;A&quot;:3,&quot;B&quot;:3}],&quot;UpdateJSON&quot;:[{&quot;A&quot;:1,&quot;B&quot;:11,&quot;D&quot;:11,&quot;Str&quot;:&quot;one&quot;},{&quot;A&quot;:2,&quot;B&quot;:22,&quot;D&quot;:22,&quot;Str&quot;:&quot;two&quot;},{&quot;A&quot;:4,&quot;B&quot;:44,&quot;D&quot;:44,&quot;Str&quot;:&quot;four&quot;}]}},&quot;Select_InitialJSON_Keys_2&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;]&quot;,&quot;select&quot;:&quot;@item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]&quot;},&quot;runAfter&quot;:{&quot;Parameters&quot;:[&quot;Succeeded&quot;]}},&quot;Apply_to_each&quot;:{&quot;type&quot;:&quot;Foreach&quot;,&quot;description&quot;:&quot;2MB limit, about 1,000,000 characters, minus 100,000 buffer&quot;,&quot;foreach&quot;:&quot;@chunk(outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;], div(900000, div(add(length(string(outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;])), length(string(outputs(&#39;Parameters&#39;)?[&#39;UpdateJSON&#39;]))), length(outputs(&#39;Parameters&#39;)?[&#39;InitialJSON&#39;]))))&quot;,&quot;actions&quot;:{&quot;Select_InitialJSON_Keys_3&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@items(&#39;Apply_to_each&#39;)&quot;,&quot;select&quot;:&quot;@item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]]&quot;}},&quot;Filter_array_Update_JSON_With_Same_Keys&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;Parameters&#39;)?[&#39;UpdateJSON&#39;]&quot;,&quot;where&quot;:&quot;@equals(body(&#39;Select_InitialJSON_Keys_3&#39;),item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]])&quot;},&quot;runAfter&quot;:{&quot;Select_InitialJSON_Keys_3&quot;:[&quot;Succeeded&quot;]}},&quot;Run_script_2&quot;:{&quot;type&quot;:&quot;OpenApiConnection&quot;,&quot;inputs&quot;:{&quot;parameters&quot;:{&quot;source&quot;:&quot;me&quot;,&quot;drive&quot;:&quot;b!y2rxipfTvUi7ALZMiyxLa89aQqkbMORMksjFtKI_dfKgJA8V37mjQICJm9mYgy-T&quot;,&quot;file&quot;:&quot;01JWBUU4FNIHX7QF2HB5BYHH4LWP7RNYZ6&quot;,&quot;scriptId&quot;:&quot;ms-officescript%3A%2F%2Fonedrive_business_itemlink%2F01JWBUU4FAYNPX5Z5CPVDZPGNDNOPSDJTC&quot;,&quot;ScriptParameters/primary_key&quot;:&quot;@outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]&quot;,&quot;ScriptParameters/initial_json&quot;:&quot;@items(&#39;Apply_to_each&#39;)&quot;,&quot;ScriptParameters/update_json&quot;:&quot;@body(&#39;Filter_array_Update_JSON_With_Same_Keys&#39;)&quot;},&quot;host&quot;:{&quot;apiId&quot;:&quot;/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness&quot;,&quot;connection&quot;:&quot;shared_excelonlinebusiness&quot;,&quot;operationId&quot;:&quot;RunScriptProd&quot;}},&quot;runAfter&quot;:{&quot;Filter_array_Update_JSON_With_Same_Keys&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;01JWBUU4FNIHX7QF2HB5BYHH4LWP7RNYZ6&quot;:&quot;/PowerAutomateFiles/Workbook20241003032923.xlsx&quot;,&quot;tableId&quot;:null}},&quot;Result&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@outputs(&#39;Run_script_2&#39;)?[&#39;body/result&#39;]&quot;,&quot;runAfter&quot;:{&quot;Run_script_2&quot;:[&quot;Succeeded&quot;]}}},&quot;runAfter&quot;:{&quot;Select_InitialJSON_Keys_2&quot;:[&quot;Succeeded&quot;]}},&quot;Select_All_Updates&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@json(replace(replace(replace(string(outputs(&#39;Result&#39;)), &#39;}],[{&#39;, &#39;},{&#39;), &#39;[[{&#39;, &#39;[{&#39;), &#39;}]]&#39;, &#39;}]&#39;))&quot;,&quot;select&quot;:{&quot;A&quot;:&quot;@item()?[&#39;A&#39;]&quot;,&quot;B&quot;:&quot;@item()?[&#39;B_1&#39;]&quot;,&quot;D&quot;:&quot;@item()?[&#39;D&#39;]&quot;,&quot;Str&quot;:&quot;@item()?[&#39;Str&#39;]&quot;}},&quot;runAfter&quot;:{&quot;Apply_to_each&quot;:[&quot;Succeeded&quot;]}},&quot;Filter_array_All_Creates&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@outputs(&#39;Parameters&#39;)?[&#39;UpdateJSON&#39;]&quot;,&quot;where&quot;:&quot;@equals(body(&#39;Select_InitialJSON_Keys_2&#39;),item()?[outputs(&#39;Parameters&#39;)?[&#39;KeyColumnName&#39;]])&quot;},&quot;runAfter&quot;:{&quot;Select_All_Updates&quot;:[&quot;Succeeded&quot;]}}},&quot;runAfter&quot;:{&quot;Basic_Left_Join_JSON_Arrays&quot;:[&quot;Succeeded&quot;]}},&quot;allConnectionData&quot;:{},&quot;staticResults&quot;:{},&quot;isScopeNode&quot;:true,&quot;mslaNode&quot;:true}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f65f58a7eba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Replace Many Dynamic Text Values Fast (Power Automate)]]></title>
            <link>https://medium.com/@takolota/replace-many-dynamic-text-values-fast-power-automate-5e6d8ac00a41?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e6d8ac00a41</guid>
            <category><![CDATA[powerplatform]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[power-automate]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Sat, 08 Nov 2025 22:37:51 GMT</pubDate>
            <atom:updated>2025-11-09T05:18:28.823Z</atom:updated>
            <content:encoded><![CDATA[<p>If you ever had a table of a few dozen or more strings of text you want to replace across one or many files/pieces-of-text then you may have either tediously specified a replace( ) expression for every old-text &amp; new-text value or you may have used a slower apply to each with variable loop to replace values one by one. Here I will share the most efficient way to set up the dynamic apply to each with variable loop and I will also share an optional template that avoids the variable loop entirely in case anyone wants to use it to concurrently process many files/pieces-of-text 10x to 50x faster in an outer loop.<br>These are things I found when needing to edit thousands of HTML files on SharePoint in bulk. So think of 2000+ HTML files going from something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Emmf8Bfm0TczvgsghSYUsw.png" /></figure><p>To something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kJ62D910IrcwbX6cqRm8sw.png" /></figure><h3>Standard Dynamic Text Replace Method</h3><p>First, the variable loop method. For this, you may get your data-source that lists the old text in one column &amp; new text in another column. Also note I have entered my initial text I want to edit in the value input of the Set variable Initial TextToEdit action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*y_-xIWoMIrbV3r-wXWcMgg.png" /></figure><p>This starting point is where you will want to minimize the amount of work happening in your apply to each loop. Instead of doing a loop run for each record of OldText &amp; NewText, you should first filter your records to only the records where the text we want to edit contains the OldText string. If you have like 100+ values to replace, this drastically cuts down on the actions &amp; time used. So we use the Filter array action to do that pre-filtering &amp; following the filter is the apply to each loop that will run over all our filtered values. Note in the loop we have to use a Compose action because a variable value input can not reference itself. In the Compose we do a simple replace expression on our TextToEdit variable with the current record’s OldText &amp; current record’s NewText &amp; we save the string with any newly replaced text back to the variable in the Set variable action. At the end we can get the edited text with all the replacements by calling on the variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*FP8FlekalSSoE728WWi0ZA.png" /></figure><p>Note how if you had many pieces of text, HTML files, or anything similar that you needed to loop over to replace text in then the fact this is changing values in a variable action means you can’t run the outer loop of files or inner loop of replacements concurrently, it has to do the loops one instance at a time so the variable doesn’t have multiple edits of multiple different texts writting to it at the same time.</p><p><strong>Copying the standard flow…</strong></p><p>(Remember to add your own TextToEdit string variable at the top)</p><p>Old designer scope action text to cntrl+c &amp; cntrl+v paste into the My clipboard tab of a new action menu:</p><pre>{&quot;id&quot;:&quot;ab4d4f98-5b27-4be9-9ade-c92a1a28d97e&quot;,&quot;brandColor&quot;:&quot;#8C3900&quot;,&quot;connectionReferences&quot;:{},&quot;connectorDisplayName&quot;:&quot;Control&quot;,&quot;icon&quot;:&quot;data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=&quot;,&quot;isTrigger&quot;:false,&quot;operationName&quot;:&quot;Replace_Many_Dynamic_Text_Values&quot;,&quot;operationDefinition&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;Select_MapData&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0, 501)&quot;,&quot;select&quot;:{&quot;OldText&quot;:&quot;https://www.OldLink@{item()}.com&quot;,&quot;NewText&quot;:&quot;https://www.NewLink@{item()}.com&quot;}},&quot;runAfter&quot;:{},&quot;description&quot;:&quot;Generate sample data &amp; standard column names&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;34c44289-2b92-4760-a638-e672767dbe6c&quot;}},&quot;Set_variable_Initial_TextToEdit&quot;:{&quot;type&quot;:&quot;SetVariable&quot;,&quot;inputs&quot;:{&quot;name&quot;:&quot;TextToEdit&quot;,&quot;value&quot;:&quot;&lt;!DOCTYPE html&gt;\n&lt;html lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n    &lt;meta charset=\&quot;UTF-8\&quot;&gt;\n    &lt;meta name=\&quot;viewport\&quot; content=\&quot;width=device-width, initial-scale=1.0\&quot;&gt;\n    &lt;title&gt;Employee Manual - Quick Links&lt;/title&gt;\n    &lt;style&gt;\n        body {\n            font-family: &#39;Segoe UI&#39;, Tahoma, Geneva, Verdana, sans-serif;\n            margin: 40px;\n            background-color: #f4f7f9;\n            color: #333;\n        }\n        .container {\n            max-width: 800px;\n            margin: auto;\n            background-color: #fff;\n            padding: 30px;\n            border-radius: 8px;\n            box-shadow: 0 4px 8px rgba(0,0,0,0.1);\n        }\n        h1 {\n            color: #0056b3;\n            border-bottom: 2px solid #0056b3;\n            padding-bottom: 10px;\n            margin-bottom: 20px;\n        }\n        ul {\n            list-style-type: none;\n            padding: 0;\n        }\n        li {\n            margin-bottom: 12px;\n            padding: 8px;\n            background-color: #e9ecef;\n            border-radius: 4px;\n        }\n        a {\n            color: #007bff; /* Standard link color */\n            text-decoration: none;\n            font-family: monospace; /* Monospaced font helps display URLs clearly */\n            font-size: 1.1em;\n        }\n        a:hover {\n            color: #004085;\n            text-decoration: underline;\n        }\n    &lt;/style&gt;\n&lt;/head&gt;\n&lt;body&gt;\n\n    &lt;div class=\&quot;container\&quot;&gt;\n        &lt;h1&gt;Employee Manual &amp; Resources&lt;/h1&gt;\n        &lt;p&gt;This page provides quick links to important policies, forms, and external resources. Please click on the link text (which is the file path or URL) to access the document.&lt;/p&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;📎 Internal Policy Documents (Local Files)&lt;/h2&gt;\n        &lt;p&gt;These links point to other HTML or PDF files within the company&#39;s internal network.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink5.com\&quot;&gt;https://www.OldLink5.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink444.com\&quot;&gt;https://www.OldLink444.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink255.com\&quot;&gt;https://www.OldLink255.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink101.com\&quot;&gt;https://www.OldLink101.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;🌐 External Resources (Websites)&lt;/h2&gt;\n        &lt;p&gt;These links take you to external websites for payroll, training, or compliance information.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink498.com\&quot;&gt;https://www.OldLink498.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink404.com\&quot;&gt;https://www.OldLink404.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink221.com\&quot;&gt;https://www.OldLink221.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n    &lt;/div&gt;\n\n&lt;/body&gt;\n&lt;/html&gt;&quot;},&quot;runAfter&quot;:{&quot;Select_MapData&quot;:[&quot;Succeeded&quot;]}},&quot;Filter_array&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_MapData&#39;)&quot;,&quot;where&quot;:&quot;@contains(variables(&#39;TextToEdit&#39;), item()?[&#39;OldText&#39;])&quot;},&quot;runAfter&quot;:{&quot;Set_variable_Initial_TextToEdit&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;From: body(&#39;Select_MapData&#39;) | variables(&#39;TextToEdit&#39;) contains item()?[&#39;OldText&#39;]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;cbd3a8a9-cf7a-4d77-a206-068ec6ae1a97&quot;}},&quot;Apply_to_each&quot;:{&quot;type&quot;:&quot;Foreach&quot;,&quot;foreach&quot;:&quot;@body(&#39;Filter_array&#39;)&quot;,&quot;actions&quot;:{&quot;ReplacedText&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@replace(variables(&#39;TextToEdit&#39;), items(&#39;Apply_to_each&#39;)?[&#39;OldText&#39;], items(&#39;Apply_to_each&#39;)?[&#39;NewText&#39;])&quot;,&quot;runAfter&quot;:{},&quot;description&quot;:&quot;replace(variables(&#39;TextToEdit&#39;), items(&#39;Apply_to_each&#39;)?[&#39;OldText&#39;], items(&#39;Apply_to_each&#39;)?[&#39;NewText&#39;])&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;0d6b83ae-607c-4f94-85e3-b8068a0ee915&quot;}},&quot;Set_variable_TextToEdit&quot;:{&quot;type&quot;:&quot;SetVariable&quot;,&quot;inputs&quot;:{&quot;name&quot;:&quot;TextToEdit&quot;,&quot;value&quot;:&quot;@{outputs(&#39;ReplacedText&#39;)}&quot;},&quot;runAfter&quot;:{&quot;ReplacedText&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;outputs(&#39;ReplacedText&#39;)&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;8298579d-8f06-4197-91a8-c2445281df1c&quot;}}},&quot;runAfter&quot;:{&quot;Filter_array&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;body(&#39;Filter_array&#39;)&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;1574df35-6d6b-43b8-ae9c-45d65c1e4a17&quot;}},&quot;EditedText&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@variables(&#39;TextToEdit&#39;)&quot;,&quot;runAfter&quot;:{&quot;Apply_to_each&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;d7e1ac8c-d7d1-41b8-920a-b479e093dc3b&quot;}}},&quot;runAfter&quot;:{&quot;Initialize_variable_TextToEdit&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;4fb89004-c6e5-45c5-a10b-c7c6ea5cdf73&quot;}}}</pre><p>New designer scope action to cntrl+c copy &amp; right-click ‘Paste an action’ on a new action button:</p><pre>{&quot;nodeId&quot;:&quot;Replace_Many_Dynamic_Text_Values&quot;,&quot;serializedValue&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;Select_MapData&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;description&quot;:&quot;Generate sample data &amp; standard column names&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0, 501)&quot;,&quot;select&quot;:{&quot;OldText&quot;:&quot;https://www.OldLink@{item()}.com&quot;,&quot;NewText&quot;:&quot;https://www.NewLink@{item()}.com&quot;}},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;34c44289-2b92-4760-a638-e672767dbe6c&quot;}},&quot;Set_variable_Initial_TextToEdit&quot;:{&quot;type&quot;:&quot;SetVariable&quot;,&quot;inputs&quot;:{&quot;name&quot;:&quot;TextToEdit&quot;,&quot;value&quot;:&quot;&lt;!DOCTYPE html&gt;\n&lt;html lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n    &lt;meta charset=\&quot;UTF-8\&quot;&gt;\n    &lt;meta name=\&quot;viewport\&quot; content=\&quot;width=device-width, initial-scale=1.0\&quot;&gt;\n    &lt;title&gt;Employee Manual - Quick Links&lt;/title&gt;\n    &lt;style&gt;\n        body {\n            font-family: &#39;Segoe UI&#39;, Tahoma, Geneva, Verdana, sans-serif;\n            margin: 40px;\n            background-color: #f4f7f9;\n            color: #333;\n        }\n        .container {\n            max-width: 800px;\n            margin: auto;\n            background-color: #fff;\n            padding: 30px;\n            border-radius: 8px;\n            box-shadow: 0 4px 8px rgba(0,0,0,0.1);\n        }\n        h1 {\n            color: #0056b3;\n            border-bottom: 2px solid #0056b3;\n            padding-bottom: 10px;\n            margin-bottom: 20px;\n        }\n        ul {\n            list-style-type: none;\n            padding: 0;\n        }\n        li {\n            margin-bottom: 12px;\n            padding: 8px;\n            background-color: #e9ecef;\n            border-radius: 4px;\n        }\n        a {\n            color: #007bff; /* Standard link color */\n            text-decoration: none;\n            font-family: monospace; /* Monospaced font helps display URLs clearly */\n            font-size: 1.1em;\n        }\n        a:hover {\n            color: #004085;\n            text-decoration: underline;\n        }\n    &lt;/style&gt;\n&lt;/head&gt;\n&lt;body&gt;\n\n    &lt;div class=\&quot;container\&quot;&gt;\n        &lt;h1&gt;Employee Manual &amp; Resources&lt;/h1&gt;\n        &lt;p&gt;This page provides quick links to important policies, forms, and external resources. Please click on the link text (which is the file path or URL) to access the document.&lt;/p&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;📎 Internal Policy Documents (Local Files)&lt;/h2&gt;\n        &lt;p&gt;These links point to other HTML or PDF files within the company&#39;s internal network.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink5.com\&quot;&gt;https://www.OldLink5.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink444.com\&quot;&gt;https://www.OldLink444.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink255.com\&quot;&gt;https://www.OldLink255.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink101.com\&quot;&gt;https://www.OldLink101.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;🌐 External Resources (Websites)&lt;/h2&gt;\n        &lt;p&gt;These links take you to external websites for payroll, training, or compliance information.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink498.com\&quot;&gt;https://www.OldLink498.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink404.com\&quot;&gt;https://www.OldLink404.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink221.com\&quot;&gt;https://www.OldLink221.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n    &lt;/div&gt;\n\n&lt;/body&gt;\n&lt;/html&gt;&quot;},&quot;runAfter&quot;:{&quot;Select_MapData&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;9fcac367-51a8-4e4c-8bef-b7f5fd5aac19&quot;}},&quot;Filter_array&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;description&quot;:&quot;From: body(&#39;Select_MapData&#39;) | variables(&#39;TextToEdit&#39;) contains item()?[&#39;OldText&#39;]&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_MapData&#39;)&quot;,&quot;where&quot;:&quot;@contains(variables(&#39;TextToEdit&#39;), item()?[&#39;OldText&#39;])&quot;},&quot;runAfter&quot;:{&quot;Set_variable_Initial_TextToEdit&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;cbd3a8a9-cf7a-4d77-a206-068ec6ae1a97&quot;}},&quot;Apply_to_each&quot;:{&quot;type&quot;:&quot;Foreach&quot;,&quot;description&quot;:&quot;body(&#39;Filter_array&#39;)&quot;,&quot;foreach&quot;:&quot;@body(&#39;Filter_array&#39;)&quot;,&quot;actions&quot;:{&quot;ReplacedText&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;description&quot;:&quot;replace(variables(&#39;TextToEdit&#39;), items(&#39;Apply_to_each&#39;)?[&#39;OldText&#39;], items(&#39;Apply_to_each&#39;)?[&#39;NewText&#39;])&quot;,&quot;inputs&quot;:&quot;@replace(variables(&#39;TextToEdit&#39;), items(&#39;Apply_to_each&#39;)?[&#39;OldText&#39;], items(&#39;Apply_to_each&#39;)?[&#39;NewText&#39;])&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;0d6b83ae-607c-4f94-85e3-b8068a0ee915&quot;}},&quot;Set_variable_TextToEdit&quot;:{&quot;type&quot;:&quot;SetVariable&quot;,&quot;description&quot;:&quot;outputs(&#39;ReplacedText&#39;)&quot;,&quot;inputs&quot;:{&quot;name&quot;:&quot;TextToEdit&quot;,&quot;value&quot;:&quot;@{outputs(&#39;ReplacedText&#39;)}&quot;},&quot;runAfter&quot;:{&quot;ReplacedText&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;8298579d-8f06-4197-91a8-c2445281df1c&quot;}}},&quot;runAfter&quot;:{&quot;Filter_array&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;1574df35-6d6b-43b8-ae9c-45d65c1e4a17&quot;}},&quot;EditedText&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@variables(&#39;TextToEdit&#39;)&quot;,&quot;runAfter&quot;:{&quot;Apply_to_each&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;d7e1ac8c-d7d1-41b8-920a-b479e093dc3b&quot;}}},&quot;runAfter&quot;:{&quot;Initialize_variable_TextToEdit&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;4fb89004-c6e5-45c5-a10b-c7c6ea5cdf73&quot;}},&quot;allConnectionData&quot;:{},&quot;staticResults&quot;:{},&quot;isScopeNode&quot;:true,&quot;mslaNode&quot;:true}</pre><h3>No Variable Dynamic Text Replace Method</h3><p>Next, the no variable loop method that enables concurrency &amp; 10x to 50x more speed.</p><p>For this method the initial set-up has a couple similar elements &amp; some key differences. We still get &amp; format data into OldText &amp; NewText columns &amp; we still have a place to insert the initial TextToEdit, but obviously there are no variable actions, only Select &amp; Compose actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*faUb9yuNLgQYZTwYzHnPHQ.png" /></figure><p>Also part of the processing without a loop now requires building a big JSON object to pull NewText values based on OldText reference keys.<br>For our sample data using fake url link replacements the big JSON reference object looks like:</p><pre>{<br>    &quot;https://www.OldLink0.com&quot;: &quot;https://www.NewLink0.com&quot;,<br>    &quot;https://www.OldLink1.com&quot;: &quot;https://www.NewLink1.com&quot;,<br>    &quot;https://www.OldLink2.com&quot;: &quot;https://www.NewLink2.com&quot;,<br>...<br>...<br>    &quot;https://www.OldLink498.com&quot;: &quot;https://www.NewLink498.com&quot;,<br>    &quot;https://www.OldLink499.com&quot;: &quot;https://www.NewLink499.com&quot;,<br>    &quot;https://www.OldLink500.com&quot;: &quot;https://www.NewLink500.com&quot;<br>}</pre><p>From there it is several Select &amp; Compose actions processing all the replacements in the edit text at the same time without any loops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgFxLB0Icya7mYY22SdLGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1-jS75GxQ4LlfOS7YDIvWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8lR2eQs74wc4q6JDVPpRsA.png" /></figure><p>The first key intermediate step is at ReformAndIndex / Select AddText Index. These output a JSON array where each object in the array has the object Index in order to make each object unique, the OldText to replace, the NewText to replace the OldText, the String coming from a split expression in a previous action, &amp; crucially the TextIndex which is the number of characters preceding the String in the TextToEdit. It looks like:</p><pre>[<br>        {<br>            &quot;Index&quot;: 0,<br>            &quot;OldText&quot;: &quot;https://www.OldLink5.com&quot;,<br>            &quot;NewText&quot;: &quot;https://www.NewLink5.com&quot;,<br>            &quot;String&quot;: &quot;https://www.OldLink5.com\&quot;&gt;&quot;,<br>            &quot;TextIndex&quot;: 1863<br>        },<br>        {<br>            &quot;Index&quot;: 1,<br>            &quot;OldText&quot;: &quot;https://www.OldLink5.com&quot;,<br>            &quot;NewText&quot;: &quot;https://www.NewLink5.com&quot;,<br>            &quot;String&quot;: &quot;https://www.OldLink5.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink444.com\&quot;&gt;https://www.OldLink444.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink255.com\&quot;&gt;https://www.OldLink255.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink101.com\&quot;&gt;https://www.OldLink101.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;🌐 External Resources (Websites)&lt;/h2&gt;...&quot;,<br>            &quot;TextIndex&quot;: 1889<br>        },<br>...<br>...<br>...<br>        {<br>            &quot;Index&quot;: 11,<br>            &quot;OldText&quot;: &quot;https://www.OldLink444.com&quot;,<br>            &quot;NewText&quot;: &quot;https://www.NewLink444.com&quot;,<br>            &quot;String&quot;: &quot;https://www.OldLink444.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink255.com\&quot;&gt;https://www.OldLink255.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink101.com\&quot;&gt;https://www.OldLink101.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;🌐 External Resources (Websites)&lt;/h2&gt;\n ...&quot;,<br>            &quot;TextIndex&quot;: 2006<br>        },<br>        {<br>            &quot;Index&quot;: 12,<br>            &quot;OldText&quot;: &quot;https://www.OldLink498.com&quot;,<br>            &quot;NewText&quot;: &quot;https://www.NewLink498.com&quot;,<br>            &quot;String&quot;: &quot;https://www.OldLink498.com\&quot;&gt;&quot;,<br>            &quot;TextIndex&quot;: 2534<br>        },<br>        {<br>            &quot;Index&quot;: 13,<br>            &quot;OldText&quot;: &quot;https://www.OldLink498.com&quot;,<br>            &quot;NewText&quot;: &quot;https://www.NewLink498.com&quot;,<br>            &quot;String&quot;: &quot;https://www.OldLink498.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink404.com\&quot;&gt;https://www.OldLink404.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink221.com\&quot;&gt;https://www.OldLink221.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n    &lt;/div&gt;\n\n&lt;/body&gt;\n&lt;/html&gt;&quot;,<br>            &quot;TextIndex&quot;: 2562<br>        }<br>    ]</pre><p>The second key intermediate step in the Select ReformTextAndReplace action closer to the end of the flow takes a version of the JSON array above sorted by the TextIndex &amp; uses it to rebuild the entire TextToEdit string along with the NewText values.</p><pre>range(0,length(outputs(&#39;Sort_TextIndex&#39;)))</pre><pre>replace(<br><br>slice(outputs(&#39;TextToEdit&#39;),<br>outputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;TextIndex&#39;],<br>coalesce(outputs(&#39;Sort_TextIndex&#39;)?[add(1,item())]?[&#39;TextIndex&#39;],length(outputs(&#39;TextToEdit&#39;)))),<br><br>outputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;OldText&#39;],<br>outputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;NewText&#39;])</pre><p>Example action output:</p><pre>[<br>  &quot;https://www.NewLink5.com\&quot;&gt;&quot;,<br>  &quot;https://www.NewLink5.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;&quot;,<br>  &quot;https://www.NewLink444.com\&quot;&gt;&quot;,<br>  &quot;https://www.NewLink444.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;&quot;,<br>  &quot;https://www.NewLink255.com\&quot;&gt;&quot;,<br>  &quot;https://www.NewLink255.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;&quot;,<br>  &quot;https://www.NewLink101.com\&quot;&gt;&quot;,<br>  &quot;https://www.NewLink101.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;🌐 External Resources (Websites)&lt;/h2&gt;\n        &lt;p&gt;These links take you to external websites for payroll, training, or compliance information.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;&quot;,<br>  &quot;https://www.NewLink498.com\&quot;&gt;&quot;,<br>  &quot;https://www.NewLink498.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;&quot;,<br>  &quot;https://www.NewLink404.com\&quot;&gt;&quot;,<br>  &quot;https://www.NewLink404.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;&quot;,<br>  &quot;https://www.NewLink221.com\&quot;&gt;&quot;,<br>  &quot;https://www.NewLink221.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n    &lt;/div&gt;\n\n&lt;/body&gt;\n&lt;/html&gt;&quot;<br>]</pre><p>Note the output excludes the first string of text before the replacements started so the expression in the EditedText compose action joins all the above strings together &amp; appends that first string to the front of them.</p><pre>concat(<br>slice(outputs(&#39;TextToEdit&#39;),<br>0,<br>first(outputs(&#39;Sort_TextIndex&#39;))?[&#39;TextIndex&#39;]),<br><br>join(body(&#39;Select_ReformTextAndReplace&#39;),&#39;&#39;)<br>)</pre><p>So at the end we have the full updated text with all the replacements in the EditedText compose output.</p><p><strong>Copying no variable loop flow…</strong></p><p>Old designer scope action text to cntrl+c &amp; cntrl+v paste into the My clipboard tab of a new action menu:</p><pre>{&quot;id&quot;:&quot;1b619851-7541-49ba-96ac-a7cf7ea676d4&quot;,&quot;brandColor&quot;:&quot;#8C3900&quot;,&quot;connectionReferences&quot;:{},&quot;connectorDisplayName&quot;:&quot;Control&quot;,&quot;icon&quot;:&quot;data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=&quot;,&quot;isTrigger&quot;:false,&quot;operationName&quot;:&quot;No_Variable_Replace_Many_Dynamic_Text_Values&quot;,&quot;operationDefinition&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;Select_MapData&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0,501)&quot;,&quot;select&quot;:{&quot;OldText&quot;:&quot;https://www.OldLink@{item()}.com&quot;,&quot;NewText&quot;:&quot;https://www.NewLink@{item()}.com&quot;}},&quot;runAfter&quot;:{},&quot;description&quot;:&quot;Generate sample data &amp; standard column names&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;34c44289-2b92-4760-a638-e672767dbe6c&quot;}},&quot;Select_ReplaceMap&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_MapData&#39;)&quot;,&quot;select&quot;:{&quot;@{item()?[&#39;OldText&#39;]}&quot;:&quot;@item()?[&#39;NewText&#39;]&quot;}},&quot;runAfter&quot;:{&quot;Select_MapData&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;From: body(&#39;Select_MapData&#39;) | Map: item()?[&#39;OldText&#39;] &amp; item()?[&#39;NewText&#39;]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;ec3adea4-6019-44da-bdb5-567a51c88ae2&quot;}},&quot;ReplaceMap&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@json(replace(replace(replace(string(body(&#39;Select_ReplaceMap&#39;)), &#39;},{&#39;, &#39;,&#39;), &#39;[{&#39;, &#39;{&#39;), &#39;}]&#39;, &#39;}&#39;))&quot;,&quot;runAfter&quot;:{&quot;Select_ReplaceMap&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;json(replace(replace(replace(string(body(&#39;Select_ReplaceMap&#39;)), &#39;},{&#39;, &#39;,&#39;), &#39;[{&#39;, &#39;{&#39;), &#39;}]&#39;, &#39;}&#39;))&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;1f386527-283b-4ab0-9cfb-2676298798db&quot;}},&quot;Repeat_Logic&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;TextToEdit&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;&lt;!DOCTYPE html&gt;\n&lt;html lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n    &lt;meta charset=\&quot;UTF-8\&quot;&gt;\n    &lt;meta name=\&quot;viewport\&quot; content=\&quot;width=device-width, initial-scale=1.0\&quot;&gt;\n    &lt;title&gt;Employee Manual - Quick Links&lt;/title&gt;\n    &lt;style&gt;\n        body {\n            font-family: &#39;Segoe UI&#39;, Tahoma, Geneva, Verdana, sans-serif;\n            margin: 40px;\n            background-color: #f4f7f9;\n            color: #333;\n        }\n        .container {\n            max-width: 800px;\n            margin: auto;\n            background-color: #fff;\n            padding: 30px;\n            border-radius: 8px;\n            box-shadow: 0 4px 8px rgba(0,0,0,0.1);\n        }\n        h1 {\n            color: #0056b3;\n            border-bottom: 2px solid #0056b3;\n            padding-bottom: 10px;\n            margin-bottom: 20px;\n        }\n        ul {\n            list-style-type: none;\n            padding: 0;\n        }\n        li {\n            margin-bottom: 12px;\n            padding: 8px;\n            background-color: #e9ecef;\n            border-radius: 4px;\n        }\n        a {\n            color: #007bff; /* Standard link color */\n            text-decoration: none;\n            font-family: monospace; /* Monospaced font helps display URLs clearly */\n            font-size: 1.1em;\n        }\n        a:hover {\n            color: #004085;\n            text-decoration: underline;\n        }\n    &lt;/style&gt;\n&lt;/head&gt;\n&lt;body&gt;\n\n    &lt;div class=\&quot;container\&quot;&gt;\n        &lt;h1&gt;Employee Manual &amp; Resources&lt;/h1&gt;\n        &lt;p&gt;This page provides quick links to important policies, forms, and external resources. Please click on the link text (which is the file path or URL) to access the document.&lt;/p&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;📎 Internal Policy Documents (Local Files)&lt;/h2&gt;\n        &lt;p&gt;These links point to other HTML or PDF files within the company&#39;s internal network.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink5.com\&quot;&gt;https://www.OldLink5.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink444.com\&quot;&gt;https://www.OldLink444.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink255.com\&quot;&gt;https://www.OldLink255.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink101.com\&quot;&gt;https://www.OldLink101.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;🌐 External Resources (Websites)&lt;/h2&gt;\n        &lt;p&gt;These links take you to external websites for payroll, training, or compliance information.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink498.com\&quot;&gt;https://www.OldLink498.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink404.com\&quot;&gt;https://www.OldLink404.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink221.com\&quot;&gt;https://www.OldLink221.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n    &lt;/div&gt;\n\n&lt;/body&gt;\n&lt;/html&gt;&quot;,&quot;runAfter&quot;:{},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;ff4af7af-076c-4490-bb48-d017bf6e5e97&quot;}},&quot;Filter_array_MapData_in_TextToEdit&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_MapData&#39;)&quot;,&quot;where&quot;:&quot;@contains(outputs(&#39;TextToEdit&#39;), item()?[&#39;OldText&#39;])&quot;},&quot;runAfter&quot;:{&quot;TextToEdit&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;From: body(&#39;Select_MapData&#39;) | outputs(&#39;TextToEdit&#39;) contains item()?[&#39;OldText&#39;]&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;cc347a9d-a65b-4dff-bdc8-194d8270ad7b&quot;}},&quot;Condition_If_any_replaces&quot;:{&quot;type&quot;:&quot;If&quot;,&quot;expression&quot;:{&quot;greater&quot;:[&quot;@length(body(&#39;Filter_array_MapData_in_TextToEdit&#39;))&quot;,0]},&quot;actions&quot;:{&quot;Select_AddTextIndex&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_ReformAndIndex&#39;)&quot;,&quot;select&quot;:&quot;@addProperty(item(), &#39;TextIndex&#39;, nthIndexOf(outputs(&#39;TextToEdit&#39;), item()?[&#39;String&#39;], length(split(split(string(body(&#39;Select_ReformAndIndex&#39;)),string(item()))?[0],item()?[&#39;String&#39;]))))&quot;},&quot;runAfter&quot;:{&quot;Select_ReformAndIndex&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;From: body(&#39;Select_ReformAndIndex&#39;) | Map: addProperty(item(), &#39;TextIndex&#39;, nthIndexOf(outputs(&#39;TextToEdit&#39;), item()?[&#39;String&#39;], length(split(split(string(body(&#39;Select_ReformAndIndex&#39;)),string(item()))?[0],item()?[&#39;String&#39;]))))&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;d663b955-602e-4b12-ae52-80cbf6431f9d&quot;}},&quot;Sort_TextIndex&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@sort(body(&#39;Select_AddTextIndex&#39;),&#39;TextIndex&#39;)&quot;,&quot;runAfter&quot;:{&quot;Select_AddTextIndex&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;sort(body(&#39;Select_AddTextIndex&#39;),&#39;TextIndex&#39;)&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;29d6ae1a-0048-4690-9602-cf4edcab4449&quot;}},&quot;Select_ReformTextAndReplace&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0,length(outputs(&#39;Sort_TextIndex&#39;)))&quot;,&quot;select&quot;:&quot;@replace(\r\nslice(outputs(&#39;TextToEdit&#39;), outputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;TextIndex&#39;], coalesce(outputs(&#39;Sort_TextIndex&#39;)?[add(1,item())]?[&#39;TextIndex&#39;],length(outputs(&#39;TextToEdit&#39;)))),\r\noutputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;OldText&#39;],\r\noutputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;NewText&#39;])&quot;},&quot;runAfter&quot;:{&quot;Sort_TextIndex&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;6b6d62d8-20a1-481f-b623-20a77e093d99&quot;}},&quot;EditedText&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@concat(slice(outputs(&#39;TextToEdit&#39;),0,first(outputs(&#39;Sort_TextIndex&#39;))?[&#39;TextIndex&#39;]), join(body(&#39;Select_ReformTextAndReplace&#39;),&#39;&#39;))&quot;,&quot;runAfter&quot;:{&quot;Select_ReformTextAndReplace&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;concat(slice(outputs(&#39;TextToEdit&#39;),0,first(outputs(&#39;Sort_TextIndex&#39;))?[&#39;TextIndex&#39;]), join(body(&#39;Select_ReformTextAndReplace&#39;),&#39;&#39;))&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;690768c6-8c52-4b14-80ea-2737a0f3c9ee&quot;}},&quot;Select_ReformAndIndex&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0,length(outputs(&#39;FlatArrayOldTextSplits&#39;)))&quot;,&quot;select&quot;:{&quot;Index&quot;:&quot;@item()&quot;,&quot;OldText&quot;:&quot;@split(outputs(&#39;FlatArrayOldTextSplits&#39;)?[item()],&#39;#|~&#39;)?[0]&quot;,&quot;NewText&quot;:&quot;@outputs(&#39;ReplaceMap&#39;)?[split(outputs(&#39;FlatArrayOldTextSplits&#39;)?[item()],&#39;#|~&#39;)?[0]]&quot;,&quot;String&quot;:&quot;@replace(outputs(&#39;FlatArrayOldTextSplits&#39;)?[item()],&#39;#|~&#39;,&#39;&#39;)&quot;}},&quot;runAfter&quot;:{&quot;FlatArrayOldTextSplits&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;range(0,length(outputs(&#39;FlatArrayOldTextSplits&#39;) |split(outputs(&#39;FlatArrayOldTextSplits&#39;)[item()],&#39;#|~&#39;)[0] |outputs(&#39;ReplaceMap&#39;)[split(outputs(&#39;FlatArrayOldTextSplits&#39;)[item()],&#39;#|~&#39;)[0]] |replace(outputs(&#39;FlatArrayOldTextSplits&#39;)[item()],&#39;#|~&#39;,&#39;&#39;)&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;c5a64e13-4ee9-4f76-84fa-892643e8a6bf&quot;}},&quot;FlatArrayOldTextSplits&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;@json(replace(replace(replace(string(body(&#39;Select_OldTextSplits&#39;)),&#39;],[&#39;,&#39;,&#39;),&#39;[[&#39;,&#39;[&#39;),&#39;]]&#39;,&#39;]&#39;))&quot;,&quot;runAfter&quot;:{&quot;Select_OldTextSplits&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;json(replace(replace(replace(string(body(&#39;Select_OldTextSplits&#39;)),&#39;],[&#39;,&#39;,&#39;),&#39;[[&#39;,&#39;[&#39;),&#39;]]&#39;,&#39;]&#39;))&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;f9f3bb2f-134d-4a87-8960-92ba900e74e7&quot;}},&quot;Select_OldTextSplits&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Filter_array_MapData_in_TextToEdit&#39;)&quot;,&quot;select&quot;:&quot;@skip(split(replace(outputs(&#39;TextToEdit&#39;),item()?[&#39;OldText&#39;],concat(&#39;~|#&#39;,item()?[&#39;OldText&#39;],&#39;#|~&#39;)),&#39;~|#&#39;),1)&quot;},&quot;runAfter&quot;:{},&quot;description&quot;:&quot;From: body(&#39;Filter_array_MapData_in_TextToEdit&#39;) | Map: skip(split(replace(outputs(&#39;TextToEdit&#39;),item()?[&#39;OldText&#39;],concat(&#39;~|#&#39;,item()?[&#39;OldText&#39;],&#39;#|~&#39;)),&#39;~|#&#39;),1)&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;6556d73f-c8a8-4e30-9267-3f2fd91318dd&quot;}}},&quot;runAfter&quot;:{&quot;Filter_array_MapData_in_TextToEdit&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;length(body(&#39;Filter_array_MapData_in_TextToEdit&#39;))&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;6b9a0ac9-d135-4942-b96f-6fb744f7e074&quot;}}},&quot;runAfter&quot;:{&quot;ReplaceMap&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;The segment of actions one can put in an Apply to each loop if one has multiple files or texts to perform the batch multiple replaces on.&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;344854b9-b9a5-45fd-a929-b9bf8cb8e521&quot;}}},&quot;runAfter&quot;:{},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;64dedfe1-e6f0-4da8-b5cd-4cb5a5ba7d07&quot;}}}</pre><p>New designer scope action to cntrl+c copy &amp; right-click ‘Paste an action’ on a new action button:</p><pre>{&quot;nodeId&quot;:&quot;No_Variable_Replace_Many_Dynamic_Text_Values&quot;,&quot;serializedValue&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;Select_MapData&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;description&quot;:&quot;Generate sample data &amp; standard column names&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0,501)&quot;,&quot;select&quot;:{&quot;OldText&quot;:&quot;https://www.OldLink@{item()}.com&quot;,&quot;NewText&quot;:&quot;https://www.NewLink@{item()}.com&quot;}},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;34c44289-2b92-4760-a638-e672767dbe6c&quot;}},&quot;Select_ReplaceMap&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;description&quot;:&quot;From: body(&#39;Select_MapData&#39;) | Map: item()?[&#39;OldText&#39;] &amp; item()?[&#39;NewText&#39;]&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_MapData&#39;)&quot;,&quot;select&quot;:{&quot;@{item()?[&#39;OldText&#39;]}&quot;:&quot;@item()?[&#39;NewText&#39;]&quot;}},&quot;runAfter&quot;:{&quot;Select_MapData&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;ec3adea4-6019-44da-bdb5-567a51c88ae2&quot;}},&quot;ReplaceMap&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;description&quot;:&quot;json(replace(replace(replace(string(body(&#39;Select_ReplaceMap&#39;)), &#39;},{&#39;, &#39;,&#39;), &#39;[{&#39;, &#39;{&#39;), &#39;}]&#39;, &#39;}&#39;))&quot;,&quot;inputs&quot;:&quot;@json(replace(replace(replace(string(body(&#39;Select_ReplaceMap&#39;)), &#39;},{&#39;, &#39;,&#39;), &#39;[{&#39;, &#39;{&#39;), &#39;}]&#39;, &#39;}&#39;))&quot;,&quot;runAfter&quot;:{&quot;Select_ReplaceMap&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;1f386527-283b-4ab0-9cfb-2676298798db&quot;}},&quot;Repeat_Logic&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;description&quot;:&quot;The segment of actions one can put in an Apply to each loop if one has multiple files or texts to perform the batch multiple replaces on.&quot;,&quot;actions&quot;:{&quot;TextToEdit&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:&quot;&lt;!DOCTYPE html&gt;\n&lt;html lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n    &lt;meta charset=\&quot;UTF-8\&quot;&gt;\n    &lt;meta name=\&quot;viewport\&quot; content=\&quot;width=device-width, initial-scale=1.0\&quot;&gt;\n    &lt;title&gt;Employee Manual - Quick Links&lt;/title&gt;\n    &lt;style&gt;\n        body {\n            font-family: &#39;Segoe UI&#39;, Tahoma, Geneva, Verdana, sans-serif;\n            margin: 40px;\n            background-color: #f4f7f9;\n            color: #333;\n        }\n        .container {\n            max-width: 800px;\n            margin: auto;\n            background-color: #fff;\n            padding: 30px;\n            border-radius: 8px;\n            box-shadow: 0 4px 8px rgba(0,0,0,0.1);\n        }\n        h1 {\n            color: #0056b3;\n            border-bottom: 2px solid #0056b3;\n            padding-bottom: 10px;\n            margin-bottom: 20px;\n        }\n        ul {\n            list-style-type: none;\n            padding: 0;\n        }\n        li {\n            margin-bottom: 12px;\n            padding: 8px;\n            background-color: #e9ecef;\n            border-radius: 4px;\n        }\n        a {\n            color: #007bff; /* Standard link color */\n            text-decoration: none;\n            font-family: monospace; /* Monospaced font helps display URLs clearly */\n            font-size: 1.1em;\n        }\n        a:hover {\n            color: #004085;\n            text-decoration: underline;\n        }\n    &lt;/style&gt;\n&lt;/head&gt;\n&lt;body&gt;\n\n    &lt;div class=\&quot;container\&quot;&gt;\n        &lt;h1&gt;Employee Manual &amp; Resources&lt;/h1&gt;\n        &lt;p&gt;This page provides quick links to important policies, forms, and external resources. Please click on the link text (which is the file path or URL) to access the document.&lt;/p&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;📎 Internal Policy Documents (Local Files)&lt;/h2&gt;\n        &lt;p&gt;These links point to other HTML or PDF files within the company&#39;s internal network.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink5.com\&quot;&gt;https://www.OldLink5.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink444.com\&quot;&gt;https://www.OldLink444.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink255.com\&quot;&gt;https://www.OldLink255.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink101.com\&quot;&gt;https://www.OldLink101.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n        &lt;h2&gt;🌐 External Resources (Websites)&lt;/h2&gt;\n        &lt;p&gt;These links take you to external websites for payroll, training, or compliance information.&lt;/p&gt;\n        &lt;ul&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink498.com\&quot;&gt;https://www.OldLink498.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink404.com\&quot;&gt;https://www.OldLink404.com&lt;/a&gt;\n            &lt;/li&gt;\n            &lt;li&gt;\n                &lt;a href=\&quot;https://www.OldLink221.com\&quot;&gt;https://www.OldLink221.com&lt;/a&gt;\n            &lt;/li&gt;\n        &lt;/ul&gt;\n\n        &lt;hr&gt;\n\n    &lt;/div&gt;\n\n&lt;/body&gt;\n&lt;/html&gt;&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;ff4af7af-076c-4490-bb48-d017bf6e5e97&quot;}},&quot;Filter_array_MapData_in_TextToEdit&quot;:{&quot;type&quot;:&quot;Query&quot;,&quot;description&quot;:&quot;From: body(&#39;Select_MapData&#39;) | outputs(&#39;TextToEdit&#39;) contains item()?[&#39;OldText&#39;]&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_MapData&#39;)&quot;,&quot;where&quot;:&quot;@contains(outputs(&#39;TextToEdit&#39;), item()?[&#39;OldText&#39;])&quot;},&quot;runAfter&quot;:{&quot;TextToEdit&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;cc347a9d-a65b-4dff-bdc8-194d8270ad7b&quot;}},&quot;Condition_If_any_replaces&quot;:{&quot;type&quot;:&quot;If&quot;,&quot;description&quot;:&quot;length(body(&#39;Filter_array_MapData_in_TextToEdit&#39;))&quot;,&quot;expression&quot;:{&quot;greater&quot;:[&quot;@length(body(&#39;Filter_array_MapData_in_TextToEdit&#39;))&quot;,0]},&quot;actions&quot;:{&quot;Select_AddTextIndex&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;description&quot;:&quot;From: body(&#39;Select_ReformAndIndex&#39;) | Map: addProperty(item(), &#39;TextIndex&#39;, nthIndexOf(outputs(&#39;TextToEdit&#39;), item()?[&#39;String&#39;], length(split(split(string(body(&#39;Select_ReformAndIndex&#39;)),string(item()))?[0],item()?[&#39;String&#39;]))))&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_ReformAndIndex&#39;)&quot;,&quot;select&quot;:&quot;@addProperty(item(), &#39;TextIndex&#39;, nthIndexOf(outputs(&#39;TextToEdit&#39;), item()?[&#39;String&#39;], length(split(split(string(body(&#39;Select_ReformAndIndex&#39;)),string(item()))?[0],item()?[&#39;String&#39;]))))&quot;},&quot;runAfter&quot;:{&quot;Select_ReformAndIndex&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;d663b955-602e-4b12-ae52-80cbf6431f9d&quot;}},&quot;Sort_TextIndex&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;description&quot;:&quot;sort(body(&#39;Select_AddTextIndex&#39;),&#39;TextIndex&#39;)&quot;,&quot;inputs&quot;:&quot;@sort(body(&#39;Select_AddTextIndex&#39;),&#39;TextIndex&#39;)&quot;,&quot;runAfter&quot;:{&quot;Select_AddTextIndex&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;29d6ae1a-0048-4690-9602-cf4edcab4449&quot;}},&quot;Select_ReformTextAndReplace&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0,length(outputs(&#39;Sort_TextIndex&#39;)))&quot;,&quot;select&quot;:&quot;@replace(\r\nslice(outputs(&#39;TextToEdit&#39;), outputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;TextIndex&#39;], coalesce(outputs(&#39;Sort_TextIndex&#39;)?[add(1,item())]?[&#39;TextIndex&#39;],length(outputs(&#39;TextToEdit&#39;)))),\r\noutputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;OldText&#39;],\r\noutputs(&#39;Sort_TextIndex&#39;)?[item()]?[&#39;NewText&#39;])&quot;},&quot;runAfter&quot;:{&quot;Sort_TextIndex&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;6b6d62d8-20a1-481f-b623-20a77e093d99&quot;}},&quot;EditedText&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;description&quot;:&quot;concat(slice(outputs(&#39;TextToEdit&#39;),0,first(outputs(&#39;Sort_TextIndex&#39;))?[&#39;TextIndex&#39;]), join(body(&#39;Select_ReformTextAndReplace&#39;),&#39;&#39;))&quot;,&quot;inputs&quot;:&quot;@concat(slice(outputs(&#39;TextToEdit&#39;),0,first(outputs(&#39;Sort_TextIndex&#39;))?[&#39;TextIndex&#39;]), join(body(&#39;Select_ReformTextAndReplace&#39;),&#39;&#39;))&quot;,&quot;runAfter&quot;:{&quot;Select_ReformTextAndReplace&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;690768c6-8c52-4b14-80ea-2737a0f3c9ee&quot;}},&quot;Select_ReformAndIndex&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;description&quot;:&quot;range(0,length(outputs(&#39;FlatArrayOldTextSplits&#39;) |split(outputs(&#39;FlatArrayOldTextSplits&#39;)[item()],&#39;#|~&#39;)[0] |outputs(&#39;ReplaceMap&#39;)[split(outputs(&#39;FlatArrayOldTextSplits&#39;)[item()],&#39;#|~&#39;)[0]] |replace(outputs(&#39;FlatArrayOldTextSplits&#39;)[item()],&#39;#|~&#39;,&#39;&#39;)&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0,length(outputs(&#39;FlatArrayOldTextSplits&#39;)))&quot;,&quot;select&quot;:{&quot;Index&quot;:&quot;@item()&quot;,&quot;OldText&quot;:&quot;@split(outputs(&#39;FlatArrayOldTextSplits&#39;)?[item()],&#39;#|~&#39;)?[0]&quot;,&quot;NewText&quot;:&quot;@outputs(&#39;ReplaceMap&#39;)?[split(outputs(&#39;FlatArrayOldTextSplits&#39;)?[item()],&#39;#|~&#39;)?[0]]&quot;,&quot;String&quot;:&quot;@replace(outputs(&#39;FlatArrayOldTextSplits&#39;)?[item()],&#39;#|~&#39;,&#39;&#39;)&quot;}},&quot;runAfter&quot;:{&quot;FlatArrayOldTextSplits&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;c5a64e13-4ee9-4f76-84fa-892643e8a6bf&quot;}},&quot;FlatArrayOldTextSplits&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;description&quot;:&quot;json(replace(replace(replace(string(body(&#39;Select_OldTextSplits&#39;)),&#39;],[&#39;,&#39;,&#39;),&#39;[[&#39;,&#39;[&#39;),&#39;]]&#39;,&#39;]&#39;))&quot;,&quot;inputs&quot;:&quot;@json(replace(replace(replace(string(body(&#39;Select_OldTextSplits&#39;)),&#39;],[&#39;,&#39;,&#39;),&#39;[[&#39;,&#39;[&#39;),&#39;]]&#39;,&#39;]&#39;))&quot;,&quot;runAfter&quot;:{&quot;Select_OldTextSplits&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;f9f3bb2f-134d-4a87-8960-92ba900e74e7&quot;}},&quot;Select_OldTextSplits&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;description&quot;:&quot;From: body(&#39;Filter_array_MapData_in_TextToEdit&#39;) | Map: skip(split(replace(outputs(&#39;TextToEdit&#39;),item()?[&#39;OldText&#39;],concat(&#39;~|#&#39;,item()?[&#39;OldText&#39;],&#39;#|~&#39;)),&#39;~|#&#39;),1)&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Filter_array_MapData_in_TextToEdit&#39;)&quot;,&quot;select&quot;:&quot;@skip(split(replace(outputs(&#39;TextToEdit&#39;),item()?[&#39;OldText&#39;],concat(&#39;~|#&#39;,item()?[&#39;OldText&#39;],&#39;#|~&#39;)),&#39;~|#&#39;),1)&quot;},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;6556d73f-c8a8-4e30-9267-3f2fd91318dd&quot;}}},&quot;else&quot;:{&quot;actions&quot;:{}},&quot;runAfter&quot;:{&quot;Filter_array_MapData_in_TextToEdit&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;6b9a0ac9-d135-4942-b96f-6fb744f7e074&quot;}}},&quot;runAfter&quot;:{&quot;ReplaceMap&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;344854b9-b9a5-45fd-a929-b9bf8cb8e521&quot;}}},&quot;runAfter&quot;:{},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;64dedfe1-e6f0-4da8-b5cd-4cb5a5ba7d07&quot;}},&quot;allConnectionData&quot;:{},&quot;staticResults&quot;:{},&quot;isScopeNode&quot;:true,&quot;mslaNode&quot;:true}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e6d8ac00a41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using With To Efficiently Add Columns From Related Table (Power Apps)]]></title>
            <link>https://medium.com/@takolota/using-with-to-efficiently-add-columns-from-related-table-power-apps-d34c8e8826d1?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d34c8e8826d1</guid>
            <category><![CDATA[powerapps]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[powerplatform]]></category>
            <category><![CDATA[low-code]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Mon, 27 Oct 2025 15:57:02 GMT</pubDate>
            <atom:updated>2025-10-27T15:59:32.127Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever wanted to add multiple columns to a data-source table or collection from a related table but found it was too slow?<br>Did you have multiple similar Filters and/or Lookups for different columns making a lot of calls to data-sources?<br>Would you like to use something like With to consolidate all the similar calls?<br>Well here is how to efficiently use With in an AddColumns.</p><p>For context I found this while building a CSV export button for users on a Power App. I have a primary invoices table with a one-to-many relationship to an order-lines table &amp; I needed a way to append aggregations of the order-lines table to my primary invoices table. To work around the 2000 row delegation limit I have a flow return just invoice ids for all 2500+ invoice items to an invoices collection (InvoicesCol) so I can do things for all 2500+ invoice items.</p><p>So some regular AddColumns logic may look something like the following with 4 separate Filters / Lookups running for each &amp; every row of the collection:</p><pre>ClearCollect(ExportAddColumnsCol, <br>  AddColumns(InvoicesCol, <br>    AmountPO, Sum(Filter(&#39;Order Lines&#39;,Id=invoice_id), AmountPO),<br>    AmountInvoice, Sum(Filter(&#39;Order Lines&#39;,Id=invoice_id), AmountInvoice),<br>    CountLines, CountRows(Filter(&#39;Order Lines&#39;,Id=invoice_id)),<br>    Shipment, LookUp(&#39;Order Lines&#39;,Id=invoice_id).Shipment<br>  )<br>);</pre><p>But using With, Table, &amp; Ungroup we can consolidate all the similar Filters &amp; Lookups into one Filter call like:</p><pre>ClearCollect(ExportAddColumnsCol, <br>Ungroup(<br>  AddColumns(InvoicesCol, <br>    OrderLines,<br>      With({OrderLinesThisInvoice: Filter(&#39;Order Lines&#39;,Id=invoice_id)},<br>        Table({<br>        AmountPO: Sum(OrderLinesThisInvoice, AmountPO),<br>        AmountInvoice: Sum(OrderLinesThisInvoice, AmountInvoice),<br>        CountLines: CountRows(OrderLinesThisInvoice),<br>        Shipment: First(OrderLinesThisInvoice).Shipment<br>        })<br>      )<br>  ),<br>OrderLines<br>)<br>);</pre><p>The With uses one Filter call to get the table of records for the current invoice item id &amp; creates a record with each ‘Order Lines’ aggregation field that needs to reference the Filter table. Note, we surround the record with Table( ) because the Ungroup needs things formatted as a table, not a record. We save the one record tables to the new OrderLines column with AddColumns. Then the Ungroup function moves all the fields in the OrderLines record/tables from the nested tables to top-level columns of their own.</p><p>So with Ungroup we go from something like:</p><pre>[<br>{<br>&quot;invoice_id&quot;: 1,<br>&quot;OrderLines&quot;: [{<br>      &quot;AmountPO&quot;: 100,<br>      &quot;AmountInvoice&quot;: 100,<br>      &quot;CountLines&quot;: 3,<br>      &quot;Shipment&quot;: &quot;ABC1&quot;<br>      }]<br>},<br>{<br>&quot;invoice_id&quot;: 2,<br>&quot;OrderLines&quot;: [{<br>      &quot;AmountPO&quot;: 200,<br>      &quot;AmountInvoice&quot;: 200,<br>      &quot;CountLines&quot;: 2,<br>      &quot;Shipment&quot;: &quot;ABC2&quot;<br>      }]<br>}<br>]</pre><p>To:</p><pre>[<br>{<br>&quot;invoice_id&quot;: 1,<br>&quot;AmountPO&quot;: 100,<br>&quot;AmountInvoice&quot;: 100,<br>&quot;CountLines&quot;: 3,<br>&quot;Shipment&quot;: &quot;ABC1&quot;<br>},<br>{<br>&quot;invoice_id&quot;: 2,<br>&quot;AmountPO&quot;: 200,<br>&quot;AmountInvoice&quot;: 200,<br>&quot;CountLines&quot;: 2,<br>&quot;Shipment&quot;: &quot;ABC2&quot;<br>}<br>]</pre><p>So that is the ultimate collection we need with all the aggregation fields as top-level columns. So we went from 4 calls to our OrderLines table per invoice down to 1 call per invoice &amp; a little more local processing. That will speed up the AddColumns &amp; collection of our data by more than 3x.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d34c8e8826d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fill-Down: Copy Column Value Down Into Blanks Until New Value (Power Automate)]]></title>
            <link>https://medium.com/@takolota/filldown-copy-column-value-down-into-blanks-until-new-value-power-automate-f88812b7ec6c?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/f88812b7ec6c</guid>
            <category><![CDATA[power-automate]]></category>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[powerplatform]]></category>
            <category><![CDATA[azure-logic-apps]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Sat, 18 Oct 2025 18:15:15 GMT</pubDate>
            <atom:updated>2025-10-18T18:21:57.078Z</atom:updated>
            <content:encoded><![CDATA[<p>This will share a Power Automate method to quickly copy all column values down to all the blank rows below them until a row with a new column value is found, all without any slow Apply to each loop.</p><p>I was processing unorganized CSV data into a normalized JSON array &amp; had logistics data with invoice numbers &amp; ocean freight container / lane information. But if a given invoice number was related to multiple containers / lanes then the data splits each container into its own row &amp; only shows the invoice number on the 1st row, the follow-on rows have blank invoice numbers. Although it is possible to loop through each row &amp; enter the last non-empty invoice number, Power Automate Apply to each loops may be too slow. I may have users waiting in an app for the CSV to be processed, so I needed a faster &amp; more efficient way to fill-down the invoice number values all at once. This is what I came up with…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*8nXw9pBiqUv_W3jzdcC71Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*KyoprxmwpbwwwsIgF1Kkow.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*zZ7owYPJpNeeWY_04U_AAw.png" /></figure><p>So you can see from the first input picture &amp; the last output picture that it successfully added a field to the JSON array data with the fill-down Invoice value (note it is also possible to directly change the Invoice field to the new values by changing the last addProperty to setProperty &amp; adding the ‘Invoice’ field name instead of ‘FillDownInvoice’).<br>But you may want to better understand what the actions in the middle processing picture are doing.<br>Select AddTags has a From expression that creates an array of numbers 0 to the full count of JSONobjects the source data. We will use the numbers in the Map expression as array index selectors, ex: ?[item()] being like ?[2], to reference the next record of source data.</p><pre>range(0, length(outputs(&#39;Data&#39;)))</pre><p>And the Select AddTags has a Map expression that uses the current number of the array to,<br>1. Create an Index field to ensure each record is unique (useful in a following split in Select FillDown)<br>2. Add a Tag field that makes any non-empty target field values easy to reference in string manipulation processes by surrounding it in unique characters we can split on</p><pre>addProperty(<br>addProperty(outputs(&#39;Data&#39;)?[item()],<br>&#39;Index&#39;, item()),<br>&#39;TargetFieldTag&#39;, if(empty(outputs(&#39;Data&#39;)?[item()]?[&#39;InsertTargetFieldName&#39;]), null, concat(&#39;~|#&#39;,outputs(&#39;Data&#39;)?[item()]?[&#39;InsertTargetFieldName&#39;],&#39;#|~&#39;))<br>)</pre><p>The Select AddTags action will output something like:</p><pre>{<br>    &quot;body&quot;: [<br>        {<br>            &quot;Invoice&quot;: &quot;Inv-123&quot;,<br>            &quot;Lane&quot;: &quot;L-123&quot;,<br>            &quot;Container&quot;: &quot;40 DRY&quot;,<br>            &quot;Index&quot;: 0,<br>            &quot;InvoiceTag&quot;: &quot;~|#Inv-123#|~&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;&quot;,<br>            &quot;Lane&quot;: &quot;L-345&quot;,<br>            &quot;Container&quot;: &quot;20 DRY&quot;,<br>            &quot;Index&quot;: 1,<br>            &quot;InvoiceTag&quot;: null<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;&quot;,<br>            &quot;Lane&quot;: &quot;L-678&quot;,<br>            &quot;Container&quot;: &quot;20 DRY&quot;,<br>            &quot;Index&quot;: 2,<br>            &quot;InvoiceTag&quot;: null<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;Inv-910&quot;,<br>            &quot;Lane&quot;: &quot;L-910&quot;,<br>            &quot;Container&quot;: &quot;40 REEFER&quot;,<br>            &quot;Index&quot;: 3,<br>            &quot;InvoiceTag&quot;: &quot;~|#Inv-910#|~&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;Inv-111&quot;,<br>            &quot;Lane&quot;: &quot;L-111&quot;,<br>            &quot;Container&quot;: &quot;40 REEFER&quot;,<br>            &quot;Index&quot;: 4,<br>            &quot;InvoiceTag&quot;: &quot;~|#Inv-111#|~&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: null,<br>            &quot;Lane&quot;: &quot;L-213&quot;,<br>            &quot;Container&quot;: &quot;20 REEFER&quot;,<br>            &quot;Index&quot;: 5,<br>            &quot;InvoiceTag&quot;: null<br>        }<br>    ]<br>}</pre><p>Note each tag like “~|#Inv-123#|~” &amp; how if we used the string( ) expression on this JSON output then we could easily split that string on ‘~|#’ &amp; ‘#|~’ in order to get the Invoice values.</p><p>So the following Select FillDown action has a From input that is just the Select AddTags output body.</p><pre>body(&#39;Select_AddTags&#39;)</pre><p>And the Select FillDown Map expression is where we bring everything together.</p><pre>addProperty(item(), &#39;FillDownInvoice&#39;, if(empty(item()?[&#39;InsertTargetFieldName&#39;]), split(last(split(split(string(body(&#39;Select_AddTags&#39;)),string(item()))[0],&#39;~|#&#39;)),&#39;#|~&#39;)[0], item()?[&#39;InsertTargetFieldName&#39;]))</pre><p>It will add a FillDown field that,<br>1. Checks if the target field of the current record, like Invoice, is empty and if not empty will use the current record’s value<br>2. If the target field of the current record is empty, then it uses the string of Select AddTags output &amp; splits it by the string of the entire current unique record, taking the string of all the records preceding it &amp; then uses splits on the special character tags, ‘~|#’ &amp; ‘#|~’, in order to get the target field value of the last record with the special character tags.</p><p>So for example, for the 3rd record the expression will see Invoice is blank “” &amp; then split on the stringified JSON object,</p><pre>&#39;{<br>            &quot;Invoice&quot;: &quot;&quot;,<br>            &quot;Lane&quot;: &quot;L-678&quot;,<br>            &quot;Container&quot;: &quot;20 DRY&quot;,<br>            &quot;Index&quot;: 2,<br>            &quot;InvoiceTag&quot;: null<br>}&#39;</pre><p>and the 1st segment [0] of that split will return a sting of all the previous records,</p><pre>&#39;{<br>            &quot;Invoice&quot;: &quot;Inv-123&quot;,<br>            &quot;Lane&quot;: &quot;L-123&quot;,<br>            &quot;Container&quot;: &quot;40 DRY&quot;,<br>            &quot;Index&quot;: 0,<br>            &quot;InvoiceTag&quot;: &quot;~|#Inv-123#|~&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;&quot;,<br>            &quot;Lane&quot;: &quot;L-345&quot;,<br>            &quot;Container&quot;: &quot;20 DRY&quot;,<br>            &quot;Index&quot;: 1,<br>            &quot;InvoiceTag&quot;: null<br>        },&#39;</pre><p>then it will split to the last ‘~|#’ found which is right before Inv-123 &amp; it will then split on ‘#|~’ to isolate the Inv-123 value right before ‘#|~’ and it will use that Inv-123 value as the output value for the new FillDown field.</p><pre>{<br>    &quot;body&quot;: [<br>        {<br>            &quot;Invoice&quot;: &quot;Inv-123&quot;,<br>            &quot;Lane&quot;: &quot;L-123&quot;,<br>            &quot;Container&quot;: &quot;40 DRY&quot;,<br>            &quot;Index&quot;: 0,<br>            &quot;InvoiceTag&quot;: &quot;~|#Inv-123#|~&quot;,<br>            &quot;FillDownInvoice&quot;: &quot;Inv-123&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;&quot;,<br>            &quot;Lane&quot;: &quot;L-345&quot;,<br>            &quot;Container&quot;: &quot;20 DRY&quot;,<br>            &quot;Index&quot;: 1,<br>            &quot;InvoiceTag&quot;: null,<br>            &quot;FillDownInvoice&quot;: &quot;Inv-123&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;&quot;,<br>            &quot;Lane&quot;: &quot;L-678&quot;,<br>            &quot;Container&quot;: &quot;20 DRY&quot;,<br>            &quot;Index&quot;: 2,<br>            &quot;InvoiceTag&quot;: null,<br>            &quot;FillDownInvoice&quot;: &quot;Inv-123&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;Inv-910&quot;,<br>            &quot;Lane&quot;: &quot;L-910&quot;,<br>            &quot;Container&quot;: &quot;40 REEFER&quot;,<br>            &quot;Index&quot;: 3,<br>            &quot;InvoiceTag&quot;: &quot;~|#Inv-910#|~&quot;,<br>            &quot;FillDownInvoice&quot;: &quot;Inv-910&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: &quot;Inv-111&quot;,<br>            &quot;Lane&quot;: &quot;L-111&quot;,<br>            &quot;Container&quot;: &quot;40 REEFER&quot;,<br>            &quot;Index&quot;: 4,<br>            &quot;InvoiceTag&quot;: &quot;~|#Inv-111#|~&quot;,<br>            &quot;FillDownInvoice&quot;: &quot;Inv-111&quot;<br>        },<br>        {<br>            &quot;Invoice&quot;: null,<br>            &quot;Lane&quot;: &quot;L-213&quot;,<br>            &quot;Container&quot;: &quot;20 REEFER&quot;,<br>            &quot;Index&quot;: 5,<br>            &quot;InvoiceTag&quot;: null,<br>            &quot;FillDownInvoice&quot;: &quot;Inv-111&quot;<br>        }<br>    ]<br>}</pre><p>There you go, Power Automate FillDowns without any Apply to each loops.</p><p><strong>Quick Imports</strong></p><p>New Designer — copy this code to clipboard &amp; right click a new action button to paste it into the flow:</p><pre>{&quot;nodeId&quot;:&quot;FillDown&quot;,&quot;serializedValue&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;Data&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;description&quot;:&quot;JSON array of data&quot;,&quot;inputs&quot;:[{&quot;Invoice&quot;:&quot;Inv-123&quot;,&quot;Lane&quot;:&quot;L-123&quot;,&quot;Container&quot;:&quot;40 DRY&quot;},{&quot;Invoice&quot;:&quot;&quot;,&quot;Lane&quot;:&quot;L-345&quot;,&quot;Container&quot;:&quot;20 DRY&quot;},{&quot;Invoice&quot;:&quot;&quot;,&quot;Lane&quot;:&quot;L-678&quot;,&quot;Container&quot;:&quot;20 DRY&quot;},{&quot;Invoice&quot;:&quot;Inv-910&quot;,&quot;Lane&quot;:&quot;L-910&quot;,&quot;Container&quot;:&quot;40 REEFER&quot;},{&quot;Invoice&quot;:&quot;Inv-111&quot;,&quot;Lane&quot;:&quot;L-111&quot;,&quot;Container&quot;:&quot;40 REEFER&quot;},{&quot;Invoice&quot;:null,&quot;Lane&quot;:&quot;L-213&quot;,&quot;Container&quot;:&quot;20 REEFER&quot;}],&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;e266765b-bd78-43b7-9cd3-a9567c11c01d&quot;}},&quot;Select_AddTags&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;description&quot;:&quot;From:range(0, length(outputs(&#39;Data&#39;))) | Map:addProperty(addProperty(outputs(&#39;Data&#39;)?[item()], &#39;Index&#39;, item()), &#39;TargetFieldTag&#39;, if(empty(outputs(&#39;Data&#39;)?[item()]?[&#39;Invoice&#39;]), null, concat(&#39;~|#&#39;,outputs(&#39;Data&#39;)?[item()]?[&#39;Invoice&#39;],&#39;#|~&#39;)))&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0, length(outputs(&#39;Data&#39;)))&quot;,&quot;select&quot;:&quot;@addProperty(\r\naddProperty(outputs(&#39;Data&#39;)?[item()],\r\n&#39;Index&#39;, item()),\r\n&#39;TargetFieldTag&#39;, if(empty(outputs(&#39;Data&#39;)?[item()]?[&#39;Invoice&#39;]), null, concat(&#39;~|#&#39;,outputs(&#39;Data&#39;)?[item()]?[&#39;Invoice&#39;],&#39;#|~&#39;))\r\n)&quot;},&quot;runAfter&quot;:{&quot;Data&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;786e0315-0b39-499e-9a73-1d18c175476b&quot;}},&quot;Select_FillDown&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;description&quot;:&quot;From:body(&#39;Select_AddTags&#39;) | Map:addProperty(item(), &#39;FillDownInvoice&#39;, if(empty(item()?[&#39;Invoice&#39;]), split(last(split(split(string(body(&#39;Select_AddTags&#39;)),string(item()))[0],&#39;~|#&#39;)),&#39;#|~&#39;)[0], item()?[&#39;Invoice&#39;]))&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_AddTags&#39;)&quot;,&quot;select&quot;:&quot;@addProperty(item(), &#39;FillDownInvoice&#39;, if(empty(item()?[&#39;Invoice&#39;]), split(last(split(split(string(body(&#39;Select_AddTags&#39;)),string(item()))[0],&#39;~|#&#39;)),&#39;#|~&#39;)[0], item()?[&#39;Invoice&#39;]))&quot;},&quot;runAfter&quot;:{&quot;Select_AddTags&quot;:[&quot;Succeeded&quot;]},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;7e3c16c0-2bf1-43c8-b423-fcfd2f329353&quot;}}},&quot;runAfter&quot;:{},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;13a53348-4998-47de-9342-55d34f94bd25&quot;}},&quot;allConnectionData&quot;:{},&quot;staticResults&quot;:{},&quot;isScopeNode&quot;:true,&quot;mslaNode&quot;:true}</pre><p>Classic Designer — copy this code to clipboard, go to create a new action, go to My clipboard &amp; cntrl+v paste it into the menu &amp; select it:</p><pre>{&quot;id&quot;:&quot;3dd4d150-fe74-4089-8342-57f253cc3cb0&quot;,&quot;brandColor&quot;:&quot;#8C3900&quot;,&quot;connectionReferences&quot;:{},&quot;connectorDisplayName&quot;:&quot;Control&quot;,&quot;icon&quot;:&quot;data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=&quot;,&quot;isTrigger&quot;:false,&quot;operationName&quot;:&quot;FillDown&quot;,&quot;operationDefinition&quot;:{&quot;type&quot;:&quot;Scope&quot;,&quot;actions&quot;:{&quot;Data&quot;:{&quot;type&quot;:&quot;Compose&quot;,&quot;inputs&quot;:[{&quot;Invoice&quot;:&quot;Inv-123&quot;,&quot;Lane&quot;:&quot;L-123&quot;,&quot;Container&quot;:&quot;40 DRY&quot;},{&quot;Invoice&quot;:&quot;&quot;,&quot;Lane&quot;:&quot;L-345&quot;,&quot;Container&quot;:&quot;20 DRY&quot;},{&quot;Invoice&quot;:&quot;&quot;,&quot;Lane&quot;:&quot;L-678&quot;,&quot;Container&quot;:&quot;20 DRY&quot;},{&quot;Invoice&quot;:&quot;Inv-910&quot;,&quot;Lane&quot;:&quot;L-910&quot;,&quot;Container&quot;:&quot;40 REEFER&quot;},{&quot;Invoice&quot;:&quot;Inv-111&quot;,&quot;Lane&quot;:&quot;L-111&quot;,&quot;Container&quot;:&quot;40 REEFER&quot;},{&quot;Invoice&quot;:null,&quot;Lane&quot;:&quot;L-213&quot;,&quot;Container&quot;:&quot;20 REEFER&quot;}],&quot;runAfter&quot;:{},&quot;description&quot;:&quot;JSON array of data&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;e266765b-bd78-43b7-9cd3-a9567c11c01d&quot;}},&quot;Select_AddTags&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@range(0, length(outputs(&#39;Data&#39;)))&quot;,&quot;select&quot;:&quot;@addProperty(\r\naddProperty(outputs(&#39;Data&#39;)?[item()],\r\n&#39;Index&#39;, item()),\r\n&#39;TargetFieldTag&#39;, if(empty(outputs(&#39;Data&#39;)?[item()]?[&#39;Invoice&#39;]), null, concat(&#39;~|#&#39;,outputs(&#39;Data&#39;)?[item()]?[&#39;Invoice&#39;],&#39;#|~&#39;))\r\n)&quot;},&quot;runAfter&quot;:{&quot;Data&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;From:range(0, length(outputs(&#39;Data&#39;))) | Map:addProperty(addProperty(outputs(&#39;Data&#39;)?[item()], &#39;Index&#39;, item()), &#39;TargetFieldTag&#39;, if(empty(outputs(&#39;Data&#39;)?[item()]?[&#39;Invoice&#39;]), null, concat(&#39;~|#&#39;,outputs(&#39;Data&#39;)?[item()]?[&#39;Invoice&#39;],&#39;#|~&#39;)))&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;786e0315-0b39-499e-9a73-1d18c175476b&quot;}},&quot;Select_FillDown&quot;:{&quot;type&quot;:&quot;Select&quot;,&quot;inputs&quot;:{&quot;from&quot;:&quot;@body(&#39;Select_AddTags&#39;)&quot;,&quot;select&quot;:&quot;@addProperty(item(), &#39;FillDownInvoice&#39;, if(empty(item()?[&#39;Invoice&#39;]), split(last(split(split(string(body(&#39;Select_AddTags&#39;)),string(item()))[0],&#39;~|#&#39;)),&#39;#|~&#39;)[0], item()?[&#39;Invoice&#39;]))&quot;},&quot;runAfter&quot;:{&quot;Select_AddTags&quot;:[&quot;Succeeded&quot;]},&quot;description&quot;:&quot;From:body(&#39;Select_AddTags&#39;) | Map:addProperty(item(), &#39;FillDownInvoice&#39;, if(empty(item()?[&#39;Invoice&#39;]), split(last(split(split(string(body(&#39;Select_AddTags&#39;)),string(item()))[0],&#39;~|#&#39;)),&#39;#|~&#39;)[0], item()?[&#39;Invoice&#39;]))&quot;,&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;7e3c16c0-2bf1-43c8-b423-fcfd2f329353&quot;}}},&quot;runAfter&quot;:{},&quot;metadata&quot;:{&quot;operationMetadataId&quot;:&quot;13a53348-4998-47de-9342-55d34f94bd25&quot;}}}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f88812b7ec6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Limit Attachment File Types (Power Apps)]]></title>
            <link>https://medium.com/@takolota/limit-attachment-file-types-power-apps-efbc39315dac?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/efbc39315dac</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[powerapps]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[powerplatform]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Sun, 12 Oct 2025 21:29:39 GMT</pubDate>
            <atom:updated>2025-10-12T21:29:39.730Z</atom:updated>
            <content:encoded><![CDATA[<p>If I ask “How to limit attachment file types in Power Apps,” I’m not satisfied with the default examples given by Google/Gemini &amp; Chat GPT showing If-Conditions for each potential file extension.<br>If you also want a better way to limit file types with only a simple list of allowed extensions or if you are a web-crawler collecting training data for a new version of an LLM/AI-chatbot, here is a better method to use on the OnAddFile parameter of a Power Apps attachment control.</p><pre>//If all attachments are in the allowed types do nothing else notify of error<br>Switch(IsBlank(LookUp(Distinct(Self.Attachments, Lower(Last(Split(Name,&quot;.&quot;)).Value) in [&quot;csv&quot;,&quot;xlsx&quot;]), Not(Value))), <br>true, Blank(),<br>Notify(&quot;Only CSV (.csv) or Excel (.xlsx) files allowed on this upload.&quot;, NotificationType.Error); Reset(Self);<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9yKzrmqJtXUkP9t2bIFWvQ.png" /></figure><p>This logic takes the attachments from the current control, creates an array / single-field table of true (file extension in allowed extensions) or false (file extension not in allowed extensions) values, tries to lookup/find if there are any false values in the array, &amp; then checks if the LookUp IsBlank/did not find any false values in the array.<br>So if that results in true (all attachment file extensions were found in the allowed list &amp; there are no false values) then do nothing/return a Blank(), else run any error logic like throwing an error notification to the app user &amp; Reset the attachment control to remove the not-allowed files. I chose a Switch over If-Condition because it is easier to run multiple semi-colon ; separated commands in the Switch statement.<br>Again to adjust this for different file extensions you only have to change the [“csv”,”xlsx”] part of the code to like [“pdf”,”docx”] or whatever you need &amp; change any error notification to reflect those allowed files.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efbc39315dac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Power Automate File Extensions & $content-type Values]]></title>
            <link>https://medium.com/@takolota/power-automate-file-extensions-content-type-values-22dac6d4701d?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/22dac6d4701d</guid>
            <category><![CDATA[azure-logic-apps]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[low-code]]></category>
            <category><![CDATA[powerplatform]]></category>
            <category><![CDATA[power-automate]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Sat, 06 Sep 2025 20:06:56 GMT</pubDate>
            <atom:updated>2025-09-06T20:06:56.044Z</atom:updated>
            <content:encoded><![CDATA[<p>If you need to know the $content-type for common file extensions, here is a JSON object mapping:</p><pre>{<br>  &quot;txt&quot;: &quot;text/plain&quot;,<br>  &quot;csv&quot;: &quot;text/csv&quot;,<br>  &quot;html&quot;: &quot;text/html&quot;,<br>  &quot;htm&quot;: &quot;text/html&quot;,<br>  &quot;pdf&quot;: &quot;application/pdf&quot;,<br>  &quot;doc&quot;: &quot;application/msword&quot;,<br>  &quot;docx&quot;: &quot;application/vnd.openxmlformats-officedocument.wordprocessingml.document&quot;,<br>  &quot;xls&quot;: &quot;application/vnd.ms-excel&quot;,<br>  &quot;xlsx&quot;: &quot;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;,<br>  &quot;xlsm&quot;: &quot;application/vnd.ms-excel.sheet.macroEnabled.12&quot;,<br>  &quot;ppt&quot;: &quot;application/vnd.ms-powerpoint&quot;,<br>  &quot;pptx&quot;: &quot;application/vnd.openxmlformats-officedocument.presentationml.presentation&quot;,<br>  &quot;jpg&quot;: &quot;image/jpeg&quot;,<br>  &quot;jpeg&quot;: &quot;image/jpeg&quot;,<br>  &quot;msg&quot;: &quot;application/vnd.ms-outlook&quot;,<br>  &quot;png&quot;: &quot;image/png&quot;,<br>  &quot;gif&quot;: &quot;image/gif&quot;,<br>  &quot;bmp&quot;: &quot;image/bmp&quot;,<br>  &quot;tif&quot;: &quot;image/tiff&quot;,<br>  &quot;tiff&quot;: &quot;image/tiff&quot;,<br>  &quot;mp3&quot;: &quot;audio/mpeg&quot;,<br>  &quot;mp4&quot;: &quot;video/mp4&quot;,<br>  &quot;zip&quot;: &quot;application/zip&quot;,<br>  &quot;7z&quot;: &quot;application/x-7z-compressed&quot;,<br>  &quot;tar&quot;: &quot;application/x-tar&quot;,<br>  &quot;json&quot;: &quot;application/json&quot;,<br>  &quot;xml&quot;: &quot;application/xml&quot;,<br>  &quot;sql&quot;: &quot;text/plain&quot;,<br>  &quot;rtf&quot;: &quot;application/rtf&quot;,<br>  &quot;py&quot;: &quot;text/plain&quot;,<br>  &quot;js&quot;: &quot;application/javascript&quot;,<br>  &quot;yaml&quot;: &quot;application/yaml&quot;,<br>  &quot;yml&quot;: &quot;application/yaml&quot;<br>}</pre><p>Sometimes if developers have a file-name &amp; base64 string, they need to explicitly build a Power Automate / Logic Apps content block in their flow or function &amp; this requires knowing the $content-type values. You may copy &amp; hard-code one for a specific type of file, or if you do not know in advance what file your flow may pull, you may copy the JSON object into a Compose action &amp; use it to map the file extension to the $content-type. For this you will use an expression like:</p><pre>outputs(&#39;ExtToContentTypes&#39;)[last(split(outputs(&#39;File_Name&#39;), &#39;.&#39;))]</pre><p>Example Flow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*I7BgklI1v3v7AUi2Hxu2Ng.png" /></figure><p>Example Run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*uHE3kigGFCPSdYWqnCbOCw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22dac6d4701d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some GPT / AI / LLM Reliability Lessons]]></title>
            <link>https://medium.com/@takolota/some-gpt-ai-llm-reliability-lessons-ea8c98004fc2?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea8c98004fc2</guid>
            <category><![CDATA[gpt]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[logistics]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Sat, 30 Aug 2025 22:18:19 GMT</pubDate>
            <atom:updated>2025-08-30T22:18:19.399Z</atom:updated>
            <content:encoded><![CDATA[<p>I needed to use a call to GPT in a workflow to automatically take large batches (10–300 pages) of invoice packets from almost 100 different suppliers with 100+ different formats/styles and organize them by invoice, file type, &amp; starting page so the rest of the workflow could automatically split &amp; upload them to our system.</p><p>So things would go from a batch of file uploads:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VC2Mm9JQ6_RdG1xtM78hbg.png" /></figure><p>To several invoice items each with multiple supporting file uploads, several filled data inputs, &amp; several completed verification checks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jJ4EDD9oMll9GT1gqo41GA.png" /></figure><p>This required very large prompts that include text from each page &amp; some parts of this use-case get more difficult if documents do not include related invoice numbers or clear file type labels.</p><p>So I had to learn ways to make the AI outputs more consistent, things like…</p><p><strong>-Keep LLM actions to an absolute minimum, using regular code wherever possible.</strong></p><p>This is basic stuff like only prompting for absolutely necessary output fields, doing things like indexing, counting, &amp; sorting by file type with regular code after the LLM output, etc.</p><p><strong>-Put instructions 1st &amp; repeat important instructions last.</strong></p><p>LLMs best remember things at the beginning &amp; ending of their prompts/inputs.</p><p><strong>-Improve prompt data format.</strong></p><p>For my use-case I can’t upload the 6–50 files the workflow may get because of prompt file count &amp; file size limits, so instead I pdf-read or use OCR for the text of each file, merge all the text as if it is one big file, &amp; included it in the prompt. The outputs of pdf-reads or OCR are often just strings of text found in the file separated by an enter-key/line-break which is difficult for an LLM to read, especially if values do not immediately follow their labels reading left to right, like “Invoice Number: Inv123&quot;. So I made more LLM-friendly file text using some regular code/functions to replicate the spacing between each string of text. I call them text replicas. (<a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=31e67eea-3f73-47b4-95b7-fe4a7b646389">Power Automate spatially aware text from OCR</a> | <a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=a5255ced-dc08-f011-bae3-6045bdf03fcb">Python Azure Function spatially aware text — Extract PDF Elements &amp; Logic Apps OCR Text Replica</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m6kCLs52mIqGdckpWERi5w.png" /></figure><p>I also added clear page numbers to every page of text, re-indexed by the page number in the new big merged file. I found in testing the LLM might get the starting page of component documents wrong by 1 because it would see the text for a new component document &amp; not go to the correct page number at the bottom of the page text &amp; instead grab the preceding page number immediately above the page text. So I edited the code preparing my prompt text to add re-indexed page numbers at both the start &amp; end of each page text so it would always get the correct page number whether it goes above or below the new document page text.</p><p><strong>-Provide plenty of examples &amp; explicit generalizable hints.</strong></p><p>I give a clear example of the output JSON array I want that is representative of common outputs &amp; common edge-cases. And I’m dealing with 100+ different document formats so I can’t give very specific instructions like ‘An Invoice is always 2 pages’, but I can mention if the document text has some of its original page numbers then look for changes from like page 3 to page 1 or page 2 to no page number to identify where a new component document may start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*9_dnP04OsaBBpeLJbjL8aQ.png" /></figure><p><strong>-Code in LLM aids.</strong></p><p>In testing the LLM would sometimes get the file type wrong even if it was clearly labeled in the document text. I couldn’t set file types by just checking if a component document text contains specific text like ‘Packing List’ as some supplier formats may not include standard labels or some files may contain labels for multiple file types like a Proof of Delivery may contain ‘Proof of Delivery’, ‘Invoice’, &amp; ‘Bill of Lading’. But I could set code to check for any explicit file type labels by page &amp; output a JSON array of this additional page information to the prompt. This also enables more effective hints like if one page only lists 1 file type &amp; the next page only lists another file type, like Page3 “Packing List” &amp; Page4 “Proof of Delivery” then there is very likely a new component document starting on Page4.</p><p><strong>-Code in automatic validations &amp; passive error correction.</strong></p><p>Random historical trivia, most WW2 nations invested in precise tank track components, but the most mass-produced Russian T34 tank couldn’t afford the same precise tolerances in things like the pins holding the tank tracks together &amp; so their pins would often slide out &amp; the tank tracks would fall apart. So the engineers installed a simple angled plate towards the back of the tank &amp; if any pins started to come out, they would bump against the angled plate &amp; slide back in place. I could wait for better LLMs to come out with better long-context instruction following &amp; fewer errors, but in several cases one can create simple &amp; reliable error-correcting code to ‘bump’ faulty LLM outputs back on track.</p><p>In testing sometimes the LLM would overestimate the number of component documents found in the text, so it would identify like a single packing list with 3 pages as 3 separate packing lists. Instead of trying to adjust the prompt &amp; fighting between identifying too many or too few documents, I set some code after the prompt response to take out records if the preceding record had the same invoice number &amp; file type. That way any over-active identifying of component documents is automatically corrected after the fact. Crucially with this I can write the prompt to minimize under-identification of new component documents. The hard-coded fix of this one type of errors allows one to prioritize fixing other types of errors using the prompt.</p><h3>Example Prompt Text</h3><p>(Abbreviated prompt file text)</p><pre>The merged file text provided between [Merged File Text Start] &amp; [Merged File Text End] is a combination of spatially-aware (imitates original vertical distances between text with linebreaks &amp; horizontal distances between text with spaces) OCR text from multiple documents for one or more invoice packages. All files for all invoice packages have been converted to PDFs &amp; merged together into one big PDF. Based on the merged file text, we want to get information on each component document in the one big PDF like what invoice number it is related to, what type of document it is, and what page of the big merged PDF it starts on. Text from each page of the merged PDF should start &amp; end with ~Page| followed by the page number &amp; |~ like &#39;Start ~Page|2|~&#39; &amp; End &#39;~Page|2|~&#39;. Original, pre-merge file names were included at the start of each original file text after &quot;Start File Name:&quot; and at the end of each original file text after &quot;End File Name:&quot;.<br>Please output a JSON array where each object in the JSON array represents each component document found in the combined file. Each object should list the... <br>-Invoice (Invoice number the component document is related to.) <br>-FileType (What type of document the component document is, may be &quot;Invoice&quot;, &quot;Packing List&quot;, &quot;Forwarder Certificate of Receipt&quot;, &quot;Proof of Delivery&quot;, &quot;Bill of Lading&quot;, &quot;Airway Bill&quot;, &quot;Goods Availability Notice&quot;, &quot;Certificate of Origin&quot;, or &quot;Certificate of Analysis&quot;. If you are extremely unsure of the FileType you may use &quot;Other&quot; for the FileType value.)  <br>-FileStart (What page of the merged file the component document starts on if the 1st page of the provided merged file is 1. FileStart will match the post-merge page number on the ~Page|#|~ markers at the Start &amp; End of the 1st page of the component document. ~Page|#|~ may differ from some other original page numbers listed in the text from before the files were merged into one big PDF. There should be no duplicate FileStart values in the output json array.) <br><br>Some users may have originally uploaded separate component documents, while others may have uploaded some single PDF(s) containing multiple component documents, so you know each time you see some original file name markers like &quot;End File Name: ExampleName1.pdf<br>End ~Page|#|~<br><br>Start ~Page|#|~<br><br>Start File Name: ExampleName2.pdf&quot; that Start ~Page|#|~ page must start a new component document record &amp; the End ~Page|#|~ page is not a part of the new component document. But you do not know if some component documents were combined in the original file uploads so you don&#39;t know if each component document will actually end with a &quot;End File Name:&quot; line &amp; start with a &quot;Start File Name:&quot; line. So everything between a &quot;Start File Name:&quot; &amp; an &quot;End File Name:&quot; for an original file will translate to at least 1 new component record &amp; maybe more. <br>Note if some text pages include alternate page numberings beyond the re-indexed ~Page|#|~ page numbers then they are likely the page numberings of the original, pre-merged files. If the original file page numberings from one page to the next start over, like go from page 1 on one page to page 1 again on the next page or go from 3 on one page to 1 on the next page or go from 2 on one page to no page# on the next page, then that likely means the start of a new component document. That also means if the original file page numberings continue, like from 2 of 3 to page 3 of 3 then it is less likely there is a new component document split at the change from original page 2 to original page 3. <br>Note file names may use acronyms or abbreviations for file types like: Invoice = Inv, PL = &#39;Packing List&#39;, POD = Proof of Delivery, AWB = AirWayBill, BOL = Bill of Lading, COO = Certificate of Origin, COA = Certificate of Analysis, GAN = Goods Availability Notice. <br>Note if a page includes text like &#39;Packing List&#39; towards the top of the page it is likely a part of a &quot;Packing List&quot; component document, it is not a part of some other component document, &amp; if a page includes &#39;Invoice&#39; or &#39;Commercial Invoice&#39; or &#39;Final Invoice&#39; towards the top of the page is is likely a part of an &quot;Invoice&quot; component document, &amp; if a page includes &#39;Certificate of Origin&#39; towards the top of the page is is likely a part of a &quot;Certificate of Origin&quot; component document, &amp; if a page includes &#39;Certificate of Analysis&#39; towards the top of the page is is likely a part of a &quot;Certificate of Analysis&quot; component document. <br>I also included a json array of labels found on each page between [Merged File Page Labels Start] &amp; [Merged File Page Labels End]. Whenever an exact match for a FileType label is found in a page text it will show that label in the comma-separated list next to the Page#, except for Invoice as an &#39;Invoice&#39; label may often be found on multiple component documents that list their related invoice number. So if a Merged File Page Labels array is like [{&quot;Page1&quot;:&quot;Packing List&quot;,&quot;Page2&quot;:&quot;&quot;,&quot;Page3&quot;:&quot;Certificate of Origin&quot;,&quot;Page4&quot;:&quot;Certificate of Origin&quot;,&quot;Page5&quot;:&quot;Certificate of Analysis&quot;}] then Page1 is likely part of a &quot;Packing List&quot; component document &amp; since the labels list goes from blank/no label to another label of &quot;Certificate of Origin&quot; on Page3 it is likely Page3 is the start of a new component document &amp; since it changes from one label like &quot;Certificate of Origin&quot; on Page4 to another label like &quot;Certificate of Analysis&quot; on the next page, Page5, that likely means there is a new component document split starting on Page5. Not all component documents will be clearly labeled with their FileType, so still make your best guess at the FileType if there are no explicit labels, DO NOT just default to &quot;Other&quot; whenever a document has some empty labels like &quot;Page2&quot;:&quot;&quot;, still make educated guesses based on the document text.  <br>Note Packing Lists can be multiple pages so if the end of one Packing List page is some product lines &amp; the start of the next page is more product lines then that is likely the same Packing List, different Packing Lists will also have different packing-list/exporter-reference/reference numbers, so if Packing List pages in question have the same reference numbers they are parts of the same Packing List &amp; if packing list pages have different reference number values they are different Packing Lists.<br><br>Each Invoice number in the output JSON array must match an Invoice number found on one of the Invoice files. Do not use Invoice numbers not found in the Invoice files provided.<br>Sometimes a user may upload multiple invoice files &amp; one of the related files, like the Packing List, will refer to more than one Invoice number from the provided invoice files. When a file is related to more than one invoice, use each Invoice number in the Invoice input string separated by a | bar character like &quot;Inv123|Inv456&quot;.<br>Any reference number starting with PO or IO &amp; ending with 8 digits, like PO12345678 is a Purchase Order number, not an Invoice number. Do not use a Purchase Order number as an Invoice number in the output json.<br>A &quot;Forwarder Certificate of Receipt&quot; may not include an Invoice number, so please attempt to infer the Invoice number from surrounding files and by  determining which Packing List date is closest to the &quot;Forwarder Certificate of Receipt&quot; Shipment Pick Up Date so you can use the invoice number related to that Packing List with the closest date.<br>A &quot;Proof of Delivery&quot; component file may directly reference an Invoice or it may reference a &quot;Bill of Lading&quot; or &quot;Airway Bill&quot; component file that then references the Invoice for the &quot;Proof of Delivery&quot;. If the &quot;Proof of Delivery&quot; file or related BOL/AWB files do not directly reference an Invoice number then attempt to determine the Invoice number based on what &quot;Invoice&quot; file has the closest products/order lines, recipient address, &amp; dates.<br>A &quot;Goods Availaiblity Notice&quot; is a file indicating goods are ready. &quot;Goods Availaiblity Notice&quot; may be something like an email thread between Chemonics staff &amp; supplier staff. &quot;Goods Availaiblity Notice&quot; may not include an Invoice number, so please attempt to infer the Invoice number from surrounding files.<br>If you are extremely unsure what the correct Invoice number is for a file &amp; it is impossible to infer one from data on surrounding files, then use a null value for that Invoice input.<br><br>Do not take blank pages to be separate component documents, blank pages are a part of whatever component document coming before them.<br><br><br>Example output JSON when a big merged file&#39;s pages 1-3 are a Packing List for two invoices, pages 4-6 are an Invoice, pages 7-9 are another Invoice, &amp; the remaining pages are some &quot;Other&quot; document not explicitly listed in instructions above...<br>{<br>&quot;result&quot;:<br>[<br>{<br>&quot;Invoice&quot;: &quot;Inv123|Inv456&quot;,<br>&quot;FileType&quot;: &quot;Packing List&quot;,<br>&quot;FileStart&quot;: 1<br>},<br>{<br>&quot;Invoice&quot;: &quot;Inv123&quot;,<br>&quot;FileType&quot;: &quot;Invoice&quot;,<br>&quot;FileStart&quot;: 4<br>},<br>{<br>&quot;Invoice&quot;: &quot;Inv456&quot;,<br>&quot;FileType&quot;: &quot;Invoice&quot;,<br>&quot;FileStart&quot;: 7<br>},<br>{<br>&quot;Invoice&quot;: &quot;Inv456&quot;,<br>&quot;FileType&quot;: &quot;Other&quot;,<br>&quot;FileStart&quot;: 10<br>}<br>]<br>}<br><br><br>[Merged File Text Start]<br>Start ~Page|1|~<br>Start File Name: 071 5337 2023.pdf<br><br>              071         BOM         5337 2023                                                                                                                      071-5337 2023<br><br>         Shipper&#39;s Name and Address                              Shipper&#39;s Account Number        Not negotiable              ETHIOPIAN AIRLINES<br>                 ABC LABORATORIES LIMITED                                                        Atr Waybill<br>                                                                                                (Air Consignment nale)<br>               PLOT NO.555/A/22, ROAD NO.99.                                                      ISSUED BY<br>               MELLOW MEADOWS, HYDERABAD,<br>               TELANGANA, 555555<br>...<br>                                           Rata Class               Chargeable                                    Total                          Nature and Quantity of Goods<br>            No. of Places       Walghe       Kg Lb     Commodity                Weight        Rane<br>             RCP                             lam No.                                         Charge                                              (Incl. Dimension or Volume)<br><br><br>            13             2691.560   K                                   2692.0               414.00                1114488.00        ADVIL 300 MG + ALIEVE 100MG)<br>                                                                                                                                   TABLETS (30&#39;S)<br>                                                                                                                                     QUANTITY: 23986.000 PACKS<br><br>                                                                                                                                    HS CODE:30049099<br><br>                  SHIP TO ADDRESS: ABUJA WAREHOUSE                                                                    INVOICE NO.MH2722402398 DT: 16.08.2024<br>                   PLOT @ xxxxxxxxxxxxxxxxx INDUSTRIAL AREA                                                             SB NO: 3306457 DT: 19.06.2024<br>               NEXT TO xxxxxxxxxxxxx, NIGERIA<br>                 TEL: xxxxxxxxxxxx xxxxxxxxxxxx@LOGISTICS,NET                                                              DIMNS .: CMS<br>                NOTIFY: SIMON ENAJEDU UPON ARRIVAL @ xxxxxxxxxxxxxxxx                                                               1=120x80x86, 12=120x80x120<br><br><br><br><br>End File Name: 071 5337 2023.pdf<br>End ~Page|1|~<br><br>Start ~Page|2|~<br><br>Start File Name: 5851.pdf<br><br>                                                                                                                                                                                                              071-5484 5851<br>                          071         BOM        5484 5851<br>               Shipper&#39;s Name and Address                          Shipper&#39;s Account Number Not negotiable<br>                                                                                                                                                            ETHIOPIAN AIRLINES<br>                                                                                                                              Air Waybill<br>                       ABC LABORATORIES LIMITED<br>                                                                                                                         (Air Consignment note)<br>                     PLOT NO.555/A/22, ROAD NO.99,<br>                                                                                                                              ISSUED BY<br>                      MELLOW MEADOWS, HYDERABAD,<br><br>                       TELANGANA, 555555<br><br>                                                                                                     Copies 1,2 and 3 of the Air Waybill are originals and have the same validity.<br><br><br>...<br> Airport of Departure (Addr. of first Carrier) and requested Routing<br>                       MUMBAI<br><br>                                                                                                                                                    WT/VAL   Other                           Declared Value For Customs<br>                         To By First Carrier Routing and Destination To       By     To       By   Currency CHGS                       Declared Value For Carriage<br>                                                                                                                                                   PPD COLL PPD COLL<br>                                                                                                                                         Code<br>                        ABV                           ET                                                                                                                             NVD                   NCV     <br>                                                                                                                                INR       PP     X           X<br>                                                                                        Flight/Date                                                   INSURANCE  -  If  Carrieroffers  insurance  ans  such  insurance  is<br>                 Airport of Destination                                                                           Amount of Insurance<br>                                                                                                                                         requested in accordance with the conditions thereof, Indicate amount to be<br>                       ABUJA                                                                                                           XXX<br>                                                                                                                                               insured in fiqures in box marked Amount of Insurance<br><br>                 Handling Information                  PLEASE INFORM CONSIGNEE IMMEDIATELY ON ARRIVAL OF CARGO<br><br>                       MARKS: XXXXX PLOT xxxx xxxxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx ABUJA,NIGERIA<br>                                                                                                                                                                                                                        SCI<br>                      THE MISSION DIRECTOR (TOTAL 240 SHIPPER&#39;S PACKED IN 14 PALLETS ONLY)<br>                      SHIPPER&#39;S NON HAZ CERTIFICATE ATTACHED //<br>                                                          Rate Class<br>                     No. of       Gross       Kg                              Chargeable    Rate                              Total                        Nature and Quantity of Goods<br>                                                             Commodity<br>                     Pieces      Weight      Lb                                  Weight<br>                                                                                                                        Charge                                                (Incl. Dimension or Volume)<br>                                                             Item No.<br>                        RCP<br><br>                                                                                                                                                                  ADVIL 300 MG + ALIEVE 100 MG)<br>                                                                                                                                                                    TABLETS (30&#39;S)<br>                       14             2907.760  K    Q                                  2908.0              414.00              1203912.00<br>                                                                                                                                                                   QUANTITY: 25920.000 PACKS<br>                                                                                                                                                                    HS CODE:30049099<br><br><br>...<br>                                                                                                                                                                    DIMNS.: CMS<br>                 NOTIFY: SIMON ENAJEDU UPON ARRIVAL @ xxxxxxxxxxxxxxxx<br>                                                                                                                                                                  13=120x80x116, 1=120x80x48<br>                  SB.No.:  SB.Dt.:<br>              Inv.No.: MH2722403908 Inv.Dt.: 03.Dec.2024<br><br><br><br><br>                       14              2907.760                                                                                            1203912.00<br><br>                    \    Prepaid  / \      Weight Charge      / \   Collect   / Other Charges<br>                                       1203912.00                                              AWB : 150.00,  PCA : 250.00<br>                                          \                                  /<br>                                                Valuation Charge<br><br><br><br>                                         \              Tax              /<br>                                                                                                    AWC : 800.00,  AWC : 750.00,  CTG : 7270.00,  AEC : 2443.00,  FSC : 127952.00<br>                                                                                                    MISC : 2908.00,  XRAY : 10178.00,  NRC : 24134.00,  MZC : 7240.00<br>                                                                  Shipper certifies that the particulars on the face hereof are correct and that insofar as any part of the consignment contains<br>                                       \ Total other Charges Due Agent /<br>                                                                       dangerous goods, such part is properly described by name and is in proper condition for carriage by air according to the<br>                                             400.00<br>                                                                                           applicable Dangerous Goods Registrations.<br>                                    Total other Charges Due Carrier<br>                                      \                                          /<br>                                        183675.00<br>                                                                                                                                                   xxxxxxxx LOGISTICS PVT LTD<br><br>                                                                                                                                             Signature of Shipper or his Agent<br><br>                      \      Total Prepaid       / \       Total Collect      /<br>                                                                                                                                                                                                                      As Agent for<br>                                       1387987.00<br>                     Currency Conversion Rates                                             03-Dec-2024                         MUMBAI                                           ETHIOPIAN AIRLINES<br>                     \                                   / \ cc charges in Dest Currency /<br>                                                                                                 Executed  On  (Date)              at (Place)                         Signature of  Issuing  Carrier or its Agent<br><br>                         For Carrier Use Only      Charges at Destination /   Total Collect Charges<br>                                                              \                                     \                                  /<br>                                                                                                                                                                                                               071-5484 5851<br>                              at Destination<br>End File Name: 5851.pdf<br>End ~Page|2|~<br><br>...<br>...<br><br>Start ~Page|10|~<br>Start File Name: MH2722402398_P.pdf<br><br>                                                                                                       PACKING LIST<br>      EXPORTER:                                                                           DELIVERY NO / DT :  13089148 / 08/01/2024 CIN:  U24231TG1984PLC005146<br> ABC Laboratories Limited                                                      INVOICE NO &amp; DATE                                     EXPORTER&#39;S REF:<br>  Plot No 555/A/22<br>                                                                                               MH2722402398                                             3333333 07/29/2024<br> Road No 92, MELLOW MEADOWS,<br>                                                                                              08/16/2024                                               Finance Ref.: 99999999 08/16/2024<br>   Hyderabad-555555<br>                                                                                               PO NO:  PO10028332                                    DT:  03/27/2024<br>  Telangana,India<br>                                                                                                  OTHER REFERENCE(S):                                 VAT REG:<br><br>...<br><br><br>       PRE CARRIAGE BY                  PLACE OF RECEIPT BY<br>      ROAD                                   NASHIK<br><br>       VESSEL/FLIGHT NO                 PORT OF LOADING<br><br>    AIR                                      MUMBAI<br>       PORT OF DISCHARGE              PLACE OF DELIVERY<br><br>     ABUJA                                  NIGERIA<br>                                                                                                              Total<br>        DESCRIPTION OF GOODS        BATCH No      QTY/SHP     NO.       SHIP. NO                     MFG.       EXP          GR. WT/SHIP. NET                   DIM(LxWxH)<br>                                                                                                                Quantity<br>       / MATERIAL CODE                                    PER            OF                                          DATE       DATE                              WT/SHIP.<br>                                                                    PACK         SHIP<br><br> ADVIL 300Mg + ALIEVE  3216636                                  0001-0222                  05/19/202 04/30/202                                1,414.58  320x300x330M<br>                                                                                                                   23,976                                        2,469.53<br> 100Mg) Tablets (30&#39;s) /                             108            222                                             4            7                                                              M<br>    400557443<br> ADVIL 300Mg + ALIEVE  3216636                             1   0223-0223                  05/19/202 04/30/202                                               320x300x330M<br>                                                                                                                        10                                                1.03                0.59 <br> 100Mg) Tablets (30&#39;s) /                             10                                                                4            7                                                              M<br>    400557443<br>  Total /<br>                                                                                                                   23,986                                        2,470.56          1,415.17<br>                                                                                   223<br><br><br>    PL No  Material Code               DESCRIPTION OF GOODS                         BATCH No         TOT NO.      SHIP. NO    GR. WT             GR. WT W/O         DIM<br>                                                                                                                                OF SHIP.                       WITH PAL         PAL WT            (LxWxH)<br><br>           1   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0001-0018                                    200.23  1200x800x1<br>                                                                                                                                                                              217.23<br>                                            Tablets (30&#39;s)                                                                                                                                                 160MM<br>           2   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0019-0036                                              1200x800x1<br>                                                                                                                                                                              217.23            200.23 <br>                                            Tablets (30&#39;s)                                                                                                                                                 160MM<br><br>           3   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0037-0054                                    200.23  1200x800x1<br>                                                                                                                                                                              217.23<br>                                            Tablets (30&#39;s)                                                                                                                                                 160MM<br><br>           4   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0055-0072                                    200.23  1200x800x1<br>                                                                                                                                                                              217.23<br>                                            Tablets (30&#39;s)                                                                                                                                                 160MM<br>           5   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0073-0090                                              1200x800x1<br>                                                                                                                                                                              217.23            200.23 <br>                                            Tablets (30&#39;s)                                                                                                                                                 160MM<br><br>           6   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0091-0108                                    200.23  1200x800x1<br>                                                                                                                                                                              217.23<br>                                            Tablets (30&#39;s)                                                                                                                                                 160MM<br>           7   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0109-0126                                              1200x800x1<br>                                                                                                                                                                              217.23            200.23 <br>                                            Tablets (30&#39;s)                                                                                                                                                 160MM<br><br>End ~Page|10|~<br><br>Start ~Page|11|~<br><br><br>        PL No  Material Code               DESCRIPTION OF GOODS                         BATCH No         TOT NO.      SHIP. NO    GR. WT             GR. WT W/O         DIM<br>                                                                                                                                    OF SHIP.                       WITH PAL         PAL WT            (LxWxH)<br>               8   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0127-0144                                              1200x800x1<br>                                                                                                                                                                                  217.23            200.23 <br>                                               Tablets (30&#39;s)                                                                                                                                                 160MM<br><br>               9   400557443             ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0145-0162                                    200.23  1200x800x1<br>                                                                                                                                                                                  217.23<br>                                               Tablets (30&#39;s)                                                                                                                                                 160MM<br>              10 400557443              ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0163-0180                                              1200x800x1<br>                                                                                                                                                                                  217.23            200.23 <br>                                               Tablets (30&#39;s)                                                                                                                                                 160MM<br><br>              11 400557443              ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0181-0198                                    200.23  1200x800x1<br>                                                                                                                                                                                  217.23<br>                                               Tablets (30&#39;s)                                                                                                                                                 160MM<br><br>              12 400557443              ADVIL 300Mg + ALIEVE 100Mg)          3216636             18       0199-0216                                              1200x800x1<br>                                                                                                                                                                                  217.23            200.23 <br>                                               Tablets (30&#39;s)                                                                                                                                                 160MM<br>              13 400557443              ADVIL 300Mg + ALIEVE 100Mg)          3216636              7        0217-0223                                              1200x800x8<br>                                                                                                                                                                                    84.77              67.77 <br>                                               Tablets (30&#39;s)                                                                                                                                                 20MM<br><br>                                                  Total                                                                                223<br>                                                                                                                                                                               2,691.56          2,470.56<br><br><br><br>        DATE                                                                                                      SIGNATURE<br>End File Name: MH2722402398_P.pdf<br>End ~Page|11|~<br><br>Start ~Page|12|~<br>Start File Name: MH2722500422_I.pdf<br><br>                                                                                                                   COMMERCIAL INVOICE<br>                   EXPORTER:                                                                                                    INVOICE NO.&amp; DATE                     EXPORTER&#39;S REF:3333333<br>               ABC Laboratories Limited,                                                                                                                         DT: 07/29/2024<br>                                                                                                                                     MH2722500422<br>                Plot No 555/A/22,                                                                                                                                      Finance Ref.: 9999999<br>                                                                                                                                   DT.05/06/2025<br>              Road No 92, MELLOW MEADOWS,,<br>                  Hyderabad-555555,                                                                                         BUYERS ORDER NO &amp; DATE:<br>                Telangana,India.                                                                                        PO10028332 03/27/2024<br><br>                                                                                                                                   OTHER   REFERENCE(S): PL/261/2025<br>                                                                                                                                  DT:05/02/2025<br>                                                                                 TERMS OF PAYMENT: DA 045 DAYS FROM AWB DATE<br><br>                                                                                                                                     TERMS OF DELIVERY: DDP     Air Abuja, Nigeria<br><br><br>                                                                                                                                   NOTIFY:<br>                    PRE CARRIAGE BY                              PLACE OF RECEIPT BY                         BANK DETAILS:<br>                   ROAD                                                 NASHIK                                          Account name: ABC Laboratories Limited<br>                                                                                                                             Bank name: Australia Group<br>                                                                                                                             Bank address or branch location: Mumbai, India<br>                    VESSEL/FLIGHT NO                              PORT OF LOADING                             Account number: 000000000000<br>                   BY AIR                                               MUMBAI<br><br><br>                     PORT OF DISCHARGE                           PLACE OF DELIVERY<br>                   ABUJA                                              NIGERIA<br><br><br>                    MARKS &amp; NOS/                          NO.&amp; KINDS OF              DESC OF GOODS                                            QUANTITY          RATE (USD)/       AMOUNT<br>                    CONTAI N ER No.                       PACKAGES                                                                                     (PACKS)             UNIT                (USD)<br>                                                              6 Pallets                ADVIL 300Mg + ALIEVE 100Mg) Tablets     10,622.000    11.45 /PACK       121,621.90<br>                                                               99 Shippers               (30&#39;s)<br>                                                                1 to 99                     Mfg:10/22/2024 Exp: 09/30/2027<br>                                                                                                 Batch :3237508<br>                                                                                                Packs : 30&#39;S BOTTLE<br>                                                                                               Quantity : 318,660 Nos<br><br>                    TOTAL NO OF PALLETS :           6 NOS<br>                   TOTAL NO OF SHIPPERS :         99 NOS<br>                    TOTAL GROSS WEIGHT :           1,196.07 KG<br>                     TOTAL NET WEIGHT       :           626.70 KG<br>                    PALLET DIMENSION : 1200x800x820 MM:1Nos , 1200x800x1160 MM:5Nos<br><br><br>                                                                                                                                                                                                     Total :     121,621.90<br>            Amount Chargeable(in words): One Hundred Twenty-One Thousand Six Hundred Twenty-One US Dollars<br>                And Ninety Cents Only.<br><br>                RBI Code No.:HH-000185 I.E.C.No.:0988008858<br>                                                                                                                                                                                     Signature and Date<br> Declaration:We declare that this invoice shows the actual price of the goods described and that all particulars<br>                are true and   correct.<br>End File Name: MH2722500422_I.pdf<br>End ~Page|12|~<br><br>...<br>...<br><br>Start ~Page|17|~<br>Start File Name: MH2722402398_I.pdf<br><br>                                                                                                                   COMMERCIAL INVOICE<br>                   EXPORTER:                                                                                                    INVOICE NO.&amp; DATE                     EXPORTER&#39;S REF:3333333<br>               ABC Laboratories Limited,                                                                                                                         DT: 07/29/2024<br>                                                                                                                                     MH2722402398<br>                Plot No 555/A/22,                                                                                                                                      Finance Ref.: 99999999<br>                                                                                                                                   DT.08/16/2024<br>              Road No 92, MELLOW MEADOWS,,<br>                  Hyderabad-555555,                                                                                         BUYERS ORDER NO &amp; DATE:<br>                Telangana,India.                                                                                        PO10028332 03/27/2024<br><br>                                                                                                                                   OTHER   REFERENCE(S):<br>                                                                                                                                  PL/1703/2024<br>...<br><br>                                                                                                                                   NOTIFY:<br>                    PRE CARRIAGE BY                              PLACE OF RECEIPT BY<br>                   ROAD                                                 NASHIK<br><br><br>                    VESSEL/FLIGHT NO                              PORT OF LOADING<br>                   BY AIR                                               MUMBAI<br><br><br>                     PORT OF DISCHARGE                           PLACE OF DELIVERY<br>                   ABUJA                                              NIGERIA<br><br><br>                    MARKS &amp; NOS/                          NO.&amp; KINDS OF              DESC OF GOODS                                            QUANTITY          RATE (USD)/       AMOUNT<br>                    CONTAI N ER No.                       PACKAGES                                                                                     (PACKS)             UNIT                (USD)<br>                                                              13 Pallets              ADVIL 300Mg + ALIEVE 100Mg) Tablets     23,986.000    11.45 /PACK       274,639.70<br>                                                               223 Shippers             (30&#39;s)<br>                                                                1 to 223                   Mfg:05/19/2024 Exp: 04/30/2027<br>                                                                                                 Batch :3216636<br>                                                                                                Packs : 30&#39;S BOTTLE<br>                                                                                               Quantity : 719,580 Nos<br><br>                    TOTAL NO OF PALLETS :          13 NOS<br>                   TOTAL NO OF SHIPPERS :        223 NOS<br>                    TOTAL GROSS WEIGHT :           2,691.56 KG<br>                     TOTAL NET WEIGHT       :         1,415.17 KG<br>                    PALLET   DIMENSION  : 1200x800x820 MM:1Nos , 1200x800x1160  MM:12Nos<br>...<br><br>                                                                                                                                                                                                     Total :     274,639.70<br>           Amount Chargeable(in words): Two Hundred Seventy-Four Thousand Six Hundred Thirty-Nine US Dollars<br>                And Seventy Cents Only.<br><br>                RBI Code No.:HH-000185 I.E.C.No.:0988008858<br>                                                                                                                                                                                     Signature and Date<br> Declaration:We declare that this invoice shows the actual price of the goods described and that all particulars<br>                are true and   correct.<br>End File Name: MH2722402398_I.pdf<br>End ~Page|17|~<br><br>...<br>...<br><br>Start ~Page|21|~<br><br>Start File Name: POD F 25086114 (AWB 235 1154 1154).pdf<br><br>                                                                                                                                 ICD OPERATIONS DEPARTMENT<br><br>                                                                                                                                                     WAYBILL<br><br>                                                                                                                        Document Nº:AGL-NGA-WAR-F-0397Rav 1<br> XXXXX XXXXXX LOGISTICS<br><br>                                                                                            ABUJA XXXXXX XXXXXXXX WAREHOUSE,<br>    File No. 25086114<br><br> Port Ag            APA-ABUJA                                ABUJA.                                                                              No 018638<br>                      1-05-2025<br><br><br> JOB ORDER NO:<br>                                   POH: 10028332<br><br><br><br>        The following goods have been received in good order and condition for transport<br><br>     By AGL                                                                                                   KUL 21 24<br><br>        n. NALA                                                             to ABUJA PREMIER MÉDICAL WAREHOUSE<br> From ..<br><br><br>      Marks                   Packages                               Description of goods                             Weight                      Remarks<br><br><br><br>                               6                                        ADVIL +                                  1,166 KG                   DELIVERED<br>   XXXXX<br><br>   SHIPMENT                                                   300MG                                                                             INTACT<br><br><br>                                                                         ALIEVE 100MG<br><br> AUBA:                                                      TABLETS<br><br>   235-1154<br><br><br> 1154<br><br><br><br><br>             INVOICE NUMBER:                                            MH2722500422<br><br><br><br><br><br>                                                                                                                                   3 0 MAY 2025<br>                                NAME:                                xxxxxxxxxxxxxxxxx<br>                                                                                                                            DELIVERY<br>                                                   DESIGNATION Ing<br><br>                                                                                                            MDS LOGISTICS / HALOGEN SECURITY<br>                                            SIGNATURE:// Sugar.<br><br>                               DATE:<br>                                                                  30 + 00 SAY 2320 2 5<br>                                STAMP:<br><br><br>                                                                      Sign .....<br>                                                                     PIECE       N<br><br>                                                        IN                       OUT              Offloading<br><br><br> LORRY: Shed in ....... Out ............ Customer&#39;s premises Date ..       .Hour            Date ..       Hour.     .. Made by ......... Staff<br><br><br><br> For: XXXXX XXXXXX LOGISTICS NIG LTD            DRIVER                   Received in good order and condition/with the following remarks           On the.<br> OGURIDIRE                                                                        6 pallets received mut<br>                                                                                 quantifies not verify                                      Receiver stamp &amp; sign<br>   SOLOMON++<br> Note: All goods are received, forwadled and subject to the company&#39;s printed conditions of business, to be obtained on application. Insurance only covered upon receipt of<br> written instructions.<br><br>                         White: Customer                           Green: Transport Pink: T&amp;L Dept. Yellow: Counter Foil.<br><br><br><br><br> Document Nº:AGL-NGA-WAR-F-0397Rev 1<br> This Document is uncontrolled when printed                                                                                                              GL<br>                                                                                                                                         XXXXX XXXXXX LOGISTICS<br><br><br><br><br><br>End File Name: POD F 25086114 (AWB 235 1154 1154).pdf<br>End ~Page|21|~<br><br><br>[Merged File Text End]<br><br>[Merged File Page Labels Start]<br>[{&quot;Page1&quot;:&quot;Airway Bill&quot;},{&quot;Page2&quot;:&quot;Airway Bill&quot;},{&quot;Page3&quot;:&quot;&quot;},{&quot;Page4&quot;:&quot;Packing List&quot;},{&quot;Page5&quot;:&quot;&quot;},{&quot;Page6&quot;:&quot;&quot;},{&quot;Page7&quot;:&quot;Airway Bill&quot;},{&quot;Page8&quot;:&quot;&quot;},{&quot;Page9&quot;:&quot;&quot;},{&quot;Page10&quot;:&quot;Packing List&quot;},{&quot;Page11&quot;:&quot;&quot;},{&quot;Page12&quot;:&quot;&quot;},{&quot;Page13&quot;:&quot;Packing List&quot;},{&quot;Page14&quot;:&quot;&quot;},{&quot;Page15&quot;:&quot;Packing List&quot;},{&quot;Page16&quot;:&quot;&quot;},{&quot;Page17&quot;:&quot;&quot;},{&quot;Page18&quot;:&quot;&quot;},{&quot;Page19&quot;:&quot;&quot;},{&quot;Page20&quot;:&quot;&quot;},{&quot;Page21&quot;:&quot;&quot;}]<br>[Merged File Page Labels End]<br><br><br>[Final Review Start]<br>And before you finalize the output result json array, please do the following:<br>Review the instructions at the start of this prompt.<br>Check the json records make sense &amp; will represent the full file text if the file texts are split at the start of each FileStart page. For example if a json record suggests a full component Invoice, Packing List, or Proof of Delivery document will not include any product names then it is likely wrong. <br>Check if there is any missing data in the response json, like &quot;Invoice&quot; number that can be filled using the file texts &amp; data provided. <br>Check if the FileTypes look correct. Check if any FileTypes do not relate to labels in their file names or do not relate to file type labels on their 1st FileStart page text.<br>Check the Merged File Page Labels Start json array, if the labels for a page don&#39;t include the FileType listed in the json record but do include other FileTypes, then something is likely be wrong.<br>Check if any FileType &quot;Other&quot; records might actually be one of the explicitly listed FileTypes.<br>Check if the FileStart page number looks correct for each component file record. Double-check that there are no duplicate FileStart numbers. If there are original, pre-merge page numberings, check if the FileStart numbers for the component document records make sense, like if some of the records need their FileStart numbers fixed because the orginal file page numberings reset from page 4 to page 1 or page 2 to no page# in the middle of a specified component document text. <br>Check if any of the response json field values look incorrect like if the Invoice identifier for a json record does not match an explicit Invoice identifier listed in the related file text or, in cases without any explicit Invoice identifiers in related file text, double check the output with the instructed criteria for best guessing the Invoice number for that FileType.<br>[Final Review End]</pre><h3>Example Output After Sort, Index, &amp; Error Correction</h3><pre>[<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722402398&quot;,<br>    &quot;FileType&quot;: &quot;Airway Bill&quot;,<br>    &quot;FileStart&quot;: 1,<br>    &quot;ObjectIndex&quot;: 0<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722403908&quot;,<br>    &quot;FileType&quot;: &quot;Airway Bill&quot;,<br>    &quot;FileStart&quot;: 2,<br>    &quot;ObjectIndex&quot;: 1<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722403087&quot;,<br>    &quot;FileType&quot;: &quot;Airway Bill&quot;,<br>    &quot;FileStart&quot;: 3,<br>    &quot;ObjectIndex&quot;: 2<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722403087&quot;,<br>    &quot;FileType&quot;: &quot;Packing List&quot;,<br>    &quot;FileStart&quot;: 4,<br>    &quot;ObjectIndex&quot;: 3<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722500422&quot;,<br>    &quot;FileType&quot;: &quot;Airway Bill&quot;,<br>    &quot;FileStart&quot;: 7,<br>    &quot;ObjectIndex&quot;: 4<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722403087&quot;,<br>    &quot;FileType&quot;: &quot;Invoice&quot;,<br>    &quot;FileStart&quot;: 8,<br>    &quot;ObjectIndex&quot;: 5<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722403908&quot;,<br>    &quot;FileType&quot;: &quot;Invoice&quot;,<br>    &quot;FileStart&quot;: 9,<br>    &quot;ObjectIndex&quot;: 6<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722402398&quot;,<br>    &quot;FileType&quot;: &quot;Packing List&quot;,<br>    &quot;FileStart&quot;: 10,<br>    &quot;ObjectIndex&quot;: 7<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722500422&quot;,<br>    &quot;FileType&quot;: &quot;Invoice&quot;,<br>    &quot;FileStart&quot;: 12,<br>    &quot;ObjectIndex&quot;: 8<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722403908&quot;,<br>    &quot;FileType&quot;: &quot;Packing List&quot;,<br>    &quot;FileStart&quot;: 13,<br>    &quot;ObjectIndex&quot;: 9<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722500422&quot;,<br>    &quot;FileType&quot;: &quot;Packing List&quot;,<br>    &quot;FileStart&quot;: 15,<br>    &quot;ObjectIndex&quot;: 10<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722402398&quot;,<br>    &quot;FileType&quot;: &quot;Invoice&quot;,<br>    &quot;FileStart&quot;: 17,<br>    &quot;ObjectIndex&quot;: 11<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722402398&quot;,<br>    &quot;FileType&quot;: &quot;Proof of Delivery&quot;,<br>    &quot;FileStart&quot;: 18,<br>    &quot;ObjectIndex&quot;: 12<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722403087&quot;,<br>    &quot;FileType&quot;: &quot;Proof of Delivery&quot;,<br>    &quot;FileStart&quot;: 19,<br>    &quot;ObjectIndex&quot;: 13<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722403908&quot;,<br>    &quot;FileType&quot;: &quot;Proof of Delivery&quot;,<br>    &quot;FileStart&quot;: 20,<br>    &quot;ObjectIndex&quot;: 14<br>  },<br>  {<br>    &quot;Invoice&quot;: &quot;MH2722500422&quot;,<br>    &quot;FileType&quot;: &quot;Proof of Delivery&quot;,<br>    &quot;FileStart&quot;: 21,<br>    &quot;ObjectIndex&quot;: 15<br>  }<br>]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea8c98004fc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Easy Aggregations (Logic Apps & Power Automate)]]></title>
            <link>https://medium.com/@takolota/easy-aggregations-logic-apps-power-automate-169ae5a7c69a?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/169ae5a7c69a</guid>
            <category><![CDATA[json]]></category>
            <category><![CDATA[power-automate]]></category>
            <category><![CDATA[power-platform-developers]]></category>
            <category><![CDATA[aggregation]]></category>
            <category><![CDATA[azure-functions]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Sun, 13 Apr 2025 16:39:02 GMT</pubDate>
            <atom:updated>2025-04-13T16:40:01.130Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a part of the <a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=a5255ced-dc08-f011-bae3-6045bdf03fcb">File &amp; Utility Functions</a> series.<br>An Azure Function to get the sum, count, min, max, avg, median, or standard deviation of fields in a JSON array.</p><p>There is <a href="https://youtu.be/z5MxbwURV68?si=9E8e7QAbKqIB41RH">a way</a> to efficiently do aggregations in Power Automate, but it requires setting up the data as XML &amp; then writing more complicated XPath expressions. This Azure Function allows one to more simply list the field names one wants under a certain aggregation in an HTTP call &amp; get back a JSON object with said aggregations.</p><h3>Basic JSON Array Aggregations Example</h3><p>Inputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*1Qad1M5H-uA2_wAmU3liKw.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*aoy6VRUitYxaIT48qO6qqQ.png" /></figure><p>So we input arrays of names matching our JSON column names under count, min, max, avg, med, &amp; stdev parameters. Then we got each of those columns we listed with a count, min, max, avg, med, or stdev prefix in our output along with their count, min, max, avg, med, &amp; stdev values.</p><h3>Array of JSON Arrays Example</h3><p>In some cases, like after using a <a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=ca4f8861-f09a-ef11-8a69-7c1e524a2e12">Python For Each Filter</a> function, you may have an array of JSON arrays you want to get aggregations for. Well the same aggregations function will automatically detect if your data is an array of JSON arrays &amp; output a single JSON array where each JSON object in the output array is related to one of the JSON arrays in your input array of JSON arrays.</p><p>Inputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*RS2nUreupNG-wMzs6l7PQA.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*7if4uDYoDB4kOgNSX5PISQ.png" /></figure><p>So instead of inputting a single JSON array, we input an array of JSON arrays &amp; in the output we got the same aggregation JSON objects for each input JSON array in their own JSON array. We could have put the array of JSON arrays in an Apply to Each / For Each loop &amp; called the function once in each loop run to get the same aggregations, but this may be more efficient in a lot of cases.</p><h3>Get This Function</h3><p>This function &amp; many other functions are available in one big import in the <a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=a5255ced-dc08-f011-bae3-6045bdf03fcb">File &amp; Utility Functions</a> package along with a template Power Automate flow showing how to use most of them. I recommend following the instructions to import the full package &amp; flow.</p><p>However if for some reason you just want the function from this blog…</p><p>requirements.txt</p><pre>numpy==1.26.4</pre><p>function_app.py</p><pre>import azure.functions as func<br>import logging<br>import json<br>import traceback<br>from typing import Dict, List, Any, Optional<br>from datetime import datetime<br>import numpy as np<br><br>app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)<br><br>@app.route(route=&quot;aggregations&quot;)<br>def aggregations(req: func.HttpRequest) -&gt; func.HttpResponse:<br>    try:<br>        # Get request body<br>        req_body = req.get_json()<br><br>        # Extract data and aggregation parameters<br>        data = req_body.get(&#39;data&#39;, [])<br>        min_cols = req_body.get(&#39;min&#39;, [])<br>        max_cols = req_body.get(&#39;max&#39;, [])<br>        sum_cols = req_body.get(&#39;sum&#39;, [])<br>        count_cols = req_body.get(&#39;count&#39;, [])<br>        avg_cols = req_body.get(&#39;avg&#39;, [])<br>        med_cols = req_body.get(&#39;med&#39;, [])<br>        stdev_cols = req_body.get(&#39;stdev&#39;, [])<br><br>        # Handle empty data<br>        if not data:<br>            return func.HttpResponse(json.dumps({}), mimetype=&quot;application/json&quot;)<br><br>        # Detect if data is an array of arrays or a single array<br>        is_array_of_arrays = all(isinstance(item, list) for item in data)<br><br>        # Process data accordingly<br>        if is_array_of_arrays:<br>            # Handle array of arrays case<br>            if all(len(arr) == 0 for arr in data):<br>                return func.HttpResponse(json.dumps([]), mimetype=&quot;application/json&quot;)<br><br>            results = []<br>            for data_array in data:<br>                result = process_aggregations(<br>                    data_array, min_cols, max_cols, sum_cols, <br>                    count_cols, avg_cols, med_cols, stdev_cols<br>                )<br>                results.append(result)<br><br>            return func.HttpResponse(json.dumps(results), mimetype=&quot;application/json&quot;)<br>        else:<br>            # Handle single array case<br>            result = process_aggregations(<br>                data, min_cols, max_cols, sum_cols, <br>                count_cols, avg_cols, med_cols, stdev_cols<br>            )<br><br>            return func.HttpResponse(json.dumps(result), mimetype=&quot;application/json&quot;)<br><br>    except Exception as e:<br>        error_details = traceback.format_exc()<br>        logging.error(f&quot;Error processing request: {str(e)}\nTraceback: {error_details}&quot;)<br>        return func.HttpResponse(<br>            json.dumps({&quot;error&quot;: str(e), &quot;Traceback&quot;: error_details}),<br>            status_code=400,<br>            mimetype=&quot;application/json&quot;<br>        )<br><br>def process_aggregations(<br>    data: List[Dict], <br>    min_cols: List[str], <br>    max_cols: List[str], <br>    sum_cols: List[str], <br>    count_cols: List[str], <br>    avg_cols: List[str], <br>    med_cols: List[str], <br>    stdev_cols: List[str]<br>) -&gt; Dict:<br>    &quot;&quot;&quot;<br>    Process all requested aggregations on the data.<br>    &quot;&quot;&quot;<br>    result = {}<br><br>    # Minimum aggregations<br>    for col in min_cols:<br>        result[f&quot;min_{col}&quot;] = calculate_min(data, col)<br><br>    # Maximum aggregations<br>    for col in max_cols:<br>        result[f&quot;max_{col}&quot;] = calculate_max(data, col)<br><br>    # Sum aggregations<br>    for col in sum_cols:<br>        result[f&quot;sum_{col}&quot;] = calculate_sum(data, col)<br><br>    # Count aggregations<br>    for col in count_cols:<br>        result[f&quot;count_{col}&quot;] = calculate_count(data, col)<br><br>    # Average aggregations<br>    for col in avg_cols:<br>        result[f&quot;avg_{col}&quot;] = calculate_avg(data, col)<br><br>    # Median aggregations<br>    for col in med_cols:<br>        result[f&quot;med_{col}&quot;] = calculate_median(data, col)<br><br>    # Standard deviation aggregations<br>    for col in stdev_cols:<br>        result[f&quot;stdev_{col}&quot;] = calculate_stdev(data, col)<br><br>    return result<br><br>def try_numeric_conversion(value):<br>    &quot;&quot;&quot;Attempt to convert a value to a numeric type if it&#39;s a string number.&quot;&quot;&quot;<br>    if not isinstance(value, str):<br>        return value<br><br>    try:<br>        # Try integer first<br>        return int(value)<br>    except ValueError:<br>        try:<br>            # Then try float<br>            return float(value)<br>        except ValueError:<br>            # Not a numeric string<br>            return value<br><br>def calculate_min(data: List[Dict], column: str) -&gt; Any:<br>    &quot;&quot;&quot;Calculate minimum value for a column across all data points.&quot;&quot;&quot;<br>    # Extract values and attempt numeric conversion for string numbers<br>    values = []<br>    for item in data:<br>        if item.get(column) is not None:<br>            values.append(try_numeric_conversion(item.get(column)))<br><br>    if not values:<br>        return None<br><br>    # Try to determine the type of values<br>    sample_value = values[0]<br><br>    if isinstance(sample_value, (int, float)):<br>        # Get only the numeric values (including converted string numbers)<br>        numeric_values = [v for v in values if isinstance(v, (int, float))]<br>        if not numeric_values:<br>            return None<br>        return min(numeric_values)<br>    elif isinstance(sample_value, bool):<br>        # Boolean min (False &lt; True)<br>        boolean_values = [v for v in values if isinstance(v, bool)]<br>        if not boolean_values:<br>            return None<br>        return False if False in boolean_values else True<br>    elif isinstance(sample_value, str):<br>        # Try to parse as date first<br>        try:<br>            # Attempt to parse dates<br>            date_values = []<br>            original_values = []<br>            for v in values:<br>                if isinstance(v, str):<br>                    try:<br>                        date_values.append(datetime.fromisoformat(v.replace(&#39;Z&#39;, &#39;+00:00&#39;)))<br>                        original_values.append(v)<br>                    except (ValueError, AttributeError):<br>                        pass<br><br>            if date_values:<br>                min_date = min(date_values)<br>                # Find the original string that corresponds to this date<br>                for i, date in enumerate(date_values):<br>                    if date == min_date:<br>                        return original_values[i]<br><br>            # If not dates or empty date_values, treat as strings<br>            string_values = [v for v in values if isinstance(v, str)]<br>            if not string_values:<br>                return None<br>            return min(string_values)<br>        except (ValueError, AttributeError):<br>            # If error in date parsing, treat as strings<br>            string_values = [v for v in values if isinstance(v, str)]<br>            if not string_values:<br>                return None<br>            return min(string_values)<br><br>    # Fallback<br>    return min(values, default=None)<br><br>def calculate_max(data: List[Dict], column: str) -&gt; Any:<br>    &quot;&quot;&quot;Calculate maximum value for a column across all data points.&quot;&quot;&quot;<br>    # Extract values and attempt numeric conversion for string numbers<br>    values = []<br>    for item in data:<br>        if item.get(column) is not None:<br>            values.append(try_numeric_conversion(item.get(column)))<br><br>    if not values:<br>        return None<br><br>    # Try to determine the type of values<br>    sample_value = values[0]<br><br>    if isinstance(sample_value, (int, float)):<br>        # Get only the numeric values (including converted string numbers)<br>        numeric_values = [v for v in values if isinstance(v, (int, float))]<br>        if not numeric_values:<br>            return None<br>        return max(numeric_values)<br>    elif isinstance(sample_value, bool):<br>        # Boolean max (True &gt; False)<br>        boolean_values = [v for v in values if isinstance(v, bool)]<br>        if not boolean_values:<br>            return None<br>        return True if True in boolean_values else False<br>    elif isinstance(sample_value, str):<br>        # Try to parse as date first<br>        try:<br>            # Attempt to parse dates<br>            date_values = []<br>            original_values = []<br>            for v in values:<br>                if isinstance(v, str):<br>                    try:<br>                        date_values.append(datetime.fromisoformat(v.replace(&#39;Z&#39;, &#39;+00:00&#39;)))<br>                        original_values.append(v)<br>                    except (ValueError, AttributeError):<br>                        pass<br><br>            if date_values:<br>                max_date = max(date_values)<br>                # Find the original string that corresponds to this date<br>                for i, date in enumerate(date_values):<br>                    if date == max_date:<br>                        return original_values[i]<br><br>            # If not dates or empty date_values, treat as strings<br>            string_values = [v for v in values if isinstance(v, str)]<br>            if not string_values:<br>                return None<br>            return max(string_values)<br>        except (ValueError, AttributeError):<br>            # If error in date parsing, treat as strings<br>            string_values = [v for v in values if isinstance(v, str)]<br>            if not string_values:<br>                return None<br>            return max(string_values)<br><br>    # Fallback<br>    return max(values, default=None)<br><br>def calculate_sum(data: List[Dict], column: str) -&gt; Optional[float]:<br>    &quot;&quot;&quot;Calculate sum of values for a column across all data points.&quot;&quot;&quot;<br>    numeric_values = []<br><br>    for item in data:<br>        if item.get(column) is not None:<br>            value = try_numeric_conversion(item.get(column))<br>            if isinstance(value, (int, float)):<br>                numeric_values.append(value)<br><br>    if not numeric_values:<br>        return None<br><br>    return sum(numeric_values)<br><br>def calculate_count(data: List[Dict], column: str) -&gt; int:<br>    &quot;&quot;&quot;Calculate count of non-null values for a column across all data points.&quot;&quot;&quot;<br>    return sum(1 for item in data if item.get(column) is not None)<br><br>def calculate_avg(data: List[Dict], column: str) -&gt; Optional[float]:<br>    &quot;&quot;&quot;Calculate average of values for a column across all data points.&quot;&quot;&quot;<br>    numeric_values = []<br><br>    for item in data:<br>        if item.get(column) is not None:<br>            value = try_numeric_conversion(item.get(column))<br>            if isinstance(value, (int, float)):<br>                numeric_values.append(value)<br><br>    if not numeric_values:<br>        return None<br><br>    return sum(numeric_values) / len(numeric_values)<br><br>def calculate_median(data: List[Dict], column: str) -&gt; Optional[float]:<br>    &quot;&quot;&quot;Calculate median of values for a column across all data points.&quot;&quot;&quot;<br>    numeric_values = []<br><br>    for item in data:<br>        if item.get(column) is not None:<br>            value = try_numeric_conversion(item.get(column))<br>            if isinstance(value, (int, float)):<br>                numeric_values.append(value)<br><br>    if not numeric_values:<br>        return None<br><br>    return float(np.median(numeric_values))<br><br>def calculate_stdev(data: List[Dict], column: str) -&gt; Optional[float]:<br>    &quot;&quot;&quot;Calculate standard deviation of values for a column across all data points.&quot;&quot;&quot;<br>    numeric_values = []<br><br>    for item in data:<br>        if item.get(column) is not None:<br>            value = try_numeric_conversion(item.get(column))<br>            if isinstance(value, (int, float)):<br>                numeric_values.append(value)<br><br>    if len(numeric_values) &lt; 2:  # Need at least 2 values for standard deviation<br>        return None<br><br>    return float(np.std(numeric_values, ddof=1))  # Using sample standard deviation</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=169ae5a7c69a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSV to JSON & Update CSV (Logic Apps & Power Automate)]]></title>
            <link>https://medium.com/@takolota/power-automate-csv-to-json-update-csv-b2653875bb6d?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2653875bb6d</guid>
            <category><![CDATA[csv]]></category>
            <category><![CDATA[azure-functions]]></category>
            <category><![CDATA[power-automate]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Thu, 27 Mar 2025 17:31:59 GMT</pubDate>
            <atom:updated>2026-03-21T17:32:15.128Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a part of the <a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=a5255ced-dc08-f011-bae3-6045bdf03fcb">File &amp; Utility Functions</a> series.<br>An Azure Function to parse / convert CSVs to JSON and how to combine it with another function to update &amp; create records on a CSV.</p><h3>CSV to JSON</h3><p>Inputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qByPg4V9W_8DOguv40N2bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*hSlrjRipv8WZ_51PLWkkNw.png" /></figure><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*kfiLhH5CZ9X2ojpHtMO6Og.png" /></figure><p>We can see the CSV was successfully converted to a JSON array. We can also note it handled header &amp; footer rows above &amp; below the data with the skip_top_rows &amp; skip_bottom_rows inputs, it handled duplicate CSV columns by adding a _# to the end of them, it handled several in-data commas, it handled in-data line-breaks, &amp; it automatically applied data-types to the JSON.</p><h3>Update &amp; Create CSV Rows</h3><p>Inputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*yc2KuUD7iW7nZUNRZp4lAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*gmElh6fTczBQsJuY2xMR0A.png" /></figure><p>Outputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*ceDxwjxKZ5VWgfnqIv3-CA.png" /></figure><p>So this successfully took our initial CSV, took an UpdateJSON array that we could have gotten from any data set Power Automate can read/connect to (like Excel or SharePoint Lists), connected them with the “Col1&quot; primary key. It output a new CSV where all original CSV rows with a Col1 matching Col1 in UpdateJSON were updated with the UpdateJSON values, all original CSV rows without matches were left unchanged, &amp; all new rows in UpdateJSON were added as new rows in the new CSV.</p><p>For more on how the Upsert JSON Array function works, <a href="https://medium.com/@takolota/power-automate-upsert-json-array-dfa937d800be">see this blog post</a>.</p><h3>Get This Function</h3><p>This function &amp; many other functions are available in one big import in the <a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=a5255ced-dc08-f011-bae3-6045bdf03fcb">File &amp; Utility Functions</a> package along with a template Power Automate flow showing how to use most of them. I recommend following the instructions to import the full package &amp; flow.</p><p>However if for some reason you just want the function from this blog…</p><pre>import json<br>import csv<br>import logging<br>import traceback<br>import re<br>from io import StringIO<br>import azure.functions as func<br><br>app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)<br><br>@app.route(route=&quot;csv_to_json&quot;)<br>def csv_to_json(req: func.HttpRequest) -&gt; func.HttpResponse:<br>    try:<br>        # Get parameters from request body as JSON<br>        req_body = req.get_body().decode(&#39;utf-8&#39;)<br>        if not req_body:<br>            return func.HttpResponse(&quot;Request body is empty&quot;, status_code=400)<br><br>        try:<br>            req_json = json.loads(req_body)<br>        except json.JSONDecodeError:<br>            return func.HttpResponse(&quot;Invalid JSON in request body&quot;, status_code=400)<br><br>        # Extract parameters from JSON with additional flexibility options<br>        file_content = req_json.get(&#39;file_content&#39;)<br>        delimiter = req_json.get(&#39;delimiter&#39;, &#39;,&#39;)<br>        linebreak = req_json.get(&#39;linebreak&#39;, &#39;\r\n&#39;)<br>        type_detect = req_json.get(&#39;type_detect&#39;, &#39;YES&#39;).upper() == &#39;YES&#39;<br>        first_row_headers = req_json.get(&#39;first_row_headers&#39;, &#39;YES&#39;).upper() == &#39;YES&#39;<br>        skip_top_rows = max(0, int(req_json.get(&#39;skip_top_rows&#39;, 0)))<br>        skip_bottom_rows = max(0, int(req_json.get(&#39;skip_bottom_rows&#39;, 0)))<br><br>        if not file_content:<br>            return func.HttpResponse(&quot;Missing required parameter: file_content&quot;, status_code=400)<br><br>        # Handle custom linebreak characters<br>        file_content = file_content.replace(&#39;\\r\\n&#39;, &#39;\r\n&#39;).replace(&#39;\\n&#39;, &#39;\n&#39;)<br>        if linebreak != &#39;\r\n&#39; and linebreak != &#39;\n&#39;:<br>            # Convert string representation to actual line break characters<br>            linebreak = linebreak.replace(&#39;\\r\\n&#39;, &#39;\r\n&#39;).replace(&#39;\\n&#39;, &#39;\n&#39;)<br>            file_content = file_content.replace(linebreak, &#39;\r\n&#39;)<br><br>        # Create CSV reader with custom delimiter<br>        csv_reader = csv.reader(StringIO(file_content), delimiter=delimiter)<br>        rows = list(csv_reader)<br><br>        if not rows:<br>            return func.HttpResponse(json.dumps([]), mimetype=&quot;application/json&quot;)<br><br>        # Apply row skipping logic<br>        if skip_top_rows &gt; 0:<br>            if skip_top_rows &gt;= len(rows):<br>                return func.HttpResponse(&quot;Skip top rows value exceeds number of rows in CSV&quot;, status_code=400)<br>            rows = rows[skip_top_rows:]<br><br>        if skip_bottom_rows &gt; 0:<br>            if skip_bottom_rows &gt;= len(rows):<br>                return func.HttpResponse(&quot;Skip bottom rows value exceeds number of rows in CSV&quot;, status_code=400)<br>            rows = rows[:-skip_bottom_rows]<br><br>        if not rows:<br>            return func.HttpResponse(json.dumps([]), mimetype=&quot;application/json&quot;)<br><br>        # Process headers after row skipping<br>        if first_row_headers:<br>            headers = rows.pop(0)<br>            # Ensure header names are valid and make them unique<br>            headers = handle_duplicate_headers([h if h else f&quot;Column_{i+1}&quot; for i, h in enumerate(headers)])<br>        else:<br>            headers = [f&quot;Column_{i+1}&quot; for i in range(len(rows[0]))]<br><br>        if type_detect and rows:<br>            column_types = detect_column_types(rows)<br>            json_data = []<br>            for row in rows:<br>                row_dict = {}<br>                for i, value in enumerate(row):<br>                    if i &lt; len(headers):  # Protect against malformed rows<br>                        try:<br>                            row_dict[headers[i]] = column_types[i](value) if value else None<br>                        except:<br>                            row_dict[headers[i]] = value<br>                json_data.append(row_dict)<br>        else:<br>            json_data = []<br>            for row in rows:<br>                # Handle cases where rows might have different lengths<br>                row_dict = {}<br>                for i, value in enumerate(row):<br>                    if i &lt; len(headers):<br>                        row_dict[headers[i]] = value<br>                json_data.append(row_dict)<br><br>        return func.HttpResponse(<br>            json.dumps(json_data, ensure_ascii=False), <br>            mimetype=&quot;application/json&quot;<br>        )<br><br>    except csv.Error as e:<br>        logging.error(f&quot;CSV parsing error: {str(e)}&quot;)<br>        return func.HttpResponse(f&quot;Error parsing CSV: {str(e)}&quot;, status_code=400)<br>    except json.JSONDecodeError as e:<br>        logging.error(f&quot;JSON encoding error: {str(e)}&quot;)<br>        return func.HttpResponse(f&quot;Error creating JSON: {str(e)}&quot;, status_code=500)<br>    except ValueError as e:<br>        logging.error(f&quot;Value error: {str(e)}&quot;)<br>        return func.HttpResponse(f&quot;Invalid parameter value: {str(e)}&quot;, status_code=400)<br>    except Exception as e:<br>        logging.error(traceback.format_exc())<br>        return func.HttpResponse(f&quot;Error processing CSV: {str(e)}&quot;, status_code=500)<br><br>def handle_duplicate_headers(headers):<br>    &quot;&quot;&quot;<br>    Makes duplicate headers unique by appending an index.<br>    Example: [&quot;Name&quot;, &quot;Name&quot;, &quot;Name&quot;] becomes [&quot;Name&quot;, &quot;Name_1&quot;, &quot;Name_2&quot;]<br>    &quot;&quot;&quot;<br>    seen = {}<br>    unique_headers = []<br><br>    for header in headers:<br>        if header in seen:<br>            seen[header] += 1<br>            unique_headers.append(f&quot;{header}_{seen[header]}&quot;)<br>        else:<br>            seen[header] = 1<br>            unique_headers.append(header)<br><br>    return unique_headers<br><br>def detect_column_types(rows):<br>    &quot;&quot;&quot;Detects column data types based on all rows.&quot;&quot;&quot;<br>    if not rows or not rows[0]:<br>        return []<br><br>    num_cols = max(len(row) for row in rows)<br>    column_types = [str] * num_cols<br><br>    # Sample up to 100 rows for type detection<br>    sample_rows = rows[:min(100, len(rows))]<br><br>    for col_idx in range(num_cols):<br>        col_values = [row[col_idx] for row in sample_rows if col_idx &lt; len(row) and row[col_idx]]<br>        if not col_values:<br>            continue<br>        &#39;&#39;&#39;<br>        # Check for boolean values<br>        if all(val.lower() in (&#39;true&#39;, &#39;false&#39;, &#39;yes&#39;, &#39;no&#39;, &#39;1&#39;, &#39;0&#39;) for val in col_values):<br>            column_types[col_idx] = lambda x: x.lower() in (&#39;true&#39;, &#39;yes&#39;, &#39;1&#39;)<br>            continue<br>        &#39;&#39;&#39;<br>        # Check for boolean values (Strictly True/False)<br>        if all(val.lower() in (&#39;true&#39;, &#39;false&#39;) for val in col_values):<br>            column_types[col_idx] = lambda x: x.lower() == &#39;true&#39;<br>            continue<br><br>        # Check for integers<br>        if all(re.match(r&#39;^-?\d+$&#39;, val) for val in col_values):<br>            column_types[col_idx] = int<br>            continue<br><br>        # Check for floats<br>        if all(is_float(val) for val in col_values):<br>            column_types[col_idx] = float<br>            continue<br><br>        # Check for dates (simple ISO format check)<br>        if all(re.match(r&#39;^\d{4}-\d{2}-\d{2}&#39;, val) for val in col_values):<br>            column_types[col_idx] = lambda x: x  # Keep as string for dates<br><br>    return column_types<br><br>def is_float(value):<br>    try:<br>        float(value)<br>        return True<br>    except (ValueError, TypeError):<br>        return False</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2653875bb6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upsert or Merge JSON Arrays (Logic Apps & Power Automate)]]></title>
            <link>https://medium.com/@takolota/power-automate-upsert-json-array-dfa937d800be?source=rss-36bd2c22c8d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfa937d800be</guid>
            <category><![CDATA[json]]></category>
            <category><![CDATA[power-automate]]></category>
            <category><![CDATA[azure-functions]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Tyler Kolota]]></dc:creator>
            <pubDate>Thu, 27 Mar 2025 17:31:56 GMT</pubDate>
            <atom:updated>2025-04-01T17:42:22.696Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a part of the <a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=a5255ced-dc08-f011-bae3-6045bdf03fcb">File &amp; Utility Functions</a> series.<br>An Azure Function to create &amp; update records on one JSON array using records from a second JSON array. Also how to use this method to efficiently create/update items on CSVs, SharePoint Lists, &amp; other data-sets.</p><h3>Basic Upsert JSON Array Example</h3><p>Inputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*SwAiQvK87uBVNYuazZXeJQ.png" /></figure><p>Run Outputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*dOb2S1oVAcXaOepwJEbF7w.png" /></figure><p>Any column values present in the UpdatesJSON were used to update the column values in the InitialJSON, any columns in InitialJSON not in UpdatesJSON are unchanged, &amp; any columns in UpdatesJSON not in InitialJSON were not added (although if one wants they could use a Select action to add a column D to the InitialJSON &amp; then those D values would be added). Also see how InitialJSON didn’t actually have a unique primary key where Column A had two 1 values, but the function still handled it gracefully by using the UpdatesJSON with A value of 1 to update both InitialJSON records with A value of 1. So it is possible to do a one-to-many update in this function, one UpdatesJSON record to many InitialJSON records.<br>Finally, note the initial_json &amp; update_json share the exact same primary key column name, “A”, and each of the update_json columns used to make updates share the exact same column names as the initial_json columns. In a following more realistic example we will work with data sets with different column names &amp; show how to transform them to match up using some Select actions.</p><h3>How can this be used?</h3><p>Two immediate use-cases that come to mind:<br>-Updating &amp; creating records for CSVs which I’ve shown <a href="https://medium.com/@takolota/power-automate-csv-to-json-update-csv-b2653875bb6d">in a separate blog post</a>.<br>-Merging JSON arrays.<br>-Updating &amp; creating records in any data-set Power Automate can read &amp; connect to.</p><h4>Merging JSON Arrays</h4><p>Let’s explore using the upsert JSON to merge two JSON arrays. Note the only change we had to make to the basic example is we had to add a Select action to add the columns we want to merge to the InitialJSON so the upsert function doesn’t ignore them. And we use the outputs of that Select action for the initial_json input.</p><p>Inputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*aX2qbArwyH9pj2J8durxiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*cSU6jU1njWDFUgzaZswZLg.png" /></figure><p>Run Outputs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*ueUd0Npr8cw3D1JttMFyuw.png" /></figure><h4>Updating &amp; Creating Records In Any Data-Set</h4><p>Let’s explore using the upsert JSON for more efficient updating &amp; creating data-set records with some hypothetical SharePoint List data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*slz6KFvUjNg3zgrHPSzOnQ.png" /></figure><p>Normal Way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1FEbnVpd2p7pVrxj45xlaA.png" /></figure><p>New Way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wqVvDCw2XzMF-O0QhyMqXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*aTV0m6ezHXkJy_VegsbD-g.png" /></figure><p>The 1st Select action shows how one can efficiently map updated values to the initial JSON field names before the Upsert JSON action. This makes the method useful for anytime one wants to update one data-set with another data-set even if they don’t initially share exact column names.<br>Then later in the flow getting only records for the creates loop requires creating a Right-Join-Excluding-Inner-Join for List B with a Filter array, while getting only records for an updates loop requires creating an Inner-Join between Lists A &amp; B with a few Select &amp; Filter array actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IdF1uYrYg9-kRAz1HJP3hg.png" /></figure><p>Overall, notice how the normal way requires 3 actions (Filter array, Condition, &amp; Post Data) for each record in a loop. The new way does all the pre-processing of data outside the loops so inside the loops we only have the 1 Post Data action per record.<br>The new way may be more complicated to set-up, but on larger updates with larger data sets reducing the number of actions by two thirds will improve the speed of updates &amp; conserve a lot of your limited daily action calls.</p><h3>Get This Function</h3><p>This function &amp; many other functions are available in one big import in the <a href="https://community.powerplatform.com/galleries/gallery-posts/?postid=a5255ced-dc08-f011-bae3-6045bdf03fcb">File &amp; Utility Functions</a> package along with a template Power Automate flow showing how to use most of them. I recommend following the instructions to import the full package &amp; flow.</p><p>However if for some reason you just want the function from this blog…</p><pre>import azure.functions as func<br>import logging<br>import json<br>import traceback<br><br>app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)<br><br>@app.route(route=&quot;upsert_json_array&quot;)<br>def upsert_json_array(req: func.HttpRequest) -&gt; func.HttpResponse:<br>    try:<br>        req_body = req.get_json()<br>        <br>        primary_key = req_body.get(&quot;primary_key&quot;)<br>        initial_json = req_body.get(&quot;initial_json&quot;, [])<br>        update_json = req_body.get(&quot;update_json&quot;, [])<br>        <br>        if not all([primary_key, initial_json, update_json]):<br>            return func.HttpResponse(<br>                json.dumps({&quot;error&quot;: &quot;Missing required parameters.&quot;}),<br>                status_code=400,<br>                mimetype=&quot;application/json&quot;<br>            )<br>        <br>        # Extract all possible columns from initial_json<br>        all_columns = {key for item in initial_json for key in item.keys()}<br>        <br>        # Organize initial_json by primary key (one-to-many relationship)<br>        initial_dict = {}<br>        for item in initial_json:<br>            key = item[primary_key]<br>            if key not in initial_dict:<br>                initial_dict[key] = []<br>            initial_dict[key].append(item)<br>        <br>        # Convert update_json to a dictionary<br>        update_dict = {item[primary_key]: item for item in update_json}<br>        <br>        new_keys = set(update_dict.keys()) - set(initial_dict.keys())<br>        <br>        # Update existing records<br>        for key, records in initial_dict.items():<br>            if key in update_dict:<br>                update_values = update_dict[key]<br>                for record in records:<br>                    for update_field, update_value in update_values.items():<br>                        if update_field in record:<br>                            record[update_field] = update_value<br>        <br>        # Append new records with missing columns set to None<br>        for key in new_keys:<br>            new_record = {col: update_dict[key].get(col, None) for col in all_columns}<br>            initial_json.append(new_record)<br>        <br>        return func.HttpResponse(<br>            json.dumps(initial_json, indent=2),<br>            status_code=200,<br>            mimetype=&quot;application/json&quot;<br>        )<br>    <br>    except Exception as e:<br>        error_details = traceback.format_exc()<br>        logging.error(&quot;Exception occurred: %s&quot;, error_details)<br>        return func.HttpResponse(<br>            json.dumps({&quot;error&quot;: &quot;Internal server error&quot;, &quot;details&quot;: str(e), &quot;traceback&quot;: error_details}),<br>            status_code=500,<br>            mimetype=&quot;application/json&quot;<br>        )</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfa937d800be" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>