How to control infinite looping in Automation Anywhere? - automationanywhere

Using Automation Anywhere (AA), I am extracting medicine names and prices from this link:
https://www.chemistwarehouse.com.au/shop-online/238/anti-fungal-amp-warts
It returns 3 pages. While extracting the pattern based data from the website, AA code loops through all 3 pages. Upon reaching the last page i.e page 3, it does not stop and the loop goes on indefinitely.
I have watched many Youtube videos but can't seem to find the solution.
Since I am new to AA, I am unable to debug the issue.
I have tried to throw some arrows in the dark but all in vain, so need your help.
I expect that AA should stop after page 'n' and write the result in CSV.

I think maybe there's some logic you're missing.
But first, it looks like the website is to blame - if you were to go to https://www.chemistwarehouse.com.au/shop-online/238/anti-fungal-amp-warts?page=4 even though there's not 4 pages worth of options, it will take you to page 1's results. That's probably why it's infinitely looping.
Consider something like this - object cloning the table for each page. Page 1 and 2 have 8 rows, but page 3 does not. It has 2 rows. Make a variable that's true that gets checked at the top of your loop. If it's false, break the loop. Set it to false if there's less than 8 rows.
This does not solve the problem if your last page also has 8 rows, but you get the idea.

Related

Can I set up a Google Sheet to copy everything from another sheet, except for cells with a specific word count?

I have a Google Form set up, and anybody can submit a response an unlimited number of times. (It has to be this way. I can't make people log in.)
The issue is that there's a spammer who's using some website or bot to submit thousands of spam responses. I've tried using the captcha add-on from xfanatical (which adds a question that makes them fill out a particular code, which changes every minute), but the spammer figured out how to get past that.
One thing I've noticed, though, is that each spam submission is exactly 100 words. So one way I can think of to solve this is to have a sheet that returns all rows from the "Responses" sheet except for the rows where the submission is exactly 100 words.
Edit: I've also noticed that all the submissions start with a space, so that could be used too.
Let's say that your Responses 1 sheet has the answers in columns A, B, C, D, E etc. all the way to column Z
Let us now suppose that it is column C that holds the answers that start with a space.
Follow these steps:
Please create another tab and name it Clean.
Place the following formula in another cell A1
=QUERY('Clean'!A1:Z,"select * where not C matches '\s.*'")
Enjoy a spam free answer sheet :)
As mentioned by the OP, one can also use
=QUERY('Responses 1'!A1:Z,"select * where not C starts with ' '")
Functions used:
QUERY

How can I find the index of element in a database while querying only a few at at time?

I'm having some trouble trying to find a good and efficient algorithm for my use case.
Basically, I'm running a search into a database with ElasticSearch via Rails, and we have it set so that it can only return 25 results at a time (out of an approximate total of 5000), starting with the ID that you input (specified by a search_after parameter). I'm also inputting the ID of a certain search result, which I want the index of inside the overall database. The search has no way of knowing which page (of 25 results) it's actually on. We also have methods for finding the results immediately before and after it (which could probably also be modified to get results up to 25 before and after), regardless if it's on the first "page" (i.e. has an index of say, 26) or not.
Thus, it's fairly easy for the first 25 since you can simply do a search_after with the very first item in the overall database, but after that, I don't really know how to proceed.
I'd thought about simply upping the number of results to 26, then using modular arithmetic to check if it's the (n%25==1)th result, then changing the search_after to become the (n-1)th result, but I realized it wouldn't work if you directly click on any result after the first one to appear on the page. I also thought maybe I could use the aforementioned method to get the immediately previous search result and do a search_after on that, but then I quickly realized it would just return a 1 every time. Finally, I thought of simply stepping up the search_after until it finds the ID as the last result of the 25, and then using arithmetic to figure out what index it is, but obviously that's incredibly computationally intensive.
Let me know if any clarifications are needed, because I know it's a kind of odd question. Thank you.

Is there a way to make smart_listing jump to the last page at once?

I would like to make smart_listing jump to the last page by default, showing the most recent items, if no explicit page is given.
The only way I found to do this is to explicitly calculate the page number myself, like in
.../topics?topics_smart_listing[page]=17
I tried to use "total_pages" etc. on the collection, but apparently this doesn't work. Any suggestions on how I could get the maximum page count, without calculation it myself?

Delphi Rbuilder: Calculate value across multiple pages of data not just first and last page

I am using Rbuilder within a application constructed with Delphi. I have a report already built that displays a list of items but then at the bottom I have some subtotal fields as well as a total field. The subtotals and totals are defined as variables which then total up the cost of the individual items.
Unfortunately both the subtotals and totals only give me calculations for items on the first and last pages of data. Lets say there are 5 pages of data that prints out. Page one the totals are accurate.
Page two totals are accurate. Page 3 totals include ONLY the totals from page 1 and page 3. Page 4 total includes page 1 and page 4 and so on. I have been trying to play around with timing settings as well as moving my code calculating the total to different operations (ongettext, onprint, oncalc, etc)
Has anybody ever run into this?
Ok, so I kept working at this and eventually found the problem.
At the report level I changed the report from TwoPass to OnePass. That ended up giving me very close to what I wanted. I ended up having to write some more code to get exactly what I wanted but changing the number of passes worked.
I was trying to display a running total page by page. And as I changed pages it would update the value.
Onepass worked.

How can I get a report of all work items added to an iteration after a given date?

I need to produce a report, similar to the Unplanned Work report included with the MS Agile Process Template, but which lists me all work items which were added to an iteration after a given date.
The work item may have already been created before that date, so I can't used the created date.
Can anyone give any guidance on how I can go about this? If I can achieve it in Excel then that would be perfect...
Thanks.
Ok, took some work. Interesting enough though to put some effort in it ...
First screenshot is a Pivot table connected to the Analysis Cube. The most left colum shows the ID of a workitem. The second column shows the ChangeDate. In the row header I have included every iteration that I am interested in. What you see happening in the Excel sheet is items moving from one sprint to the other. For example, workitem 27 was created for iteration 1 at 14-3-2011. On 13-4-2011 it was moved to iteration 2. On 12-5-2011 it was moved to iteration 3. etc.
If I narrow down the filter to a specific iteration I actually see items entering the iteration and leaving the iteration. If I also change the ChangeDate filter, I can focus on items entering after a specific date, as you requested. Again, you can see item 27 enter iteration 2 at 13-4 and leave at 12-5. You can juggle around with the columns to get the view you want.
Finally, the options I used to get this view from TFS.
Hope this exceeds your expectations :-)

Resources