Object reference not set to an instance of an object NullOrEmpty First Or Default

Hi!, im trying to figure out why this is trowing an error

So basicaly i filter a text with REGEX and get a result that is stored in regexFilter, then i want the first result , if there is no result we assign to a variable “No se pudo obtener” or We cannot obtain, else you assign to a variable RegexFilter.FirstOrDefault .

Hey @Joacobracci

You need to figure out what is not set to an “instance”.

Follow these steps to help you figure it out.

Step 1:
Press F9 on that IF Statement. This will insert a “red circle” known as a breakpoint.
image

Step 2:
Start your workflow in debug mode.
image

Step 3:
When your process stops at the IF Statement, open the “Locals” Pane (in the top left) and check the variables. You need to check their values.
image

Step 4:
Open the “Immediate” pane (next to Locals pane) to test/check your logic from the IF Statement and any other steps.
image

Step 5:
Click “Step Into” (or F11) to watch the robot work “step by step”. You can then check the Locals and Immediate panes at each step.
image

Hopefully this helps,

Cheers

Steve

HI,

Can you try the following expression as the following image?

regexFilter.FirstOrDefault is Nothing OrElse String.IsNullOrEmpty(regexFilter.FirstOrDefault.Value)

Regards,

i solved it with a most simple solution that was, if regexFilter.Count > 0

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