Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to work with data in a grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00017666
Message ID:
00017743
Vues:
76
>>>>I have a form using a one-to-many relationship and a grid. The grid displays data from two records, and the user can edit the data in one or both of these records. When they click on save, calculations are performed using this data.
>>>>
>>>>However, my formulas are only working on the first record. How do I tell it to use both records, one at a time?
>>>
>>>The grid has a refresh method, you should call, from the save.click.
>>>
>>>HTH
>>
>>Thanks Marc! I added ThisForm.grdTPD_Payments.Refresh to the beginning of my code in my save.click, but now my calculations only worked on the 2nd record! I guess I need to add some sort of loop now, any suggestions?
>>
>>Jeff
>
>Jeff,
>
>I have grid which perform calculations, but I perform calculation from Valid() or InteractiveChange() of the control in a grid cell when I change something in that record. I don't know if it suits your need in your case.
>
>Nick

Nick's method of performing the calculations when you change each record is probably the best approach, but if you want to do it in the SAVE routine, then add a loop as you suggest. If you're using a View to populate your grid:

sele MYVIEW
go top
do while !eof()
do mycalcs
skip
enddo

If you're using a parent/child link, pick up the unique ID from the
parent, and use that in the loop:

cID = MyParent.uniqueID
sele MyChild
seek cID
do while MyChild.ID = cID
do mycalcs
skip
enddo

... Other code for save

You can optimize this by using SEEK(), etc., but I'm trying to be clear.
HTH
Barbara Paltiel
Barbara Paltiel, Paltiel Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform