"Order Automation Not Moving to Next Order After Completion: Need Guidance"

I am working on an automation for purchase orders, where the goal is to query a database in an Excel spreadsheet that contains various information about products, the specific store, the supplier, quantities, and values. In this database, we have a unique identifier, which is the ‘Order ID’ column. This serves as a unique key to organize the orders for processing.

The automation understands that there are X products in that order and enters the specific store to process these products for that particular supplier Y.

The problem I’m facing, and have been stuck on for a few hours now, is the following situation: After processing the first order, the automation recognizes that the current order has been completed and needs to move on to the next one. However, in the file I provided, it identifies that the next order is different from the one previously processed. Yet, it does not follow the activity flow for that order. I’ve tried literally everything: used ChatGPT Plus, consulted forums, watched videos, etc.

I’m really lost and perhaps even desperate. I want to resolve this issue to continue the process, which involves saving the generated order number in the same spreadsheet.

I am attaching the Excel file and the complete script for analysis.

Thank you in advance.

Estou realizando uma automação de pedido de compra, onde o objetivo é consultar a base de dados que é planilha excel, que possuí várias informações sobre produtos, para qual loja, qual fornecedor, quantidades e valores. Nesta base de dados temos uma informação única que é a coluna ID Pedido é uma chave única que organiza os pedidos para lançamento.

A automação entende que existe X produtos naquele pedido e entra dentro da loja especifica para fazer o lançamento destes produtos para aquele fornecedor Y.

O Problema que estou encontrando e estou a algumas horas preso é a seguinte situação. Após o lançamento do primeiro pedido a automação entende que já foi finalizado o pedido atual e precisa seguir para o próximo pedido, no caso no arquivo que passei ela entende que o próximo pedido é diferente do que foi lançado anteriormente. Entretando ele não segue o fluxo de atividades para aquele pedido. Tentei literalmente de tudo, usei chatgpt plus, consultei foruns, videos, etc.

Realmente estou perdido e talvez desesperado, quero resolver essa situação para dar continuidade no processo, que seria salvar o numero do pedido gerado na mesma planilha.

Estou anexando o arquivo excel e o file completo para análise.

Obrigado desde já
Automação_Pedidos_Compra.zip (422.0 KB)
RPA-Pedido de Compra Siagri.xlsx (10.4 KB)
Main.xaml (180.4 KB)


image

Hi!

You want the process to only process the first row of the same ID Pedido and skip already processed ID Pedido’s?

Just checking if I’ve understood your issue.

Hello Sven,

The Excel database will have all the orders and products to be entered. The automation will follow each row, processing the orders based on the order ID for that entry. After completing that entry, it will move on to the next order ID and enter all the products for that order, continuing this process until the entire database is completed.

In the second image, where it shows the automation output, it processes the order 170023506 correctly, but when it updates the next order ID to start the entry, it does not execute the automation steps.

I managed to upload the automation to assist anyone interested in helping. If you have any questions about the process, feel free to ask. I’m new to this field and very excited about this first complicated challenge, haha.
Automação_Pedidos_Compra.zip (422.0 KB)

Ah, ok! I get it now!

I’ve found some issues in your code:

  1. the ‘rowIndex’ variable is present both in the Main Sequence and in Cabecalho

    Try deleting the one in Cabecalho, I think it confuses the automation regarding which of those it reads or writes to.
  2. What’s the reason behind having the while loops?
    You’re going row by row using the ‘for each row in datatable’ anyway and its CurrentRow variable contains all the information in that row.

Example, instead of using
pedidoAtual = dtPedidos.Rows(rowIndex)(“ID Pedido”).ToString()
Use:
pedidoAtual = CurrentRow(“ID Pedido”).ToString()

If you’re worried about processing rows which contain no information - use a filter datatable activity which removes all the empty rows:
image

A bit off-topic but:
You should also educate yourself in transactional processes and the REFramework.
How to Use Enhanced REFramework to Implement UiPath Projects | UiPath
Using a more structured approach and queues in orchestrator makes solutions both scalable and robust.

But let’s get back to the issue :slight_smile:

  1. I deleted the duplicated variable, ran the process again, but it didn’t work.
  2. The While Loops are used for validating the rows in the spreadsheet since the products are listed one by one, but they belong to different orders. The purpose of the while loop is to analyze the row and check if it’s still processing the same order.

Example:

Order ID A - Has 5 rows with 5 different products
Order ID B - Has 2 rows with 2 different products

Order A is organized first in the table, so the automation identifies it, launches the header for Order A, and opens the selection to add the products for the order. It adds the 5 different products and completes the order.

At this point, the automation needs to understand that Order A is completed, identify that the next row is for Order B, and start the process again. I’ve reached the point where the automation can identify Order B, but it doesn’t return to the beginning, which would be at the header, to start the whole process again.

I used ChatGPT a lot to help me develop this process, but I’ve ended up in an infinite loop with this situation that I can’t get out of.

Thank you for the suggestion, I’ll read it now!

I’m eagerly waiting to solve this problem.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.