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,
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.
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.
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.
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?
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.
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!)
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?
Hello,
Ok, this is a weird one.
I am building a new VFP9 app to replace an old outdated VFP9 app (long
story).
Both apps use the same DBF free tables.
If I update a field in the new app, the old app does not reflect the change
until I exit out of the new app.
The data is definitly changed because I can start another VFP and open the
table and see the changed data.
What would cause the old app to not read the most current data from the
shared table ?
I even closed the table and reopen just before the seek and it still loads
the old data
Very weird ... Help ????
Thanks,
Kent
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/83A4D7A9BF9B47C793D3BC6F5C759563@LaptopW7
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
> What would cause the old app to not read the most current data from
the
> shared table ?
>
"I am building a new VFP9 app to replace an old outdated VFP9 app (long
Story)"
Maybe THAT's your reason......... <g>
Thanks,
Matthew Jarvis || Business Systems Analyst
IT Department
McKenzie-Willamette Medical Center
1460 G Street, Springfield, OR 97477 || Ph: 541-744-6092 || Fax:
541-744-6145
--------------------------------------------------------------------------
Disclaimer: This electronic message may contain information that is
Proprietary, Confidential, or legally privileged or protected. It
is intended only for the use of the individual(s) and entity named
in the message. If you are not an intended recipient of this
message, please notify the sender immediately and delete the
material from your computer. Do not deliver, distribute or copy
this message and do not disclose its contents or take any action in
reliance on the information it contains.
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/69F310C05DD83C48A84BA3769CE1ECF806251FD2@TNTRIEXEVS02.triadhospitals.net
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.