Select item based on current month

image
Hello guys,
I need to select item at this list if it is available one month before the current month.
For example if we are at April, I have to select march 2021.
Any help will be appreciated
Thank you

now.AddMonths(-1).toString(“yyyy-MM”)

Thanks for helping.
I want to end the process if 2021-04 is not included at list.
How can I achieved?

in the most case we use find children to retrieve the available items from the dropdown. Based on this we can evaluate if to select item or not

we suggest to go for such a clear implementation instead of surrounding it with a try catch. Lets assume following:
IMP:

  • Try catch on select item
  • Bot selects item
  • in case of exception, Bot is flowing with intention of item is not present in dropdown

Scenario:
UI is changing, selector of dopdown is changed, but it was not recognized and adopted
Example: Select BB value from dropdown containing BB
Defect:

  • Due the changed selector select items fails for selecting BB (but present in List)
  • Bot flows as BB is not present in dropdown

So here we do see: Try catch is wrong applied and the xistence of any exception should not be rated as a particular state and used for flow decision if it is not reliable

3 Likes

U can also try catch mechanism too like in try section u can put the sequence for selecting item from list boxes

But if the item is not found in list then a error is thrown which is catched by catch section and process will ended

This way u can too try

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

1 Like

Thanks for help.
Appreciated

Unfortunately, I can not select the “2021-04” when it is stored at month variable. It says the item could not find.
Can you help me please?

please give some more details. What was done so far?

image


Sure,
When I try to select item as a variable “firstrow” It didn’t select item.
If I select from the menu 2021-04 it selected.
I hope I explained clearly.

20.10.5+Branch.master.Sha.02b152dbc2ae13baef9381b92f54812689540e53

Source: Select Item ‘SELECT period’ (Select Item ‘SELECT period’)

Message: Cannot select item. It was not found among existing items.
TIP: Some combo-boxes delay load items until its dropdown is expanded. Try to simulate a click on control prior to selecting an item.

Exception Type: UiPath.Core.ElementOperationException

RemoteException wrapping UiPath.Core.ElementOperationException: Cannot select item. It was not found among existing items.
TIP: Some combo-boxes delay load items until its dropdown is expanded. Try to simulate a click on control prior to selecting an item. —> RemoteException wrapping System.Runtime.InteropServices.COMException: Cannot select item. It was not found among existing items.
TIP: Some combo-boxes delay load items until its dropdown is expanded. Try to simulate a click on control prior to selecting an item.
at UiPath.UiNodeClass.Set(String bstrAttr, Object vValue)
at UiPath.Core.UiElement.Set(String attribute, Object value)
— End of inner exception stack trace —
at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

This is the error while I am using the variable

"2021-04 " there is space at the list variable. Is it something ralated with that?

I replaced the space with * and it works.
Thanks so much for your help