How to know the length of work items in present queue? (not individual workitem)

Hey Hi team, i am new to Robocorp, currently i am working on producer-consumer model.
I want to know , if there is any function to get length of workitem queue?. i am getting individual dict if i try to run get input work item…is there any way to get all work items?

Hi Sai,

The BuiltIn Get Lengthcan be used on any variable type that has a length, like strings and lists.

However you mentioned you are getting a Dictionary back and those don’t have a length property.

Fortunately a python dictionary will return the keys as a list that you can get a count on. You can do either of these:

  • you can use the python .keys() function → ${mydict.keys()}
  • or you can use the Get Dictionary Keys keyword from Collections Library


Here’s a demo of both methods:

*** Settings ***
Library 	Collections

*** Variables ***

&{exampledict}		"key1"="value1" 	"key2"="value2" 	"key3"=3 	"key4"=4 	"key5"=5

*** Test Cases ***
saiganesh-d Dict
	Log 	${exampledict}
	Log 	${exampledict.keys()}
	Get Length		${exampledict.keys()}
	${keys}=		Get Dictionary Keys		${exampledict}
	Get Length		${keys}


For access in Robocorp queues and workitems, you can use RPA.Robocorp.Process library. There is keywords to retrieve information from control room