Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem in GRID having calculate column
Message
De
28/01/2007 17:27:32
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
28/01/2007 17:16:11
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01189942
Message ID:
01189944
Vues:
12
>Hello comunity
>
>i have this code to make a calculation on my grid form changing the controlsource .
>STORE "" TO clname
>FOR EACH myform IN _Screen.forms
>   IF UPPER(myform.name)="SFT"
>      WITH myform.Pageframe1.Page1.Cont1.Grid1
>         FOR i=1 TO .columnCount
>            IF UPPER(.Columns(i).ControlSource)="FI.U_VALHUM"
>               clname=.Columns(i).name
>               .Columns(i).ControlSource = ('((0+fi.u_nospeso-fi.u_VLDscemb)*fi.u_hum)/100')
>               exit
>            ENDIF
>         NEXT i
>         EXIT
>      ENDWITH
>   ENDIF
>NEXT myform
>The original controlsource of my column is a table field FI.U_VALHUM, well , if i use this code effectively i have on my column the result, but, because i change the ControlSource when i save my invoice and i close the invoice form , when a reopen my form the calculate value has dissapear , i think that because the controlsource of my calculation column don´t refer to my table field FI.U_VALHUM and saving the invoice this table field has never hold the calculate value on the table.
>
>I don´t know if i have another possibilities to save the calculate value on my table but using this code to calculate on my column :
>('((0+fi.u_nospeso-fi.u_VLDscemb)*fi.u_hum)/100')
>
>I think if i don´t change the control source, but i use .Value propertie i can do that, my problem is how can i do this.

You can't really, because the expression is just a value to display in the column - and since it's not a field name, it is therefore unbound. You may need some code in grid's .afterrowcolchange (or in a bound event, that'd be easier than to subclass each grid) which would do the calculation on the current record whenever the underlying fields in this expression change, and replace the value in the u_valhum field. You can do this bindevent() in the form's init - no need to roll through _screen.forms.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform