
Announcements
Hello everyone,
I'm new here, and fairly new to working with Flow. I've gotten stuck on trying to add multiple items to an array so I can call their individual property values later for filling in a document.
General process of the flow is this:
Gets the items from the SharePoint list (filtered for a specific requisition number).
Gets the items properties.
Initializes the Array variable.
Selects specific variables from the retrieved items to be added to the array. (This step and the following one...)
Adds the retrieved/filtered items to the array variable, adding . (are where it's not doing what I need it to).
Checks that purpose and purchasing vendor are the same, and if they are, outputs an word document from HTML code (using Encodian).
Updates the Sharepoint items to indicate it's been ordered.
Prior to triggering the flow, I update the sharepoint list items I want added to the document with matching requisition numbers that the flow filters for, and I input the same requisition number as an input to the flow. If I only have one item with a requisition number, every thing works perfectly and I get a document with one item listed, and all the other fields filled out correctly. (see R-2021-Test 1 Item at end of post).
The problem is when I add more than one item. The items get duplicated based on how many items I add. If I have two items to add, the both get added to the array twice, if I add six items, they get duplicated 6 times. (See R-2021-TEST 2 Items, and -6 Items at end of post).
Here's what the flow setup for that section looks like:
I'll also add a comment with the HTML for the document format/output that calls the variables from the array, though I don't think that's what's causing the issue.
I've tried a ton of different things to get it to not duplicate the items in the array, but nothing has worked. Most of the attempts at fixing it have resulted in errors along the lines of 'incorrect variable type.'
Any help would be greatly appreciated.
Thank you!
Kayla
R-2021-TEST 1 Item
R-2021-TEST 2 Items
R-2021-TEST 6 Items
HTML for the document:
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
</head>
<body lang=EN-US style='tab-interval:.5in;word-wrap:break-word'>
<div class="WordSection1">
<table style="width: 775px; border-color: 000000; border-collapse: collapse; margin-left: auto; margin-right: auto;" border="1">
<tbody>
<tr>
<td style="width: 200px; font-size: 400%; text-align: center"><span style="text-decoration: underline;"><em><strong>INT</strong></em></span></td>
<td style="width: 200px; text-align: center;"><strong>Document Title:</strong><br />Requisition Form</td>
<td style="width: 200px; text-align: center;">
<p><strong>Document #:</strong>
<br>FORM 05.01.2</td>
<td style="width: 200px; text-align: center;"><strong>Effective Date:</strong><br />5/1/20</td>
<td style="width: 200px; text-align: center;">Page 1 of 2</td>
</tr>
</tbody>
</table>
<br />
<table style="width: 775px; border-color: 000000; border-collapse: collapse; margin-left: auto; margin-right: auto;" border="1">
<tbody>
<tr>
<td style="width: 652.906px; font-size: 70%; background-color: #b0b0b0;" colspan="5">
<p><strong>Requestor Info</strong></p>
</td>
<td style="width: 10px; background-color: #666666; font-size: 80%;" rowspan="4"></td>
<td style="width: 397.234px; font-size: 70%; background-color: #b0b0b0;" colspan="4">
<p><strong>Vendor Info</strong></p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 652.906px; font-size: 90%;" colspan="5">
<p><strong>Name:</strong><br />@{triggerBody()['text_4']}</p>
</td>
<td style="vertical-align: top; width: 397.234px; font-size: 90%;" colspan="4">
<p><strong>Vendor Name: </strong><strong>3 Letter Code:</strong> @{variables('ItemArray')?[0]?['3Code']}
<br/>
@{variables('ItemArray')?[0]?['VendorName']}
</p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 652.906px; font-size: 90%;" colspan="5">
<p><strong>Date:</strong> <br />@{variables('Todays Date')}</p>
</td>
<td style="vertical-align: top; width: 397.234px; font-size: 90%;" colspan="5">
<p><strong>Requisition Number </strong><br /> <span style="color: #00ccff;"><strong>
@{triggerBody()['text']}
</strong></span></p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 652.906px; font-size: 90%;" colspan="5">
<p><strong>Business Reason:</strong><br /> <span style="color: #00ccff;">
@{variables('ItemArray')?[0]?['Purpose']}
</span></p>
</td>
<td style="vertical-align: top; width: 397.234px; font-size: 90%;" colspan="4">
<p><strong>Need by Date: <span style="text-decoration: underline;">@{variables('ItemArray')?[0]?['RushDate']}
</span></strong><br /> Pay up to $ <span style="text-decoration: underline;">
@{variables('ItemArray')?[0]?['RushCost']}
</span> to expedite</p>
</td>
</tr>
<tr>
<td style="width: 132px; text-align: center; background-color: #b0b0b0; font-size: 90%;">
<p><strong>Vendor Cat #</strong></p>
</td>
<td style="width: 20px; text-align: center; background-color: #b0b0b0; font-size: 90%;" colspan="2">
<p><strong>Req. Code (below)</strong></p>
</td>
<td style="width: 500.906px; text-align: center; background-color: #b0b0b0; font-size: 90%;" colspan="2">
<p><strong>INT Part #</strong></p>
</td>
<td style="width: 10px; text-align: center; background-color: #b0b0b0; font-size: 90%;">
<p><strong>Qty</strong></p>
</td>
<td style="width: 300px; text-align: center; background-color: #b0b0b0; font-size: 90%;" colspan="2">
<p><strong>Description </strong>
<br><strong><span style=" font-size: 80%;">(including Spec Revision #)</span></strong></p>
</td>
<td style="width: 110px; text-align: center; background-color: #b0b0b0; font-size: 90%;">
<p><strong>Unit Price</strong></p>
</td>
<td style="width: 106px; text-align: center; background-color: #b0b0b0; font-size: 90%;">
<p><strong>Total</strong>
<br><strong>Price</strong></p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 132px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[0]?['CatNum']}
</p>
</td>
<td style="vertical-align: top; width: 20px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[0]?['ReqCode']}
</p>
</td>
<td style="vertical-align: top; width: 500.906px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[0]?['INTPartNum']}
<br>Check if Service: @{outputs('ServiceYN')}</p>
</td>
<td style="vertical-align: top; width: 10px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[0]?['Qty']}
<br>
@{variables('ItemArray')?[0]?['units']}
</p>
</td>
<td style="vertical-align: top; width: 50px; text-align: left; font-size: 75%;" colspan="2">
<p>
@{variables('ItemArray')?[0]?['Desc']}
</p>
</td>
<td style="vertical-align: top; width: 110px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[0]?['uPrice']}
</p>
</td>
<td style="vertical-align: top; width: 106px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[0]?['tPrice']}
</p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 132px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[1]?['CatNum']}
</p>
</td>
<td style="vertical-align: top; width: 20px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[1]?['ReqCode']}
</p>
</td>
<td style="vertical-align: top; width: 500.906px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[1]?['INTPartNum']}
<br>Check if Service: @{outputs('ServiceYN')}</p>
</td>
<td style="vertical-align: top; width: 10px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[1]?['Qty']}
<br>
@{variables('ItemArray')?[1]?['units']}
</p>
</td>
<td style="vertical-align: top; width: 50px; text-align: left; font-size: 75%;" colspan="2">
<p>
@{variables('ItemArray')?[1]?['Desc']}
</p>
</td>
<td style="vertical-align: top; width: 110px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[1]?['uPrice']}
</p>
</td>
<td style="vertical-align: top; width: 106px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[1]?['tPrice']}
</p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 132px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[2]?['CatNum']}
</p>
</td>
<td style="vertical-align: top; width: 20px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[2]?['ReqCode']}
</p>
</td>
<td style="vertical-align: top; width: 500.906px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[2]?['INTPartNum']}
<br>Check if Service: @{outputs('ServiceYN')}</p>
</td>
<td style="vertical-align: top; width: 10px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[2]?['Qty']}
<br>
@{variables('ItemArray')?[2]?['units']}
</p>
</td>
<td style="vertical-align: top; width: 50px; text-align: left; font-size: 75%;" colspan="2">
<p>
@{variables('ItemArray')?[2]?['Desc']}
</p>
</td>
<td style="vertical-align: top; width: 110px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[2]?['uPrice']}
</p>
</td>
<td style="vertical-align: top; width: 106px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[2]?['tPrice']}
</p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 132px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[3]?['CatNum']}
</p>
</td>
<td style="vertical-align: top; width: 20px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[3]?['ReqCode']}
</p>
</td>
<td style="vertical-align: top; width: 500.906px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[3]?['INTPartNum']}
<br>Check if Service: @{outputs('ServiceYN')}</p>
</td>
<td style="vertical-align: top; width: 10px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[3]?['Qty']}
<br>
@{variables('ItemArray')?[3]?['units']}
</p>
</td>
<td style="vertical-align: top; width: 50px; text-align: left; font-size: 75%;" colspan="2">
<p>
@{variables('ItemArray')?[3]?['Desc']}
</p>
</td>
<td style="vertical-align: top; width: 110px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[3]?['uPrice']}
</p>
</td>
<td style="vertical-align: top; width: 106px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[3]?['tPrice']}
</p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 132px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[4]?['CatNum']}
</p>
</td>
<td style="vertical-align: top; width: 20px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[4]?['ReqCode']}
</p>
</td>
<td style="vertical-align: top; width: 500.906px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[4]?['INTPartNum']}
<br>Check if Service: @{outputs('ServiceYN')}</p>
</td>
<td style="vertical-align: top; width: 10px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[4]?['Qty']}
<br>
@{variables('ItemArray')?[4]?['units']}
</p>
</td>
<td style="vertical-align: top; width: 50px; text-align: left; font-size: 75%;" colspan="2">
<p>
@{variables('ItemArray')?[4]?['Desc']}
</p>
</td>
<td style="vertical-align: top; width: 110px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[4]?['uPrice']}
</p>
</td>
<td style="vertical-align: top; width: 106px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[4]?['tPrice']}
</p>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 132px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[5]?['CatNum']}
</p>
</td>
<td style="vertical-align: top; width: 20px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[5]?['ReqCode']}
</p>
</td>
<td style="vertical-align: top; width: 500.906px; text-align: center; font-size: 90%;" colspan="2">
<p>
@{variables('ItemArray')?[5]?['INTPartNum']}
<br>Check if Service: @{outputs('ServiceYN')}</p>
</td>
<td style="vertical-align: top; width: 10px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[5]?['Qty']}
<br>
@{variables('ItemArray')?[5]?['units']}
</p>
</td>
<td style="vertical-align: top; width: 50px; text-align: left; font-size: 75%;" colspan="2">
<p>
@{variables('ItemArray')?[5]?['Desc']}
</p>
</td>
<td style="vertical-align: top; width: 110px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[5]?['uPrice']}
</p>
</td>
<td style="vertical-align: top; width: 106px; text-align: center; font-size: 90%;">
<p>
@{variables('ItemArray')?[5]?['tPrice']}
</p>
</td>
</tr>
<tr>
<td style="width: 652.906px; font-size: 90%;" colspan="5">
<p><strong>To be used in validation tests, saleable product or product QC?</strong> (Operations approval not required for R&D or lab supplies under $1,000. <span style="background-color: #ffff00;">If purchased as R&D can NOT be used in validation of saleable product.)</span></p>
</td>
<td style="width: 695.469px; vertical-align: top; font-size: 90%;" colspan="5" rowspan="5">
<p><strong>Comments/Special Instructions (e.g. shelf life minimum or requested lot #)</strong> <br /><span style="color: #ff0000;">@{triggerBody()?['text_1']}</span> <br /> <br />Approximate Total Purchase Price: $ <span style="text-decoration: underline;">SumPrice</span> with shipping <br /><strong>How will vendor accept payment?</strong> <$1,000 - buy with Credit Card or PO, >$1000 - See Operations Manager for preferred method: <strong>POCC</strong></p>
</td>
</tr>
<tr>
<td style="width: 557.906px; font-size: 90%;" colspan="4">
<p>If unsure, answer Yes.</p>
</td>
<td style="width: 95px;">
<p><strong><span style="color: #00ccff; font-size: 90%;">@{triggerBody()['boolean']}</span></strong></p>
</td>
</tr>
<tr>
<td style="width: 557.906px; font-size: 90%;" colspan="4">
<p><strong>Over $1,000 with shipping?</strong></p>
<p> </p>
</td>
<td style="width: 95px;">
<p><span style="color: #00ccff; font-size: 90%;"><strong>@{triggerBody()['boolean_1']}</strong></span></p>
</td>
</tr>
<tr>
<td style="width: 652.906px;" colspan="5">
<p><span style="background-color: #ffff00; font-size: 90%;">(If either answer is Yes, Operations Management Approval needed.)</span></p>
</td>
</tr>
<tr>
<td style="width: 557.906px; font-size: 90%;" colspan="4">
<p><strong>Approved production BOM component?</strong></p>
</td>
<td style="width: 95px;">
<p><strong><span style="color: #00ccff; font-size: 90%;">@{triggerBody()['boolean_2']}</span></strong></p>
</td>
</tr>
<tr>
<td style="width: 652.906px; font-size: 90%;" colspan="5">
<p><strong>Requestor Signature</strong>: @{triggerBody()['text_4']}</p>
</td>
<td style="width: 695.469px; vertical-align: top; font-size: 90%;" colspan="5" rowspan="3">
<p><strong>Shipping Instructions: </strong>
<br><span style="color: #ff0000;">
@{triggerBody()?['text_2']}
</span></p>
</td>
</tr>
<tr>
<td style="width: 142px; font-size: 120%;" colspan="2">
<p><strong>[ ]</strong></p>
</td>
<td style="width: 510.906px; font-size: 90%;" colspan="3">
<p><strong>(Date): </strong>@{variables('Todays Date')}</p>
</td>
</tr>
<tr>
<td style="width: 652.906px; background-color: #b0b0b0; font-size: 90%;" colspan="5">
<p><strong>Requisition Codes</strong></p>
</td>
</tr>
<tr>
<td style="width: 652.906px; font-size: 90%;" colspan="5">
<p><strong>A) </strong>New Item/ New Supplier<br /> <strong>B) </strong>New Item / Existing Supplier<br /> <strong>C) </strong>Repeat Item / Existing Supplier*<br /> <strong>D) </strong>New Service / New Supplier<br /> <strong>E) </strong>Recurring Service / Existing Supplier<br /> <strong>F) </strong>Existing Item (same manufacturer) /New Supplier</p>
</td>
<td style="width: 695.469px; font-size: 90%;" colspan="5">
<p><strong>PURCHASING ONLY </strong>(Production approved BOM? On approved Supplier List?) <br /> Current approved production Bill of Material component? <span style="color: #00ccff;"><strong>@{triggerBody()['boolean_2']}</strong></span>
<br /><span style="font-size: 75%">(If Yes is indicated, must provide Supplier Approval Date: <u>DateSupAprv</u> )</span>
<br /><strong>Purchasing approval (initials</strong>) <u>PurInit</u> (<strong>Date): </strong><u>DatePur</u> <br />AmEx purchase? <span style="color: #00ccff;"><strong>YN4</strong></span></p>
</td>
</tr>
<tr>
<td style="width: 1348.38px; background-color: #f5f5f5; font-size: 90%;" colspan="10">
<p><strong>Operations Management Review - needed if either question above is “Yes” AND item is not approved BOM item.</strong></p>
</td>
</tr>
<tr>
<td style="width: 1348.38px; background-color: #f5f5f5; font-size: 90%;" colspan="10">
<p>Current management approved production Bill of Material (BOM) component? <strong><span style="color: #00ccff;">@{triggerBody()['boolean_2']}</span></strong>
<br>If Yes, Requisition goes to Purchasing for verification of inclusion on Approved Supplier List. If No, then provide:
<br>(Supplier Approval Date): <span style="text-decoration: underline;">DateSupAprv</span> (Operations Manager initials): <u>OpAprv1</u> (Date): <u>DateOpAprv1</u>
<br>Or Reason if not on Supplier Approval List (e.g. R&D only) Operations Approval: <u>OpAprv2</u>;(Date): <u>DateOpAprv2</u></p>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>