# MES Report Quantity BPM

**URL:** <https://www.epiusers.help/t/mes-report-quantity-bpm/113128>\
**Category:** Kinetic ERP\
**Tags:** customization, e10, bpm\
**Created:** [March 26, 2024, 3:45pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128 "2024-03-26T15:45:52Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will79](https://www.epiusers.help/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@Will79](https://www.epiusers.help/u/Will79)\
**Post date:** [March 26, 2024, 3:45pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/1 "2024-03-26T15:45:52Z")

</div>

I am trying to use a BPM on the Report Quantity Method to stop over reporting qty. My though tis to say if the production qty is less than or equal to current + completed, all good; if false, then error out. However, I can’t seem to get the production qty in the BPM. That seems to require some method with JobHead info or JobMtl. For JobMtl I need the mtlseq which i don’t have in Report Qty method. Any other ideas or ways of getting this done?

---

<div class="post-metadata">

**Author:** ![itsme](https://www.epiusers.help/user_avatar/www.epiusers.help/itsme/32/67067_2.png) [@itsme](https://www.epiusers.help/u/itsme)\
**Post date:** [March 26, 2024, 8:03pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/2 "2024-03-26T20:03:52Z")

</div>

We have this at LaborDtl data directive:

> Erp.Tables.LaborDtl LaborDtl;  
> Erp.Tables.LaborDtl LaborDtl1;  
> Erp.Tables.JobAsmbl JobOpDtl;  
> string Company = “”;  
> decimal LaborQty = 0.0m;  
> decimal LaborQty1 = 0.0m;  
> decimal LaborQty2 = 0.0m;  
> int OperationSeq = 0;  
> int LaborSeqDtl = 0;  
> decimal ProductionQty = 0.0m;  
> foreach (var ttLaborDtl\_iterator in (from ttLaborDtl\_Row in ttLaborDtl  
> where string.Equals(ttLaborDtl\_Row.RowMod, IceRow.ROWSTATE\_ADDED, StringComparison.OrdinalIgnoreCase) || string.Equals(ttLaborDtl\_Row.RowMod, IceRow.ROWSTATE\_UPDATED, StringComparison.OrdinalIgnoreCase)  
> select ttLaborDtl\_Row))  
> {  
> var ttLaborDtlRow = ttLaborDtl\_iterator;  
> if (ttLaborDtlRow.LaborType == “P” )  
> {  
> Company = ttLaborDtlRow.Company;  
> LaborSeqDtl = ttLaborDtlRow.LaborDtlSeq;  
> LaborQty = ttLaborDtlRow.LaborQty;  
> JobOpDtl = (from JobOpDtl\_Row in Db.JobAsmbl  
> where string.Compare(JobOpDtl\_Row.Company,ttLaborDtlRow.Company, true) == 0 &&  
> JobOpDtl\_Row.JobNum == ttLaborDtlRow.JobNum && JobOpDtl\_Row.AssemblySeq == ttLaborDtlRow.AssemblySeq  
> select JobOpDtl\_Row).FirstOrDefault();  
> if (JobOpDtl != null)  
> {  
> ProductionQty = JobOpDtl.RequiredQty;  
> }  
> foreach (var LaborDtl1\_iterator in (from LaborDtl1\_Row in Db.LaborDtl  
> where LaborDtl1\_Row.Company == Company && LaborDtl1\_Row.JobNum == ttLaborDtlRow.JobNum && LaborDtl1\_Row.AssemblySeq == ttLaborDtlRow.AssemblySeq && LaborDtl1\_Row.OprSeq == ttLaborDtlRow.OprSeq && LaborSeqDtl != LaborDtl1\_Row.LaborDtlSeq  
> select LaborDtl1\_Row))  
> {  
> LaborDtl1 = LaborDtl1\_iterator;

```
					       LaborQty2 = LaborQty2 + LaborDtl1.LaborQty;     
					   
					   }
LaborQty2 = LaborQty2 + LaborQty;

if (LaborQty2 > ProductionQty)
{
     object THROW_PRIVATE = null;
           CallContext.Current.ExceptionManager.AddBLException("Labor qty would not be more than production qty.");
           THROW_PRIVATE = null;
} 

```

}  
}

---

<div class="post-metadata">

**Author:** ![Will79](https://www.epiusers.help/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@Will79](https://www.epiusers.help/u/Will79)\
**Post date:** [March 26, 2024, 8:50pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/3 "2024-03-26T20:50:00Z")

</div>

> [@itsme](#):
>
> }  
> }

I made some changes where needed and am still getting one error I can’t figure out…

Operator ‘==’ cannot be applied to operands of type ‘string’ and ‘char’

---

<div class="post-metadata">

**Author:** ![Doug.C](https://www.epiusers.help/user_avatar/www.epiusers.help/doug.c/32/26714_2.png) [@Doug.C](https://www.epiusers.help/u/Doug.C)\
**Post date:** [March 26, 2024, 9:20pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/4 "2024-03-26T21:20:19Z")

</div>

> [@itsme](#):
>
> string Company = “”;  
> …  
> if (ttLaborDtlRow.LaborType == “P” )

Make sure you have regular quotes here. Without encoding the code in the post with the CS block, it converted it into the “formatted” open/closed quotes.

````auto
```CS
string Company = "";
...
if (ttLaborDtlRow.LaborType == "P" )
```

````

---

<div class="post-metadata">

**Author:** ![Will79](https://www.epiusers.help/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@Will79](https://www.epiusers.help/u/Will79)\
**Post date:** [March 27, 2024, 3:27pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/5 "2024-03-27T15:27:04Z")

</div>

So have those fixed, but still getting these errors. Here are picks of what I have and the errors.

 ![image](https://www.epiusers.help/uploads/default/original/3X/d/a/da88d3c80b119798a463a5ed111998ea5959985f.png)  
 ![image](https://www.epiusers.help/uploads/default/original/3X/2/d/2d923de11c95b264723df5d8c118e49ee68d8c35.png)

---

<div class="post-metadata">

**Author:** ![Doug.C](https://www.epiusers.help/user_avatar/www.epiusers.help/doug.c/32/26714_2.png) [@Doug.C](https://www.epiusers.help/u/Doug.C)\
**Post date:** [March 27, 2024, 3:33pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/6 "2024-03-27T15:33:40Z")

</div>

This is what you have:

```cs
string Company = '???';
...
if (ttLaborDtlRow.LaborType == 'P' )

```

It should be

```cs
string Company = "???";
...
if (ttLaborDtlRow.LaborType == "P" )

```

The single quote (') is used for the character data type in C#, the double quote (") is used for strings.

---

<div class="post-metadata">

**Author:** ![Will79](https://www.epiusers.help/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@Will79](https://www.epiusers.help/u/Will79)\
**Post date:** [March 27, 2024, 3:41pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/7 "2024-03-27T15:41:19Z")

</div>

Ok…got it! Made those changes, and have this final little bugger.

![image](https://www.epiusers.help/uploads/default/original/3X/b/a/ba2eb8f650e0ea55b3ab07f63fb244e53ad95e60.png)

 ![image](https://www.epiusers.help/uploads/default/original/3X/8/6/86af25f00d101af2f40c98dc7df51701a8c4236f.png)

---

<div class="post-metadata">

**Author:** ![Doug.C](https://www.epiusers.help/user_avatar/www.epiusers.help/doug.c/32/26714_2.png) [@Doug.C](https://www.epiusers.help/u/Doug.C)\
**Post date:** [March 27, 2024, 3:46pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/8 "2024-03-27T15:46:10Z")

</div>

You only have one `=` in the test for “P” … it needs to be `==`

It should be

```cs
if (ttLaborDtlRow.LaborType == "P" )

```

---

<div class="post-metadata">

**Author:** ![Will79](https://www.epiusers.help/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@Will79](https://www.epiusers.help/u/Will79)\
**Post date:** [March 27, 2024, 3:48pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/9 "2024-03-27T15:48:37Z")

</div>

@Doug.C @itsme

Thanks! Lastly, did you use any rules with the  
custom code? I’m thinking just use the standard Once passing all matching rows.

Actually, I’ve been relooking over and had another question. First, I am not super sharp on coding. With that being said, do I need to take LaborDtl1or anything else a variable on the variables tab of the Custom code?

I’m asking because it doesn’t seem to work. I am using an in transaction Data Directive on LaborDtl.

---

<div class="post-metadata">

**Author:** ![Will79](https://www.epiusers.help/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@Will79](https://www.epiusers.help/u/Will79)\
**Post date:** [March 28, 2024, 3:24pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/10 "2024-03-28T15:24:49Z")

</div>

Going to try to pass this to a variable and see how that works. Hoping this will work. Still learning coding…

UPDATE: This only returns false for everything. There is something wrong on the LaborDtl1 = LaborDtl1\_iterator;

```
             LaborQty2 = LaborQty2 + LaborDtl1.LaborQty;     
         
         }

```

LaborQty2 = LaborQty2 + LaborQty;

but not sure where. Any help is appreciated.

```auto
Erp.Tables.LaborDtl LaborDtl;
Erp.Tables.LaborDtl LaborDtl1;
Erp.Tables.JobAsmbl JobOpDtl;
string Company = "";
decimal LaborQty = 0.0m;
decimal LaborQty1 = 0.0m;
decimal LaborQty2 = 0.0m;
int OperationSeq = 0;
int LaborSeqDtl = 0;
decimal ProductionQty = 0.0m;
foreach (var ttLaborDtl_iterator in (from ttLaborDtl_Row in ttLaborDtl
where string.Equals(ttLaborDtl_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase) || string.Equals(ttLaborDtl_Row.RowMod, IceRow.ROWSTATE_UPDATED, StringComparison.OrdinalIgnoreCase)
select ttLaborDtl_Row))
{
var ttLaborDtlRow = ttLaborDtl_iterator;
if (ttLaborDtlRow.LaborType == "P")
{
Company = ttLaborDtlRow.Company;
LaborSeqDtl = ttLaborDtlRow.LaborDtlSeq;
LaborQty = ttLaborDtlRow.LaborQty;
JobOpDtl = (from JobOpDtl_Row in Db.JobAsmbl
where string.Compare(JobOpDtl_Row.Company,ttLaborDtlRow.Company, true) == 0 &&
JobOpDtl_Row.JobNum == ttLaborDtlRow.JobNum && JobOpDtl_Row.AssemblySeq == ttLaborDtlRow.AssemblySeq
select JobOpDtl_Row).FirstOrDefault();
if (JobOpDtl != null)
{
ProductionQty = JobOpDtl.RequiredQty;
}
foreach (var LaborDtl1_iterator in (from LaborDtl1_Row in Db.LaborDtl
where LaborDtl1_Row.Company == Company && LaborDtl1_Row.JobNum == ttLaborDtlRow.JobNum && LaborDtl1_Row.AssemblySeq == ttLaborDtlRow.AssemblySeq && LaborDtl1_Row.OprSeq == ttLaborDtlRow.OprSeq && LaborSeqDtl != LaborDtl1_Row.LaborDtlSeq
select LaborDtl1_Row))
{
LaborDtl1 = LaborDtl1_iterator;

                 LaborQty2 = LaborQty2 + LaborDtl1.LaborQty;     
             
             }
LaborQty2 = LaborQty2 + LaborQty;
bool Overs;

if (LaborQty2 > ProductionQty)
{
     Overs = true;
} 
else
{
  Overs = false;
}
}
}

```

---

<div class="post-metadata">

**Author:** ![kve](https://www.epiusers.help/user_avatar/www.epiusers.help/kve/32/76150_2.png) [@kve](https://www.epiusers.help/u/kve)\
**Post date:** [March 28, 2024, 5:21pm UTC](https://www.epiusers.help/t/mes-report-quantity-bpm/113128/11 "2024-03-28T17:21:06Z")

</div>

It looks like `LaborDtl1` is a table, and `ttLaborDtl1_iterator` is a row, that might be where your problem is, I’m not sure.
