How to handle message error : the given key is not found in the dictionary

Hello everyone,

Once again, I’m stuck ! I am working on a process for a client for who i need to report after treatment.
When the robot finish to process an item, i need to write the invoice number in a column (“invoice number”) and need to write “done” in the column “Status”.
The match is that the item “Société / Actif” equals the argument "in_Société_Asset.

My excel file has formulas in some column so i don’t know if it is the reason it is not working, I have the following message error : the given key is not found in the dictionary.

So, I tryed with the “Update row item” activity but i’m not used to it.

This is how my workflow is made (i have let both solutions)

Hope I’m clear, otherwise, I’m here to clarify my explanations.

Kind regards,

@ppr
@ClaytonM
@NIVED_NAMBIAR

@najoua.abbaci

with the input from your description and the trigger word argument "in_Société_Asset we come to following assumption:

there is a xaml which is invoked by another xaml.

As there is no dictionary etc. but the error message mentioned " the given key is not found in the dictionary" it is a hint that something with the passed arguments is wrong.

the the xaml which is called:

  • right definition of arguments
  • properly saved

chech the xaml which is invoking:

  • click import arguments
  • check rewire the arguments

Maybe already visually the import argiments indicates with another color that there were changes on the arguments

1 Like

“the given key is not found in the dictionary” usually means you are using a Queue Item or a Dictionary type. Since I don’t see any of those types used in your screenshots, we can only assume you are passing it in to the arguments.

So, check the argument values before and after the invoke of the xaml, to verify the keys or values are correct. And, check anywhere you are using a Queue item or Dictionary type variable, that has ("keyname") as part of the code

Other suggestions for updating the spreadsheet:

  • Place the For loop inside the Excel Scope, since you will be updating it.
  • Since you are not doing any processing of the row items, I suggest using an Excel Write Range outside of the For loop but inside the Excel scope.
  • To assign the value to the column, just use an Assign activity, like row("columnname") = in_Numero_Facture
    (the For loop will update the values in the datatable, then the Write Range updates the spreadsheet)
  • At the end of the Excel scope, use a Close Workbook activity

Note judging by your code, you are wanting to assign the argument to every row in the excel spreadsheet, so I’m assuming that is the case.

1 Like

Thank you @ClaytonM
I had to put the loop inside the Excel Scope and also, i didn’t use the right “write cell” activity (the one for the Excel).
Now it is working good.
Regards !
Najoua

Thank you @ppr, the issue was that the loop wasn’t inside the Excel scope.
Regards
Najoua

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.