Index
2011-12-03 10:03 – Nate Lowrie : [dabo-users] Production problem with granchild bizobj
2011-12-06 17:08 – Paul McNett : Re: [dabo-users] Production problem with granchild bizobj
2011-12-07 08:44 – Nate Lowrie : Re: [dabo-users] Production problem with granchild bizobj
2011-12-07 09:19 – Paul McNett : Re: [dabo-users] Production problem with granchild bizobj
2011-12-07 10:55 – John Fabiani : Re: [dabo-users] Production problem with granchild bizobj
2011-12-07 11:07 – Paul McNett : Re: [dabo-users] Production problem with granchild bizobj
2011-12-07 11:52 – John Fabiani : Re: [dabo-users] Production problem with granchild bizobj
Back to top
[dabo-users] Production problem with granchild bizobj

Author: Nate Lowrie

Posted: 2011-12-03 10:03:40   Link

I have a problem with a production bizobj set I need help with.

I have the following structure:

Orders

Order Line Items

Order Line Item Options

In order line items, I have a unit price with options as a virtual

field. The code for the field function is below.

def _getUnitPriceWithOptions(self):

price = 0.0

for record in self.orderLineItemOptionsBizobj.getDataSet():

price += float(record["price"])

return price + float(self.getFieldVal("unit_price"))

My problem is that I expect the order line item options bizobj to get

requeried for each line when the order line items are scanned through

when they are loaded into the grid. This is definitely not happening

and it was working a bit ago. As a result, the options for the first

line item are being applied to all line items and options for all the

other line items are ignored because the bizobj never requeries on the scan.

Regards,

Nate

_______________________________________________

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/4EDA3A4C.1010609@gmail.com

©2011 Nate Lowrie
Back to top
Re: [dabo-users] Production problem with granchild bizobj

Author: Paul McNett

Posted: 2011-12-06 17:08:46   Link

On 12/3/11 7:03 AM, Nate Lowrie wrote:

> I have a problem with a production bizobj set I need help with.

>

> I have the following structure:

> Orders

> Order Line Items

> Order Line Item Options

>

> In order line items, I have a unit price with options as a virtual

> field. The code for the field function is below.

>

> def _getUnitPriceWithOptions(self):

> price = 0.0

> for record in self.orderLineItemOptionsBizobj.getDataSet():

> price += float(record["price"])

> return price + float(self.getFieldVal("unit_price"))

>

> My problem is that I expect the order line item options bizobj to get

> requeried for each line when the order line items are scanned through

> when they are loaded into the grid. This is definitely not happening

> and it was working a bit ago. As a result, the options for the first

> line item are being applied to all line items and options for all the

> other line items are ignored because the bizobj never requeries on the scan.

There are potentially two things going on here. First, you mentioned a grid. Grids

get the values to display by calling biz.getFieldVal(fld, row), IOW they send the row

number to getFieldVal. By default, getFieldVal() won't update the children in this

case, so the grid will show the wrong calculated value if the calculation relies on

the children. To override this, you change your VirtualField definition from this:

class MyBiz(...):

def initProperties(...):

self.VirtualFields["myfield"] = self.getMyField

to:

self.VirtualFields["myfield"] = {"func": self.getMyField, "requery_children": True}

The second thing could be an unintended consequence of recent changes, so if you try

the above and see no improvement, please let us know.

Paul

_______________________________________________

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/4EDE926E.3010208@ulmcnett.com

©2011 Paul McNett
Back to top
Re: [dabo-users] Production problem with granchild bizobj

Author: Nate Lowrie

Posted: 2011-12-07 08:44:13   Link

On 12/6/2011 5:08 PM, Paul McNett wrote:

> There are potentially two things going on here. First, you mentioned a grid. Grids

> get the values to display by calling biz.getFieldVal(fld, row), IOW they send the row

> number to getFieldVal. By default, getFieldVal() won't update the children in this

> case, so the grid will show the wrong calculated value if the calculation relies on

> the children. To override this, you change your VirtualField definition from this:

>

> class MyBiz(...):

> def initProperties(...):

> self.VirtualFields["myfield"] = self.getMyField

>

> to:

>

> self.VirtualFields["myfield"] = {"func": self.getMyField, "requery_children": True}

>

> The second thing could be an unintended consequence of recent changes, so if you try

> the above and see no improvement, please let us know.

The change in the virtual field did it. I was using the grid as you

said and the orders object would also automatically update the total,

but would grab the orderline subtotals using getDataSet(), which I

assume has the same update issue as getFieldVal(). It would also make

sense that when I opened my edit forms the bizobj would requery as normal.

Thanks for the help.

Regards,

Nate

_______________________________________________

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/4EDF6DAD.3080103@gmail.com

©2011 Nate Lowrie
Back to top
Re: [dabo-users] Production problem with granchild bizobj

Author: Paul McNett

Posted: 2011-12-07 09:19:52   Link

On 12/7/11 5:44 AM, Nate Lowrie wrote:

>> >

>> > self.VirtualFields["myfield"] = {"func": self.getMyField, "requery_children": True}

>> >

>> > The second thing could be an unintended consequence of recent changes, so if you try

>> > the above and see no improvement, please let us know.

> The change in the virtual field did it. I was using the grid as you

> said and the orders object would also automatically update the total,

> but would grab the orderline subtotals using getDataSet(), which I

> assume has the same update issue as getFieldVal(). It would also make

> sense that when I opened my edit forms the bizobj would requery as normal.

Glad it worked.

Paul

_______________________________________________

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/4EDF7608.3050000@ulmcnett.com

©2011 Paul McNett
Back to top
Re: [dabo-users] Production problem with granchild bizobj

Author: John Fabiani

Posted: 2011-12-07 10:55:20   Link

On Wednesday, December 07, 2011 06:19:52 AM Paul McNett wrote:

> On 12/7/11 5:44 AM, Nate Lowrie wrote:

> >> > self.VirtualFields["myfield"] = {"func":

> >> > self.getMyField, "requery_children": True}>> >

> >> > The second thing could be an unintended consequence of recent

> >> > changes, so if you try the above and see no improvement, please

> >> > let us know.

> >

> > The change in the virtual field did it. I was using the grid as you

> > said and the orders object would also automatically update the total,

> > but would grab the orderline subtotals using getDataSet(), which I

> > assume has the same update issue as getFieldVal(). It would also make

> > sense that when I opened my edit forms the bizobj would requery as

> > normal.

> Glad it worked.

>

> Paul

So what caused the issue? It appeared that he made the same call albeit in

what I'd call a normal manner or way.

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/1974235.50IzcBfHjO@linux-12

©2011 John Fabiani
Back to top
Re: [dabo-users] Production problem with granchild bizobj

Author: Paul McNett

Posted: 2011-12-07 11:07:22   Link

On 12/7/11 7:55 AM, John Fabiani wrote:

> On Wednesday, December 07, 2011 06:19:52 AM Paul McNett wrote:

>> On 12/7/11 5:44 AM, Nate Lowrie wrote:

>>>>> self.VirtualFields["myfield"] = {"func":

>>>>> self.getMyField, "requery_children": True}>> >

>>>>> The second thing could be an unintended consequence of recent

>>>>> changes, so if you try the above and see no improvement, please

>>>>> let us know.

>>>

>>> The change in the virtual field did it. I was using the grid as you

>>> said and the orders object would also automatically update the total,

>>> but would grab the orderline subtotals using getDataSet(), which I

>>> assume has the same update issue as getFieldVal(). It would also make

>>> sense that when I opened my edit forms the bizobj would requery as

>>> normal.

>> Glad it worked.

>>

>> Paul

>

> So what caused the issue? It appeared that he made the same call albeit in

> what I'd call a normal manner or way.

He needed to add the "requery_children" key to the dict.

Paul

_______________________________________________

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/4EDF8F3A.9010307@ulmcnett.com

©2011 Paul McNett
Back to top
Re: [dabo-users] Production problem with granchild bizobj

Author: John Fabiani

Posted: 2011-12-07 11:52:17   Link

On Wednesday, December 07, 2011 08:07:22 AM Paul McNett wrote:

> On 12/7/11 7:55 AM, John Fabiani wrote:

> > On Wednesday, December 07, 2011 06:19:52 AM Paul McNett wrote:

> >> On 12/7/11 5:44 AM, Nate Lowrie wrote:

> >>>>> self.VirtualFields["myfield"] = {"func":

> >>>>> self.getMyField, "requery_children": True}>>

> >>>>> >

> >>>>>

> >>>>> The second thing could be an unintended consequence of

> >>>>> recent

> >>>>> changes, so if you try the above and see no improvement,

> >>>>> please

> >>>>> let us know.

> >>>

> >>> The change in the virtual field did it. I was using the grid as you

> >>> said and the orders object would also automatically update the

> >>> total,

> >>> but would grab the orderline subtotals using getDataSet(), which I

> >>> assume has the same update issue as getFieldVal(). It would also

> >>> make

> >>> sense that when I opened my edit forms the bizobj would requery as

> >>> normal.

> >>

> >> Glad it worked.

> >>

> >> Paul

> >

> > So what caused the issue? It appeared that he made the same call albeit

> > in what I'd call a normal manner or way.

>

> He needed to add the "requery_children" key to the dict.

>

> Paul

Got it - thanks

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/3360714.65ZYMlj14S@linux-12

©2011 John Fabiani