Index
2011-12-24 14:58 – John Fabiani : [dabo-users] something wrong with bizobj.moveToPK()
2011-12-24 18:09 – Jacek Kałucki : Re: [dabo-users] something wrong with bizobj.moveToPK()
2011-12-24 18:19 – Jacek Kałucki : Re: [dabo-users] something wrong with bizobj.moveToPK()
2011-12-24 19:13 – John Fabiani : Re: [dabo-users] something wrong with bizobj.moveToPK()
Back to top
[dabo-users] something wrong with bizobj.moveToPK()

Author: John Fabiani

Posted: 2011-12-24 14:58:40   Link

Hi,

I was doing a little work today and discovered a bug (??) with moveToPK() - It

appears that it does not completely retrieve all the data???? The table in

question is a child and I'm trying to move to a record when the users select a

different PK and refresh the screen with the new child data. I can't explain

this!

openSUSE 12.1, python 2.7, wxpython 2.8.11, latest Dabo.

def updateVoyageScreen(self, KeyValue):

loc_cur = self.pwvoyage.getTempCursor()

loc_cur.execute('select * from warehouse.pwvoyage where pkid = %s' %

(KeyValue))

myds = loc_cur.getDataSet()

print myds[0]['pkid']

print myds[0]['tduein']

self.pwvoyage.moveToPK(KeyValue)

print self.pwvoyage.Record.pkid

print self.pwvoyage.Record.tduein

dabo.ui.callAfter(self.update)

The output from above is:

1102 #this is the PK

2009-11-20 # a date field (correct)

1102 #this is the PK after moveToPK

2008-07-25 #this is a old date from a different record. Not correct!

As you can see the dates do not match - but the pk's match???

bizobj define:

\class WarehousepwvoyageBizobj(dabo.biz.dBizobj):

def afterInit(self):

self.DataSource = "warehouse.pwvoyage"

self.KeyField = "pkid"

self.addFrom("warehouse.pwvoyage")

self.addField("mnotes")

self.addField("cvoyage")

self.addField("cvoyage_sfx")

self.addField("cuid")

self.addField("cimporter")

self.addField("pkid")

self.addField("ccontact")

self.addField("cemail")

self.addField("cberth")

self.addField("cphone1")

self.addField("cphone2")

self.addField("fk_portid")

self.addField("nfreedays")

self.addField("tduein")

self.addField("cterminal")

self.addField("cfax")

self.addField("fk_vesselid")

self.addField("tarrive")

self.addField("cvimpref")

self.addField("caddress")

self.addField("corigin")

self.addField("cpier")

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/1786410.g1BRhLDmma@linux-12

©2011 John Fabiani
Back to top
Re: [dabo-users] something wrong with bizobj.moveToPK()

Author: Jacek Kałucki

Posted: 2011-12-24 18:09:30   Link

Użytkownik John Fabiani napisał:

> The output from above is:

> 1102 #this is the PK

> 2009-11-20 # a date field (correct)

> 1102 #this is the PK after moveToPK

> 2008-07-25 #this is a old date from a different record. Not correct!

>

> As you can see the dates do not match - but the pk's match???

I didn't noticed such behaviour, but what is your backend database? Is it SQLite?

Are you sure that user doesn't change that pwvoyage row?

Because it looks as such issue to me.

Dabo doesn't requery modified cursors.

What happens after saving it:

self.pwvoyage.save()

self.pwvoyage.moveToPK(KeyValue)

?

--

Regards

Jacek Kałucki

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/4EF65BAA.60303@rz.onet.pl

©2011 Jacek Kałucki
Back to top
Re: [dabo-users] something wrong with bizobj.moveToPK()

Author: Jacek Kałucki

Posted: 2011-12-24 18:19:25   Link

Użytkownik Jacek Kałucki napisał:

> What happens after saving it:

> self.pwvoyage.save()

> self.pwvoyage.moveToPK(KeyValue)

> ?

>

I reposted proper code on codepad: http://dabo.codepad.org/FV231hKP

--

Regards

Jacek Kałucki

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/4EF65DFD.1060506@rz.onet.pl

©2011 Jacek Kałucki
Back to top
Re: [dabo-users] something wrong with bizobj.moveToPK()

Author: John Fabiani

Posted: 2011-12-24 19:13:58   Link

On Sunday, December 25, 2011 12:19:25 AM Jacek Kałucki wrote:

> Użytkownik Jacek Kałucki napisał:

> > What happens after saving it:

> > self.pwvoyage.save()

> >

> > self.pwvoyage.moveToPK(KeyValue)

> >

> > ?

>

> I reposted proper code on codepad: http://dabo.codepad.org/FV231hKP

Sorry no saving allowed - this is a read only screen (at least for now). My

code is to demo problem! The backend is Postgres 8.4. I happen to be using a

combo-box and the code is executed as the result of a selection. However, I

doubt the selection is the cause of the record data being incorrect. But

maybe the relationship has some influence. The code below is how the

relationship is setup:

self.pwvoyage = dataClass.WarehousepwvoyageBizobj(self.dean_conn)

self.pwvoyage.ParentLinkField = "pkid"

self.pwvoyage.LinkField = "fk_vesselid"

self.pwvoyage.FillLinkFromParent = True

self.addBizobj(self.pwvoyage)

self.pwvessel.addChild(self.pwvoyage)

Johnf

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/6079096.P4GvckMDE8@linux-12

©2011 John Fabiani