Index
2004-07-11 22:04Chester Friesen : View data not updating
2004-07-12 07:58Ed Leafe : Re: View data not updating
2004-07-12 11:02Chester Friesen : Re: View data not updating
2004-07-14 15:32Todd Haehn : Re: View data not updating
2004-07-14 16:00Chester Friesen : Re: View data not updating
2004-07-14 16:10Ed Leafe : Re: View data not updating
2004-07-14 16:31Chester Friesen : Re: View data not updating
2004-07-15 02:53Chester Friesen : Re: View data not updating
Back to top
View data not updating

Author: Chester Friesen

Posted: 2004-07-11 22:04:44   Link

I am having trouble saving data from a view. I have bizobj's invoice,

invoiceline and lineitems involved. The invoice and invoiceline data

saves perfect. If I suspend the program and look at the view, the data

is written correctly, but will not save to the table. The view

settings are all set to update. Here is some test code I am trying,

this is called from the invoicelinebizobj.beforesave:

* AdjustInventory

* Called from ainvoiceline.beforesave()

SELECT v_invoiceline

SCAN

SELECT v_lineitems

LOCATE FOR v_lineitems.iid=v_invoiceline.ITEMID

IF v_invoiceline.backorder

*do replacements here

WAIT WINDOW "A BACKORDER"

WAIT WINDOW ALIAS()

REPLACE v_lineitems.comments WITH "A BACKORDER"

ELSE

*do replacements here for qty, etc. (eventually)

WAIT WINDOW "NOT BACKORDER"

WAIT WINDOW ALIAS()+" " + bookname

REPLACE comments WITH "NOT BACKORDER"

WAIT WINDOW "Comments="+ v_lineitems.comments

ENDIF

ENDSCAN

RETURN

The wait windows are for testing only, they all show that it is

working with no errors. I inserted a suspend after the "replace

comments", the v_lineitems showed the data was written into the right

field.

There is probably something simple that I am not thinking of, but I

have gone through every setting I know.

I need some ideas, either how to debug, or settings to check.

TIA,

©2004 Chester Friesen
Back to top
Re: View data not updating

Author: Ed Leafe

Posted: 2004-07-12 07:58:17   Link

Quote: >>I am having trouble saving data from a view. I have bizobj's

invoice, invoiceline and lineitems involved. The invoice and

invoiceline data saves perfect. If I suspend the program and look at

the view, the data is written correctly, but will not save to the

table. The view settings are all set to update.

What happens if you open the view from the Command Window? Does it

update then? If not, then there are some problems with your view

properties. If it does, then perhaps your bizobjs are not set up

properly. Without the parent/child relationships established, calling

Save() on the primary bizobj will not call the Save() of the other

bizobjs, and the data will not be saved.

©2004 Ed Leafe
Back to top
Re: View data not updating

Author: Chester Friesen

Posted: 2004-07-12 11:02:18   Link

Quote: >>

What happens if you open the view from the Command Window? Does it

update then? If not, then there are some problems with your view

properties. If it does, then perhaps your bizobjs are not set up

properly. Without the parent/child relationships established, calling

Save() on the primary bizobj will not call the Save() of the other

bizobjs, and the data will not be saved.

It updates from the Command Window fine. That's what I kind of thought

was happening, the parent/child relationships aren't right. I'll have

to figure out which bizobj to make lineitems a child of, I tried to

make it a child of invoiceline, but then it only selected the first

record of lineitems.

Sometimes I feel quite brain dead when it comes to understanding

parent/child relationships. Can there be more than one primary bizobj?

I don't see how I can make lineitems a child of either invoices or

invoiceline.

PS: Just tried making lineitems a primary bizobj-doesn't work. Looks

like I need to put more thought into it. Thanks.

©2004 Chester Friesen
Back to top
Re: View data not updating

Author: Todd Haehn

Posted: 2004-07-14 15:32:31   Link

The line items need to be a child of the invoice by setting the

cParentBizObj property of the line items. You can also set the

partent key field and view parameter to do a requery when the parent

is required. The buffering on the parent is normally row and the

child is normaly table. Hope this helps.

©2004 Todd Haehn
Back to top
Re: View data not updating

Author: Chester Friesen

Posted: 2004-07-14 16:00:45   Link

Quote: >>The line items need to be a child of the invoice by setting

the cParentBizObj property of the line items. You can also set the

partent key field and view parameter to do a requery when the parent

is required. The buffering on the parent is normally row and the

child is normaly table. Hope this helps.

Thanks, Todd,

I have an "addressbook" that is parent to "invoice", which is parent

to "invoicelines" That all works fine. My problem is with "lineitems"

which doesn't work to make a child of "invoicelines", at least I

haven't been able to make it work, it always chooses the first record

in the table to update, even though in my screen to choose items it

chooses correctly. Ed' s right, the save() isn't being called without

the parent-child relationships. I wonder, can a bizobj.save() be

called from another without it being in the parent-child order?

©2004 Chester Friesen
Back to top
Re: View data not updating

Author: Ed Leafe

Posted: 2004-07-14 16:10:12   Link

Quote: >>I have an "addressbook" that is parent to "invoice", which is

parent to "invoicelines" That all works fine. My problem is with

"lineitems" which doesn't work to make a child of "invoicelines", at

least I haven't been able to make it work, it always chooses the first

record in the table to update, even though in my screen to choose

items it chooses correctly. Ed' s right, the save() isn't being called

without the parent-child relationships. I wonder, can a bizobj.save()

be called from another without it being in the parent-child order?

Sure - just override your main bizobj in its AfterSave() method. If

the main Save() completed successfully, call the Save() of your

lineitems bizobj.

©2004 Ed Leafe
Back to top
Re: View data not updating

Author: Chester Friesen

Posted: 2004-07-14 16:31:11   Link

Quote: >>

Sure - just override your main bizobj in its AfterSave() method. If

the main Save() completed successfully, call the Save() of your

lineitems bizobj.

Thanks, Ed, I'll try that tonight (after I get rid of everyone else's

spyware and virises!)

©2004 Chester Friesen
Back to top
Re: View data not updating

Author: Chester Friesen

Posted: 2004-07-15 02:53:28   Link

Well, this might be crude, I don't know, but it seems to work.

In ainvoicelinebizobj.beforesave is this line-

this.adjustinventory()

ainvoiceline.adjustinventory looks like this-

SELECT v_invoiceline

SCAN

SELECT v_lineitems

LOCATE FOR v_lineitems.iid=v_invoiceline.ITEMID

IF v_invoiceline.backorder

*do replacements here - test code now

REPLACE v_lineitems.comments WITH "A BACKORDER"

ELSE

*do replacements here - test code now

REPLACE comments WITH "NOT BACKORDERED"

ENDIF

thisform.bolineitems.save() && Saves lineitems

ENDSCAN

RETURN

This is a way that it works, the save() in the aftersave() in main

bizobj would only save the last record in the scan-endscan routine. I

changed the bolineitems to optimistic row, it seemed to work with

table buffering also, though.

Would it be better if it could somehow be made to work in the main

bizobj aftersave() and I'm just not catching on how yet?

©2004 Chester Friesen