How to make program wait until data entry is complete?

My program enters data into a desktop application (Microsoft NAV client) from Excel, by copy-pasting.
The system is not extremely fast, and even if I paste a copied data, it still enters data one row at a time. When there is more than 100 rows in the excel sheet, it takes more than 1 minute to complete entering data into NAV.

Ideally, my program needs to wait until data pasting is completed, and then close the application. (I have a click event, that is supposed to click “OK” button, which will close the window)
However, my program just tries to click “OK” button even while the program is still pasting the data.

How could I make it wait? I cannot use Delay activity because I don’t know how long the program takes to finish pasting, and setting a specific delay time is not a good idea.

Also, I cannot use “Element Exists” because when copy-pasting is completed, there is no popup window.

1 Like

Actually I was about to suggest using element exists in any element that appears once after completing lasting but as we don’t have that option
still I thought of getting to the OK button like will it get enabled only after pasting all the values but it’s not so again it is getting clicked before completing pasting of data so that means it will be always enabled

Fine
We got a better option still
And let the sequence be like
— use a assign activity like
Rowcount = Yourdatatable.Rows.Count
Where Rowcount is a int32 variable
—Data entering from excel done inside the loop
— after taking the value from the excel column and after entering to the field use a assign activity like
Counter = Counter + 1
Where Counter is int32 variable of default value 0 defined in the variable panel
— till now we have not used click activity

yes now use a if condition next to this loop that is outside the loop
Where condition is
Counter = Rowcount**

Hope this would help you
Cheers @tomato25

1 Like

Continuation
——-
yes now use a if condition next to this loop that is outside the loop
Where condition is
Counter = Rowcount
If this condition passes it will foto THEN part where we can keep the click activity and press ok
If condition doesn’t passes it will go to ELSE part where let’s leave it empty so that it won’t click for sure

Cheers @tomato25

1 Like

Not saying this is the best way to go about it, but you could try this:

  1. Figure out what the very last thing is that’s being pasted (likely bottom right cell in excel) and save that as a string variable (i’ll call it LastExcelData).
  2. After copy+pasting into your application, run a do while loop as follows:
    DO
    read text in correct location in application. Save this as a string variable i'll call LastAppData.
    While
    Not(String.Equals(LastExcelData.Trim,LastAppData.Trim,OrdinalIgnoreCase))
  3. Click OK button
1 Like

I don’t have a loop to enter data from Excel.
I copy a range of cells in Excel, and just paste it into the desktop application.

So there is no loop. It all happens once. I can still get the number of rows from the Excel, but there is no way to check how many rows have been entered in the desktop application…

Unfortunately, this won’t work because data we have have many similar values. Sometimes, there are rows that are completely identical, so even checking one whole row won’t work.

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