Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to put running balance in local view?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00212879
Message ID:
00213230
Vues:
34
>Here is my local view:
>open data ves
>CREATE SQL VIEW "LV_BAL_TEST" ;
> AS SELECT Armast01.invno, Armast01.invdte, ;
> Armast01.custno, Armast01.invamt, 00000000.00 as bal ;
> FROM f:\pro30\ardata\armast01 ;
> WHERE Armast01.custno = ?vp_custno
>
>in active page
>
>vp_custno = v_cust.custno
>sele v_bal_test
>requery()
>
>sum invamt to post_amt
>pre_amt = v_cust.balance - post_amt
>go top
>scan
>repl bal with pre_amt + invamt
>pre_amt = pre_amt + invamt
>endscan
>
>Then go to the object list and get the string for your grid, then add the .refresh() to show the user the work is done.


Hello Stephen!

Your code looks quite a bit like my code (see below). If your code works then perhaps I'm on the right track after all.

Important fact: I ripped out all of the new code relating to calculating the new balance and I'M STILL GETTING THE "CANNOT UPDATE THE CURSOR" ERROR when I perform the requery(). In other words I can't get back to where I was.

So I must have done something to make the local view not updatable.

Any of you guys have a wild guess as to what I have done to make this local view where I get an error on requery()? I have restored the view create code and the AITEMSget code to status quo ante. BTW, if I click on ignore, the view contains the correct data.

Stephen, are you using codebook? The implied "l" in front of the local view name in your page code looks a lot like codebook.

Thanks for all of your responses.

Peter Robinson




** Code to create view lv_AITEMS:
close data all
open database MASS1

create sql view lv_AITEMS as ;
select dtoc(AITEMS.tEffective) as dEntered, ;
ITEMS.cItem_Code as cCode, ITEMS.cShort, ;
iif(AITEMS.nDaysDue=0,space(10), ;
dtoc(ttod(AITEMS.tEffective)+AITEMS.nDaysDue)) as dDue, ;
AITEMS.yAmount, AITEMS.lClosed, 000000.00 as yBalance, AITEMS.tEffective ;
from MASS1!AITEMS, MASS1!ITEMS ;
where AITEMS.iITEMS = ITEMS.iITEMS ;
and AITEMS.iACCNTS = ?goApp.iACCNTS ;
and (AITEMS.lClosed = ?goApp.lSeeClosed ;
or AITEMS.lClosed = .f.) ;
order by AITEMS.tEffective


** AITEMSget() method:
local array laBalance[1]
local lyBalance

select v_AITEMS
requery()

select sum(yAmount) from v_AITEMS into array laBalance
if _tally>0
this.yDetailSum = laBalance[1]
lyBalance = 0
scan
lyBalance = lyBalance + round(yAmount,2)
replace yBalance with lyBalance
endscan
else
this.yDetailSum = 0
endif
Peter Robinson ** Rodes Design ** Virginia
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform