
Announcements
Hey all,
I'm building a flow to process PDF documents. The model is working great and my logic to bring the info from the PDFs into excel seems to be working well. I'm struggling to prevent duplicates.
I'm open to any suggestions on how to fix this issue. My current plan was to use a condition to check if the file has been processed already. If True, do nothing. If False, do [put into excel].
Ideally the flow would move files from the "Intake" folder to the "outtake" after its been processed, but I havent gotten that working either. Fully know my flow is a bit of a mess right now... I've been using GPT4 to try and solve the issue but its been leading me nowhere.
I don't have a huge programing background so my way of thinking about this could be wrong...but I think the real issue is getting confused by the way powerautomate uses naming conventions. I can't figure out what to select when for the dynamic content.
Not sure the best way to show my flow... so I've attached screenshots and will include the "Copy" version of it too. Really wish there was a better way to share flows. I cant be the first person that wants to take information from PDFs in folders and put it into excel. Maybe I'm missing something...idk. Again. I'm lost.
{"id":"337c40b5-34d4-4d8d-bfb0-55e342cd1f49","brandColor":"#0078D4","connectionReferences":{"shared_excelonlinebusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness/connections/shared-excelonlinebu-e87ae195-9123-46c8-a66d-82cfe0d9cfc6"}},"shared_commondataserviceforapps":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/shared-commondataser-188282a4-18b5-428b-941b-f530e8e1c020"}},"shared_onedriveforbusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness/connections/shared-onedriveforbu-e1e7e52c-194c-4dda-a6b9-44b9e565ba3b"}}},"connectorDisplayName":"OneDrive for Business","icon":"https://connectoricons-prod.azureedge.net/releases/v1.0.1656/1.0.1656.3432/onedriveforbusiness/icon.png","isTrigger":false,"operationName":"List_files_in_FedEx_Intake","operationDefinition":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_onedriveforbusiness","operationId":"ListFolderV2","apiId":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness"},"parameters":{"id":"b!8ApZtb_mhEeeAwtom5t3qu8FUlQCaDVKlO7ibpBSS9eLSFwV6HFNRLPBcLtlIgXI.01X72CGSIGXA5GOJMERBEK73SVHXXZJLUR"},"authentication":"@parameters('$authentication')"},"runAfter":{},"metadata":{"b!8ApZtb_mhEeeAwtom5t3qu8FUlQCaDVKlO7ibpBSS9eLSFwV6HFNRLPBcLtlIgXI.01X72CGSIGXA5GOJMERBEK73SVHXXZJLUR":"/FedEx Intake","operationMetadataId":"5afbb597-3e21-4494-87f3-8fbcd7c8a6cc"}}}
{"id":"f78d1854-0696-48cc-92e8-c5c737e6ba71","brandColor":"#8C6CFF","connectionReferences":{"shared_excelonlinebusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness/connections/shared-excelonlinebu-e87ae195-9123-46c8-a66d-82cfe0d9cfc6"}},"shared_commondataserviceforapps":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/shared-commondataser-188282a4-18b5-428b-941b-f530e8e1c020"}},"shared_onedriveforbusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness/connections/shared-onedriveforbu-e1e7e52c-194c-4dda-a6b9-44b9e565ba3b"}}},"icon":"https://content.powerapps.com/resource/makerx/static/pauto/images/designeroperations/dataoperationedit.2c8a4d5e.png","isTrigger":false,"operationName":"Compose_3","operationDefinition":{"type":"Compose","inputs":"@variables('ProcessedFiles')","runAfter":{"List_files_in_FedEx_Intake":["Succeeded"]},"metadata":{"operationMetadataId":"bb039275-6416-47e9-b8d8-3128ed197f12"}}}
{"id":"744c2612-df0a-495a-a05b-fc6eab02cc88","brandColor":"#486991","connectionReferences":{"shared_excelonlinebusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness/connections/shared-excelonlinebu-e87ae195-9123-46c8-a66d-82cfe0d9cfc6"}},"shared_commondataserviceforapps":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/shared-commondataser-188282a4-18b5-428b-941b-f530e8e1c020"}},"shared_onedriveforbusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness/connections/shared-onedriveforbu-e1e7e52c-194c-4dda-a6b9-44b9e565ba3b"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzQ4Njk5MSIvPg0KIDxwYXRoIGQ9Ik0xMSAyMGg3LjJsMSAxaC05LjJ2LTguM2wtMS4zIDEuMy0uNy0uNyAyLjUtMi41IDIuNSAyLjUtLjcuNy0xLjMtMS4zem0xMi4zLTJsLjcuNy0yLjUgMi41LTIuNS0yLjUuNy0uNyAxLjMgMS4zdi03LjNoLTcuMmwtMS0xaDkuMnY4LjN6IiBmaWxsPSIjZmZmIi8+DQo8L3N2Zz4NCg==","isTrigger":false,"operationName":"Apply_to_each_5","operationDefinition":{"type":"Foreach","foreach":"@outputs('List_files_in_FedEx_Intake')?['body/value']","actions":{"Apply_to_each":{"type":"Foreach","foreach":"@items('Apply_to_each_5')?['Name']","actions":{"Condition_2":{"type":"If","expression":{"equals":["@contains(variables('ProcessedFiles'), items('Apply_to_each')?['Name'])","@false"]},"actions":{"Compose":{"type":"Compose","inputs":"@variables('ProcessedFiles')","runAfter":{},"metadata":{"operationMetadataId":"024fc52d-0b38-4cf5-8622-05f4c651e3bc"}}},"runAfter":{},"else":{"actions":{"Apply_to_each_3":{"type":"Foreach","foreach":"@outputs('List_files_in_FedEx_Intake')?['body/value']","actions":{"Get_file_content":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_onedriveforbusiness","operationId":"GetFileContent","apiId":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness"},"parameters":{"id":"@items('Apply_to_each_3')?['Id']","inferContentType":true},"authentication":"@parameters('$authentication')"},"runAfter":{},"metadata":{"operationMetadataId":"08e0e734-76aa-4fa9-a26f-9be66f0a2c48"}},"Apply_to_each_4":{"type":"Foreach","foreach":"@items('Apply_to_each_3')","actions":{"Generate_GUID_2":{"type":"Compose","inputs":"@concat(utcNow(), '-', rand(1, 1000000))","runAfter":{},"metadata":{"operationMetadataId":"b1941615-f81c-4478-a767-7f0975a681eb"}},"Save_file_to_AI_feedback_loop_for_improvement_2":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_commondataserviceforapps","operationId":"aibuilderfeedback_addfiletofeedbackloop","apiId":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps"},"parameters":{"recordId":"7bbde5e7-df88-440d-8545-73cf74a7128d","item/predictionInput/base64Encoded":"@items('Apply_to_each_3')"},"authentication":"@parameters('$authentication')"},"runAfter":{"Generate_GUID_2":["Succeeded"]},"metadata":{"operationMetadataId":"f40e071b-a111-4987-aee8-9ca12bf15b4c","flowSystemMetadata":{"portalOperationId":"aibuilderfeedback_addfiletofeedbackloop","portalOperationGroup":"aibuilder","portalOperationApiDisplayNameOverride":"AI Builder","portalOperationIconOverride":"https://content.powerapps.com/resource/makerx/static/pauto/images/designeroperations/aiBuilderNew.51dbdb6b.png","portalOperationBrandColorOverride":"#0A76C4","portalOperationApiTierOverride":"Standard"}}},"Extract_information_from_documents_2":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_commondataserviceforapps","operationId":"aibuilderpredict_formsprocessing","apiId":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps"},"parameters":{"recordId":"7bbde5e7-df88-440d-8545-73cf74a7128d","item/requestv2/mimeType":"application/pdf","item/requestv2/base64Encoded":"@items('Apply_to_each_3')"},"authentication":"@parameters('$authentication')"},"runAfter":{"Save_file_to_AI_feedback_loop_for_improvement_2":["Succeeded"]},"metadata":{"operationMetadataId":"65b7afc6-4125-4d76-95c9-24d33f5fe182","flowSystemMetadata":{"portalOperationId":"aibuilderpredict_formsprocessing","portalOperationGroup":"aibuilder","portalOperationApiDisplayNameOverride":"AI Builder","portalOperationIconOverride":"https://content.powerapps.com/resource/makerx/static/pauto/images/designeroperations/aiBuilderNew.51dbdb6b.png","portalOperationBrandColorOverride":"#0A76C4","portalOperationApiTierOverride":"Standard"}}},"ItemList_2":{"type":"Compose","inputs":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/tables/Item_00268767446ead2d62ec44c73f7f74408cb']","runAfter":{"Extract_information_from_documents_2":["Succeeded"]},"metadata":{"operationMetadataId":"3f1eac90-0f5d-438d-a63b-38a0f53af898"}},"ItemList_Table":{"type":"Foreach","foreach":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/tables/Item_00268767446ead2d62ec44c73f7f74408cb/entries']","actions":{"Add_a_row_into_a_table":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_excelonlinebusiness","operationId":"AddRowV2","apiId":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"},"parameters":{"source":"me","drive":"b!8ApZtb_mhEeeAwtom5t3qu8FUlQCaDVKlO7ibpBSS9eLSFwV6HFNRLPBcLtlIgXI","file":"01X72CGSOP3Z7HLCP2NFE3NANNXUATSSZP","table":"{506F9DF3-E712-4AC5-A724-FE35C01EF48C}","item/UniqueID":"@outputs('Generate_GUID_2')","item/Description":"@items('ItemList_Table')?['Description/text']","item/Code":"@items('ItemList_Table')?['Code/text']","item/GST Amount":"@items('ItemList_Table')?['GST_002Fbdb5d3c998ff3533364fdea81b48c196/text']","item/Amount":"@items('ItemList_Table')?['Amount/text']","item/Timestamp":"@items('Apply_to_each_4')?['NameNoExt']"},"authentication":"@parameters('$authentication')"},"runAfter":{},"metadata":{"01X72CGSOP3Z7HLCP2NFE3NANNXUATSSZP":"/FedEx Processing.xlsx","operationMetadataId":"b978c224-ba83-447c-b7ab-6eaad1c41374","tableId":"{506F9DF3-E712-4AC5-A724-FE35C01EF48C}"}}},"runAfter":{"ItemList_2":["Succeeded"]},"metadata":{"operationMetadataId":"b431ef6b-1182-4c8d-b1b9-246f7d3547fe"}},"Add_MainData_to_Table":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_excelonlinebusiness","operationId":"AddRowV2","apiId":"/providers/Microsoft.PowerApps/apis/shared_excelonlinebusiness"},"parameters":{"source":"me","drive":"b!8ApZtb_mhEeeAwtom5t3qu8FUlQCaDVKlO7ibpBSS9eLSFwV6HFNRLPBcLtlIgXI","file":"01X72CGSOP3Z7HLCP2NFE3NANNXUATSSZP","table":"{AABCCDBD-0639-44AC-B8B2-2C4A06C33EBD}","item/UniqueID":"@outputs('Generate_GUID_2')","item/Date":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/labels/Date/text']","item/CARM Ref No":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/labels/Referenc86a0b11f1a1b339e71cf33fb56a8a5c7/text']","item/Fed Invoice No":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/labels/Invoice_24d0eb421cf7d427235f7a6e8ed91e5a/text']","item/Order N No":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/labels/Order_00123ffb9e21ec712e4f881cac6b4b7d26/text']","item/GST Subtotal":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/labels/GST_0020a6863f8d202cf6657e819bc90d3b8ed2/text']","item/Total Amount":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/labels/TotalAmount/text']","item/Exch Rt":"@outputs('Extract_information_from_documents_2')?['body/responsev2/predictionOutput/labels/ExchRT/text']","item/Timestamp":"@items('Apply_to_each_4')?['NameNoExt']"},"authentication":"@parameters('$authentication')"},"runAfter":{"Extract_information_from_documents_2":["Succeeded"]},"metadata":{"01X72CGSOP3Z7HLCP2NFE3NANNXUATSSZP":"/FedEx Processing.xlsx","operationMetadataId":"6c93d586-53c0-401c-904b-d6d5572f583a","tableId":"{AABCCDBD-0639-44AC-B8B2-2C4A06C33EBD}"}}},"runAfter":{"Get_file_content":["Succeeded"]},"metadata":{"operationMetadataId":"329df9ef-1de3-4634-b51c-e4b468a8bef6"}},"Append_to_array_variable":{"type":"AppendToArrayVariable","inputs":{"name":"ProcessedFiles","value":"@items('Apply_to_each')?['Name']"},"runAfter":{"Apply_to_each_4":["Succeeded"]},"metadata":{"operationMetadataId":"1e446350-94a2-4844-a478-6009e7c36126"}}},"runAfter":{},"metadata":{"operationMetadataId":"711b5c60-3620-41a1-9249-bedfa52e6828"}}}},"metadata":{"operationMetadataId":"5e0e04db-3d3f-487d-b345-6232674d965c"}}},"runAfter":{},"metadata":{"operationMetadataId":"7efd610d-e8d2-477a-aebf-c4591081873a"}}},"runAfter":{"Compose_3":["Succeeded"]}}}Dear M,
You condition statement would seem the most obvious solution, I would think in the same way and can offer you the following comments:
Happy flowing,
Koen