BPM C# Editor - Expression should contain only one statement

Trying to build a BPM. Need to set a condition where if the part primary bin is set or not and return a true statement if so. False if not.

When I put the code in the editor I get:
“Expression should contain only on statement”

C# is not my main language but I’ve written plenty of other if/else lines of code in other languages and I cannot seem to get this one to work.

Here is the code:
if (dsPartWhseRow.PrimBinNum) {return true;}

Are you in a widget or custom code block? You will need to create a single line of code it sounds like. A screen shot or two would help me help you.

Resolved it.

(dsPartWhseRow.PrimBinNum != null) ? true : false

Issue now is if the bin isn’t set I get this error when the BPM runs.

“There are no records in the table ds.PartWhse”

Unsure how to handle that in the BPM.

You’re going to have to show some snippets of code/screenshots/more info for me to be able to help you. In words, what is it your BPM is supposed to do? What Business Object/Method are you using? What widgets?

Trying to figure out if a part has a primary bin or not. And then set it based on a number of factors.

I’ve more or less resolved the issue of figuring out if the part has a primary bin or not.

What I’m looking for now is, a BO method to list all the bins for a part. The BPM checks if the part has a primary bin, if it doesn’t it looks to check if the part has multiple bins with inventory, if it does, it doesn’t set the primary bin because there is too many variables as to which one of the bins to choose.

But as of right now, I have no idea as to what BO method should be used to pull down all the bins for a specific part number.

I’m not exactly sure which way to direct you. I can tell you that the PartBin table will list any locations with a non-zero quantity in it. PartBinInfo appears to list any location you’ve manually specified in the Part > Site > Warehouses > Bin Information tab. I’m not sure what method you’re looking for though. I did a quick trace and when I switch between warehouses in the Part Maintenance screen, it appears to run Part.GetPartOnHandWhse method. You might try that and see what it brings back.

I figured out the BO to invoke to get all the part bins. Should be able to get the rest from here. Just wanted to post in case someone else needs this.

image