Lookup Data Table result not found

Hi everyone,

I have a lookup data table where the lookup variable is based on a report where a user picks one of two options. Sometimes that entry isn’t found, and in those cases I want to try the other option.

It runs through several lines on the report before it comes across one where it can’t match the entry.
Then it always crashes.

When I set up the if statement after the lookup, I tried a few things and nothing works:

  1. IF: str_LookupResult = “”
  2. IF: string.isnullorempty(str_LookupResult.trim)
  3. IF str_LookupResult is nothing

all of these return an “Object reference not set to an instance of the object” error highlighting the “If”.

I tried doing an assign before the lookup, declaring str_LookupResult = “something”,
then setting my IF: "str_LookupResult = “something” " in case it just didn’t touch it when it returns nothing… still get the same error message. I’m very confused.

What does the lookup data table return if it doesn’t match anything in the table?

Thanks,
Ryan

Hi @Astrys,
I encountered the same situation, it turns out it returns -1 if it doesn’t match anything.

Hope this helps

2 Likes

yo have to initialize your variable first in order to not get the error of “object reference…” then use look up and if this doesnt match anything then this give you your initial variable like this:

assign: LookupResult = “” (or nothing, just as example)
look up : does not match
if: LookupResult.tostring.equals(“
”) then … if not it’ll give you new result of cellvalue

like an extra advise make this variable type LookupResult genericValue