Trying to update a table using BO; can someone tell me why this

Via Visual Studio, this worked.

 

private void updateWareHouse()
               {
                   using (Session episession =
                        new Session("userid", "pass", "AppserverDC://server:port#", Epicor.Mfg.Core.Session.LicenseType.Default))
                   {
                       PO epiPO = new PO(episession.ConnectionPool);
                       PODataSet pods1 = epiPO.GetByID(int.Parse(txtPONum.Text));

                       /*
                        * To update a PO, first you will need to do the follwoing (Assuming the PO Order is closed):
                        * a.) ReOpenOrder(int PONUM)
                        * b.) ReOpenOrderLine(int PONUM, int POLine);
                        * c.) ReOpenRelease(int PONUM, int POLine, int PORelease)
                        */

                       for (int i = 0; i < pods1.PORel.Rows.Count; i++)
                       {
                                   if(pods1.PORel[i].POLine >=5 && pods1.PORel[i].POLine <=10)
                                   {
                                       pods1.PORel[i].BeginEdit();
                                        pods1.PORel[i].OpenRelease = true;
                                        pods1.PORel[i].WarehouseCode = "CDA";
                                        pods1.PORel[i].WarehouseCodeDescription = "Central Distribution Area";
                                        pods1.PORel[i].RowMod = "U";
                                        pods1.PORel[i].EndEdit();
                                        epiPO.Update(pods1);
                                   }
                       }
                   }  
               }

Trying to update a table using BO; can someone tell me why this is not working!!!

 

Below is my code via Visual Studio 2013

 

                private void UpdateReceipt()
                {
                    using(Session episession = new Session("userid","password", "AppserverDC://TGI-mycompany:9421", Epicor.Mfg.Core.Session.LicenseType.Default))
                    {
                        string whereClause = "PONum = '" + txtPONum.Text + "' and ReceivedTo = 'PUR-UKN' and WareHouseCode = '' ";
                        bool morePages = false;
                        Receipt recp = new Receipt(episession.ConnectionPool);
                       
                        ReceiptDataSet rds = recp.GetListReceipts(whereClause, 0, 0,out morePages);


                        for(int i = 0; i < rds.Tables[2].Rows.Count; i ++)
                        {
                            if (string.IsNullOrEmpty(rds.Tables[2].Rows[i]["WareHouseCode"].ToString()))
                            {
                                 rds.Tables[2].Rows[i]["WareHouseCode"] = "NS";
                                 rds.Tables[2].Rows[i]["BinNum"] = 1;
                                 rds.Tables[2].Rows[i]["RowMod"] = "A";
                                 recp.CommitRcvDtl(int.Parse(rds.Tables[2].Rows[i]["VendorNum"].ToString()),
                                                                             rds.Tables[2].Rows[i]["PurPoint"].ToString(),
                                                                                     rds.Tables[2].Rows[i]["PackSlip"].ToString(), rds);
                                 recp.Update(rds);
                            }

        
                        }


                     
                    }

                }

without deeply reviewing your code, RowMod cannot be A if you have retrieved it.  Try updating the row you have.

Hth,
Calvin

Sent from my Wireless 4G LTE DumbPhone

----- Reply message -----
From: "cyrilz199@..." <cyrilz199@...>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Subject: [Vantage] Trying to update a table using BO; can someone tell me why this is not working.
Date: Wed, Feb 26, 2014 5:27 PM

 

Trying to update a table using BO; can someone tell me why this is not working!!!

 

