Reading Erp.Plant table from BPM

Thanks a lot, Jose.
I have problem reading Plant table in BPM. The following are two block of code reading ShipTo and Plant table. The part reading ShipTo works OK, the part reading Plant generates error

string sRep = "";
var qryShipTo = (from Erp_ShipTo in Db.ShipTo
                 where
                 Erp_ShipTo.Company == "ABC" &&
                 Erp_ShipTo.CustNum == 123 &&
                 Erp_ShipTo.ShipToNum == "S001"
                 select new { Erp_ShipTo.SalesRepCode });
foreach (var q in qryShipTo)
{
   sRep = q.SalesRepCode;
}

string sComment = "";
var qryPlant = (from Erp_Plant in Db.Plant
                where
                Erp_Plant.Company == "ABC" &&
                Erp_Plant.Plant == "MfgSys"
                select new { Erp_Plant.CommentText });

foreach (var r in qryPlant)
{
   sComment = r.CommentText;
}

Here is the error message

Error Detail
============
Description:  There is at least one compilation error.
Details: 
Error CS1593: Delegate 'System.Func<Erp.Tables.Plant,int,bool>' does not take 1 arguments [PostTran.mpPackageLabelTe.cs(78,17)]
Error CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type [PostTran.mpPackageLabelTe.cs(78,17)]
Error CS1061: 'Erp.Tables.Plant' does not contain a definition for 'Plant' and no extension method 'Plant' accepting a first argument of type 'Erp.Tables.Plant' could be found (are you missing a using directive or an assembly reference?) [PostTran.mpPackageLabelTe.cs(80,27)]

Thanks in advance for any insight into this



var qryPlant = (from Erp_Plant in Db.Plant
               where
               Erp_Plant.Company == "ABC" &&
               Erp_Plant.Plant1 == "MfgSys"
               select new { Erp_Plant.CommentText });

in .NET when the Key has the same name as the Table the class can't use it so they append a 1





Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Thu, Aug 25, 2016 at 4:46 PM, yzou79@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p>I have problem reading Plant table in BPM. The following are two block of code reading ShipTo and Plant table. The part reading ShipTo works OK, the part reading Plant generates error<br><br>string sRep = &quot;&quot;;<br>var qryShipTo = (from Erp_ShipTo in Db.ShipTo<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  where<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Erp_ShipTo.Company == &quot;ABC&quot; &amp;&amp;<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Erp_ShipTo.CustNum == 123 &amp;&amp;<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Erp_ShipTo.ShipToNum == &quot;S001&quot;<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  select new { Erp_ShipTo.SalesRepCode });<br>foreach (var q in qryShipTo)<br>{<br>Â Â  sRep = q.SalesRepCode;<br>}<br><br>string sComment = &quot;&quot;;<br>var qryPlant = (from Erp_Plant in Db.Plant<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  where<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Erp_Plant.Company == &quot;ABC&quot; &amp;&amp;<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Erp_Plant.Plant == &quot;MfgSys&quot;<br>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  select new { Erp_Plant.CommentText });<br><br>foreach (var r in qryPlant)<br>{<br>Â Â  sComment = r.CommentText;<br>}<br><br>Here is the error message<br><br>Error Detail <br>============<br>Description:Â  There is at least one compilation error.<br>Details:Â  <br>Error CS1593: Delegate &#39;System.Func&lt;Erp.Tables.Plant, int,bool&gt;&#39; does not take 1 arguments [PostTran.mpPackageLabelTe.cs( 78,17)]<br>Error CS1660: Cannot convert lambda expression to type &#39;string&#39; because it is not a delegate type [PostTran.mpPackageLabelTe.cs( 78,17)]<br>Error CS1061: &#39;Erp.Tables.Plant&#39; does not contain a definition for &#39;Plant&#39; and no extension method &#39;Plant&#39; accepting a first argument of type &#39;Erp.Tables.Plant&#39; could be found (are you missing a using directive or an assembly reference?) [PostTran.mpPackageLabelTe.cs( 80,27)]<br><br>Thanks in advance for any insight into this<br><br><br></p><p><span><br></span></p><p></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>