No rows in tableset

I get it. This part is not in this plant, so no rows are in the tableset.

But how do I make the function not crash when this happens? If there are no rows, I still want the function to keep processing (I’ll set the variable to false in that case).

Null doesn’t work.

Rows.count didn’t seem to be allowed in a widget.

I only want to use widgets, please. @Evan_Purdy?

Are you using GetByID?
If so GetByID will throw an exception when record is not found , change your widget to GetRows instead (no error)

1 Like

Just use the condition block and check if there is at least one updated row?

Have you tried tsPartPlant.Count? I think that might be what you want.

Fair warning, I am pretty ignorant on this stuff.

@josecgomez Yes, GetByID.

@Evan_Purdy Perhaps that answers your question also, but I tried tsPartPlant.Count and I get errors. (Expand the arrow.) I may have the syntax wrong.

Pics of errors

image

image

I looked at GetRows. That is intimidating. GetByID has a nice simple 3 parameters to deal with. GetRows has 26… You just do “ignore” for like almost everything?

I think if tsPartPlant is null then you’ll get an error.

1 Like

The error is coming from the GetByID call itself nothing after it is causing it. If you don’t want the error you need to stop using GetByID (or check if the record exists and skip the GetByID all together if it doesn’t)
To use GetRows you need to pass in a whereClause in your case for the PartPlant WhereClause you can leave the rest of the whereClauses as ignore that’s fine

Perhaps the easiest thing to do for you since you are taken a back by GetRows, is check if the record exists (yourself) by using a condition Query and if the record doesn’t exist then skip around the logic.

1 Like

Gotcha, I see that now. If GetByID will fail then using it will always crash the function, game over. I need to use it correctly or skip it altogether.

OK I think I get the concept now. Thank you all.

1 Like

Ah, it also would have helped if I had grabbed the right BO for GetRows:

Well that’s not so bad.

Bam! Got it.

I still need the condition block to check for rows, but it works now. Sweet.