Below is my code via Visual Studio 2013

 

                private void UpdateReceipt()
                {
                    using(Session episession = new Session("userid","password", "AppserverDC://TGI-mycompany:9421", Epicor.Mfg.Core.Session.LicenseType.Default))
                    {
                        string whereClause = "PONum = '" + txtPONum.Text + "' and ReceivedTo = 'PUR-UKN' and WareHouseCode = '' ";
                        bool morePages = false;
                        Receipt recp = new Receipt(episession.ConnectionPool);
                       
                        ReceiptDataSet rds = recp.GetListReceipts(whereClause, 0, 0,out morePages);


                        for(int i = 0; i < rds.Tables[2].Rows.Count; i ++)
                        {
                            if (string.IsNullOrEmpty(rds.Tables[2].Rows[i]["WareHouseCode"].ToString()))
                            {
                                 rds.Tables[2].Rows[i]["WareHouseCode"] = "NS";
                                 rds.Tables[2].Rows[i]["BinNum"] = 1;
                                 rds.Tables[2].Rows[i]["RowMod"] = "A";
                                 recp.CommitRcvDtl(int.Parse(rds.Tables[2].Rows[i]["VendorNum"].ToString()),
                                                                             rds.Tables[2].Rows[i]["PurPoint"].ToString(),
                                                                                     rds.Tables[2].Rows[i]["PackSlip"].ToString(), rds);
                                 recp.Update(rds);
                            }

        
                        }


                     
                    }

                }

I just set RowMod to U and still it did not update. There could be something I am  missing as this update is not working. Fustrating, but I hav to learn.

It would help to know the error you are getting.
Thanks

On Feb 27, 2014 9:36 AM, <cyrilz199@...> wrote:

 
<div>
  
  
  <p>I just set RowMod to U and still it did not update. There could be something I am&nbsp; missing as this update is not working. Fustrating, but I hav to learn.</p>

</div>
 


<div style="color:#fff;min-height:0;"></div>
Not all together but some things to try.
Use beginedit and endedit on the row being updated
Try it without the commit.
And is your IF statement activating (finding something that makes it true)?

Jim Kinneman
Encompass Solutions, Inc/
Not getting any errors. Very bizarre 

Sent from my iPhone

On Feb 27, 2014, at 6:38 AM, Jose Gomez <jose@...> wrote:

 

<div id="ygrps-yiv-1191674868ygrp-text">
  
  
  <p></p><p dir="ltr">It would help to know the error you are getting.<br>

Thanks

On Feb 27, 2014 9:36 AM, <cyrilz199@...> wrote:

 
<div>
  
  
  <p>I just set RowMod to U and still it did not update. There could be something I am&nbsp; missing as this update is not working. Fustrating, but I hav to learn.</p>

</div>
 


<div style="color:#fff;"></div>

</div>
Not getting any errors at all; the code compiles. Here is what I am trying to do. From the Mass Receipt set an empty warehousecode to NS (NONSTOCK)  if I can't get the WareHouseCode from the PORel table.
The code compiles and executes? or just compiles? Do you step through the debugger?

also FWIW you can address teh data set by name instead of TABLE[2] like os


rds.TableName[row].Field = XX;


Try that and see if it works better.



Jose C Gomez
Software Engineer



T: 904.469.1524 mobile


Quis custodiet ipsos custodes?


On Thu, Feb 27, 2014 at 7:38 PM, <cyrilz199@...> wrote:

 
<div>
  
  
  <p>Not getting any errors at all; the code compiles. Here is what I am trying to do. From the Mass Receipt set an empty warehousecode to NS (NONSTOCK) &nbsp;if I can&#39;t get the WareHouseCode from the PORel table.</p>



</div>
 


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

How would you set it? what I have below is not valid at all.

 


rds.Tables["RcvDtl"].Rows[0].Field<"WareHouseCode"> = "NS"

erm.. 
Try this

rds.RcvDtl[0].WareHouseCode ="NS"



Jose C Gomez

Software Engineer


T: 904.469.1524 mobile


Quis custodiet ipsos custodes?


On Fri, Feb 28, 2014 at 2:42 PM, <cyrilz199@...> wrote:

 
<div>
  
  
  <p></p><p>How would you set it? what I have below is not valid at all.</p><p>&nbsp;</p><p><br>rds.Tables[&quot;RcvDtl&quot;].Rows[0].Field&lt;&quot;WareHouseCode&quot;&gt; = &quot;NS&quot;</p><p></p>

</div>
 


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