Update Company tables fields

Thanks Jose, this is what I have now and appears to work.

Private Function GetNextKey(ByVal company As String) As String
   Dim nextKey As String = String.Empty
   Try
      Dim sessMod As New SessionMod(ProjectEntryForm.Session.ConnectionPool)
      sessMod.GracefulShutdown()
      sessMod.SetCompany(company, "", "", "", "", "", "", "", "")
      sessMod.SetPlant("MfgSys", "")
      Dim co as company = new company(ProjectEntryForm.Session.ConnectionPool)
      Dim cds as companydataset = co.GetByID(company)
         nextKey = cds.Company.Rows(0)("Number05").toString()
         cds.Company.Rows(0).BeginEdit()
         cds.Company.Rows(0)("Number05") += 1
         cds.Company.Rows(0).EndEdit()
         co.Update(cds)
   Catch ex As Exception
      EpiMessageBox.Show(ex.Message)
   End Try
   Return nextKey
End Function




________________________________
From: Jose Gomez <jose@...>
To: Vantage <vantage@yahoogroups.com>
Sent: Monday, December 3, 2012 10:16 AM
Subject: Re: [Vantage] Re: Update Company tables fields

Do this before your code
, Youll have to Birng in the Session Mod Bo's and IF

SessionMod SessionMod = new SessionMod(session.ConnectionPool);****

** **

          SessionMod.GracefulShutdown();****

          SessionMod.SetCompany('YOURCOMPANY', out name, out
plantid, out plant, out workstationid, out workstation, out employee, out
groupcode, out countrycode);****

          SessionMod.SetPlant(plantid, out plant);


*Jose C Gomez*
*Software Engineer*
*
*
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
 <http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
 <http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
 <http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*



On Mon, Dec 3, 2012 at 10:08 AM, jckinneman <jckinneman@...> wrote:

> **
>
>
> The company table is a bit of a special bird. Almost all business objects
> know what company you are current working in. That is why you don't need to
> specify it on where clauses and the like. I hazard a guess that this
> behavior is interfering with getting another company. You could
> programmaticly change the company you are working with briefly, make the
> change and then set it back but that might be messy and confuse the current
> transaction.
>
> If you just need to increment the field I would use a BPM and then a
> simple find on the company table and then update the field of interest.
> Other option is a direct progress call to do the update.
>
> Jim Kinneman
> Encompass Solutions, Inc
>
>
> --- In vantage@yahoogroups.com, "tkoch77" <tkoch77@...> wrote:
> >
> > Hi all,
> >
> > I am trying to use Company.GetByID to return the CompanyDataSet and then
> updating a UD field. It works fine when the company ID is the current
> company but fails if I try to perform GetByID on a company other than the
> current company (Logged in company 100 and trying GetByID on company 200).
> Here is what I have, is there something I am missing?
> >
> > Thanks,
> >
> > -Ted
> >
> >
> > Private Function GetNextKey(ByVal company As String) As String
> > Dim nextKey As String = String.Empty
> > Try
> > Dim co as company = new company(ProjectEntryForm.Session.ConnectionPool)
> > Dim cds as companydataset = co.GetByID(company)'Fails here
> > nextKey = cds.Company.Rows(0)("Number05").toString()
> > cds.Company.Rows(0).BeginEdit()
> > cds.Company.Rows(0)("Number05") += 1
> > cds.Company.Rows(0).EndEdit()
> > co.Update(cds)
> > Catch ex As Exception
> > EpiMessageBox.Show(ex.Message)
> > End Try
> > Return nextKey
> > End Function
> >
>

>


[Non-text portions of this message have been removed]



------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note:Â You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.%c2%a0
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links



[Non-text portions of this message have been removed]
Hi all,

I am trying to use Company.GetByID to return the CompanyDataSet and then updating a UD field. It works fine when the company ID is the current company but fails if I try to perform GetByID on a company other than the current company (Logged in company 100 and trying GetByID on company 200). Here is what I have, is there something I am missing?

Thanks,

-Ted


