Help With Code

Could someone please review this and let me know why it is not returning anything?

What I am trying to do is check to see if there is any of the part reserved and unreserve it if it is. I am trying to build a string for a where clause, but when I put the variable in a message it is just blank. Many thanks in advance!!

var myDS = ds.OrderRel.Where(or=> or.RowMod == "A").FirstOrDefault();

if (myDS != null)
{
 var myRel = ds.OrderRel.Where(r=> r.OrderNum == myDS.OrderNum &&
                                  r.OrderLine == myDS.OrderLine &&
                                  r.OrderRelNum == 1).FirstOrDefault();

if (myRel != null)
{
  System.Text.StringBuilder sb = new System.Text.StringBuilder("OrderRel.PartNum >= \'");
  sb.Append(myRel.PartNum.ToString());
  sb.Append("\' and OrderRel.PartNum <= \'");
  sb.Append(myRel.PartNum.ToString());
  sb.Append("\'");
  myWhere = sb.ToString();
  //myWhere = "OrderRel.PartNum >= \'" + myRel.PartNum.ToString() + "\' and OrderRel.PartNum <= \'" + myRel.PartNum.ToString() + "\'";
}}

When is this running?

PostProcessing on GetNewOrderRel

For one thing, the single quote does not need to be escaped.

"'" not "\'"

I suspect the relbumber is zero at that point not one

Correct. I am trying to grab the first release on the line that is adding a new release.

Yep, 0

I don’t believe the dataset at this point will contain all other prior releases usually Epicor trims down the dataset

You may need to do a Db lookup

Easy test is display all rows in ds.OrderRel I suspect you’ll find it lacking

You you can getneworderrel there is no need for Epicor to ship the entire dataset

You are probably right! I always forget that. I’ll check now.

1 Like

Fix your single quotes too.

Get a life @klincecum is Sunday! :joy::joy::joy::joy:

The irony of that statement isn’t lost on me… we all need to go do something else

I actually was off of here, but I got back on after being frustrated with vrbo and expedia.
Can’t book anything, and I need to show off my beautiful pasty bod on the beach.

Hey, when stuff does not work, I just start throwing stuff into my code in the hopes it will work. :joy:

It happens to all of us.

Thanks @josecgomez (and you too KEVIN!). It’s always something easy.

1 Like