I am working in a process that downloads file from website.
The process is to download all files related to CARD1 & CARD2 which is something like this:
CARD1 : p1, p2, p3, p5, p6
CARD2 : p1, p3, p3, p5, p6
I need to select CARD1 and download all files p1,p2 . . . . . and so on
AND same process goes for CARD2.
I want to store this in a list of Dictionary, where I have a condition, if not in list then proceed to download that file.
Robot will process CARD1 and download files p1 and appends to list, again CARD1 downloads p2, again CARD1 and download p3. Same process for CARD2.
The aim of doing this is, if there any system exception robot will try to download all files again which I don’t want to do, instead I use a condition where robot will have information about downloaded files.
Instead of using list of dictionary use a dictionary of lists that way you can store which files are downloaded for each item
first initilaize as
Dictionary(Of String,List(Of String))
dict("CARD1") = New List(Of String) and repeat same for CARD2
Now after download of each file use
dict("CARD1").ToList and append the file downloaded using append list and assign the new list to the required card again
so when you need you can directly check using contains
Hope this helps
will you please elaborate more ?
May be you can use string directly to add
dict = Dictionary(Of String,String)
- Add two keys
dict("CARD1") = "" and
dict("CARD2") = ""
- After download file use
dict(varCard) = "," + Filename here varCard contains the card1 or card2 …filename contains the file download P1,P2 etc any of these
- say you need to verifiy if Card1 P4 is downloaded you can use as follow
Dict("CARD1").ToString.Contains("P4") - This returns true if P4 is present in card1 else false
Hope this is clear
Then should i use for each two times ?
Each loop does the same sequence.
But I dont want to repeat same sequence twice.
I wanna do same sequence once while using for each loop
You can have two Orchestrator Queues, one for the master item CARD1 and CARD2, then in the second queue use the CARD1 & CARD2 as reference and add items P1, P2, P3. So if any exception on CARD1 while processing it will pick the one which are all not processed in the second queue.
If you dont want to download the file P3 again for CARD2, then add all the files to a CSV or txt file, then read it as a list and check for item exist, you can ignore the file to be downloaded again.
Why do you need to use two times…unless you are not using variables to control the card information