Private Function GetNextKey(ByVal company As String) As String
Dim nextKey As String = String.Empty
Try
Dim co as company = new company(ProjectEntryForm.Session.ConnectionPool)
Dim cds as companydataset = co.GetByID(company)'Fails here
nextKey = cds.Company.Rows(0)("Number05").toString()
cds.Company.Rows(0).BeginEdit()
cds.Company.Rows(0)("Number05") += 1
cds.Company.Rows(0).EndEdit()
co.Update(cds)
Catch ex As Exception
EpiMessageBox.Show(ex.Message)
End Try
Return nextKey
End Function
The company table is a bit of a special bird. Almost all business objects know what company you are current working in. That is why you don't need to specify it on where clauses and the like. I hazard a guess that this behavior is interfering with getting another company. You could programmaticly change the company you are working with briefly, make the change and then set it back but that might be messy and confuse the current transaction.

If you just need to increment the field I would use a BPM and then a simple find on the company table and then update the field of interest. Other option is a direct progress call to do the update.

Jim Kinneman
Encompass Solutions, Inc

--- In vantage@yahoogroups.com, "tkoch77" <tkoch77@...> wrote:
>
> Hi all,
>
> I am trying to use Company.GetByID to return the CompanyDataSet and then updating a UD field. It works fine when the company ID is the current company but fails if I try to perform GetByID on a company other than the current company (Logged in company 100 and trying GetByID on company 200). Here is what I have, is there something I am missing?
>
> Thanks,
>
> -Ted
>
>
> Private Function GetNextKey(ByVal company As String) As String
> Dim nextKey As String = String.Empty
> Try
> Dim co as company = new company(ProjectEntryForm.Session.ConnectionPool)
> Dim cds as companydataset = co.GetByID(company)'Fails here
> nextKey = cds.Company.Rows(0)("Number05").toString()
> cds.Company.Rows(0).BeginEdit()
> cds.Company.Rows(0)("Number05") += 1
> cds.Company.Rows(0).EndEdit()
> co.Update(cds)
> Catch ex As Exception
> EpiMessageBox.Show(ex.Message)
> End Try
> Return nextKey
> End Function
>
Do this before your code
, Youll have to Birng in the Session Mod Bo's and IF

SessionMod SessionMod = new SessionMod(session.ConnectionPool);****

** **

SessionMod.GracefulShutdown();****

SessionMod.SetCompany('YOURCOMPANY', out name, out
plantid, out plant, out workstationid, out workstation, out employee, out
groupcode, out countrycode);****

SessionMod.SetPlant(plantid, out plant);


*Jose C Gomez*
*Software Engineer*
*
*
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
<http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
<http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
<http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*



On Mon, Dec 3, 2012 at 10:08 AM, jckinneman <jckinneman@...> wrote:

> **
>
>
> The company table is a bit of a special bird. Almost all business objects
> know what company you are current working in. That is why you don't need to
> specify it on where clauses and the like. I hazard a guess that this
> behavior is interfering with getting another company. You could
> programmaticly change the company you are working with briefly, make the
> change and then set it back but that might be messy and confuse the current
> transaction.
>
> If you just need to increment the field I would use a BPM and then a
> simple find on the company table and then update the field of interest.
> Other option is a direct progress call to do the update.
>
> Jim Kinneman
> Encompass Solutions, Inc
>
>
> --- In vantage@yahoogroups.com, "tkoch77" <tkoch77@...> wrote:
> >
> > Hi all,
> >
> > I am trying to use Company.GetByID to return the CompanyDataSet and then
> updating a UD field. It works fine when the company ID is the current
> company but fails if I try to perform GetByID on a company other than the
> current company (Logged in company 100 and trying GetByID on company 200).
> Here is what I have, is there something I am missing?
> >
> > Thanks,
> >
> > -Ted
> >
> >
> > Private Function GetNextKey(ByVal company As String) As String
> > Dim nextKey As String = String.Empty
> > Try
> > Dim co as company = new company(ProjectEntryForm.Session.ConnectionPool)
> > Dim cds as companydataset = co.GetByID(company)'Fails here
> > nextKey = cds.Company.Rows(0)("Number05").toString()
> > cds.Company.Rows(0).BeginEdit()
> > cds.Company.Rows(0)("Number05") += 1
> > cds.Company.Rows(0).EndEdit()
> > co.Update(cds)
> > Catch ex As Exception
> > EpiMessageBox.Show(ex.Message)
> > End Try
> > Return nextKey
> > End Function
> >
>
>
>


[Non-text portions of this message have been removed]