Using 'For each input work item' cycle twice

Hello, i have the next situation:

I have a robot with the producer-consumer format

on the consumer robot the cycle for the work items has to do the process of upload a file into a webpage, then extract a status from the same page, but now i have to separate it in two cycles:

  • one wich takes each work item to the upload task
  • a second one wich also takes each work item, but this time only to extract the status of the related file

after tried to use the ‘For each input work item’ keyword, but i noticed the fact it only works once, and on the second time, it does nothing, so i’m seeing wich options i can use to make a second cycle for the work items this time

Hi @Sylvaranth87

You didn’t show your test so i’m not sure what the problem you describe is, however this simple example (below) shows you can easily iterate a list of inputs as you described so hopefully this will help :crossed_fingers:t2:


*** Settings ***

*** Variables ***

@{WorkItems}	Item1	Item2	Item3	Item4	Item5	Item6	Item7	Item8

*** Test Cases ***

producer test
	FOR		${i}	IN 	@{WorkItems}
		Log 	Do producer upload task for ${i}

consumer test
	FOR		${i}	IN 	@{WorkItems}
		Log 	Do consumer extract status task for ${i}

i thought about using the data like that, but there’s an issue:

the json file wich details the work items it’s iterative based on the run of the robot (placed on a folder named after it like run-1, run-2, etc)


also just tried separating the consumer robot into 2 different robot executions:
first step in consumer.robot, to upload the files, wich works normal:

a second step inside a new file called verify.robot, to verify the status of the previous work, but the tasks are ignored by the ‘For Each Input Work Item’:

Hi @Sylvaranth87,

I wonder if RPA’s ‘For each input work item’ is doing something funny here not reading the file the second time (thinking it’s already read and processed the file) and removing the used items from the dictionary?

Can you parse the JSON file to a list/dictionary using standard libraries and then iterate that variable using the standard robot framework’s builtin for loop?

As i’ve not used them i’d not familiar with RPA’s libraries, so i’ll leave answering that to peiple familiar with the library.


i’m thinking the same, specially since if i open the json file, the dictionary is still there, so i’ll try to change from the dedicated work item RPA, to a common json file handling, i’ll tell the results later

1 Like