Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem in GRID with calculate column
Message
From
30/01/2007 15:22:30
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01190586
Message ID:
01190636
Views:
17
>>Hello again
>>
>>I need to keep the calculate value on my table field because if an user open the invoice then this value appears automatically, why? because is on my table
>>
>>for example , it´s don´t make any sense if you don´t keep the unit price of an article.
>>Do you agree??
>>
>>Best regards
>>Luis Santos
>
>No I don't agree.
>If I have a unit price and Qty I always can have the total price. Check this:
>
>PUBLIC oform1
>
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>
>    **************************************************
>*-- Form:         form1 (c:\program files\microsoft visual foxpro 9\test.scx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   01/30/07 10:12:09 PM
>*
>DEFINE CLASS form1 AS form
>
>
>    Top = 6
>    Left = 89
>    DoCreate = .T.
>    Caption = "Form1"
>    Name = "Form1"
>
>
>    ADD OBJECT grid1 AS grid WITH ;
>        ColumnCount = 4, ;
>        Height = 214, ;
>        Left = 12, ;
>        Top = 13, ;
>        Width = 326, ;
>        Name = "Grid1", ;
>        Column1.ControlSource = "crsTest.Fld1", ;
>        Column1.Name = "Column1", ;
>        Column2.ControlSource = "crsTest.Fld2", ;
>        Column2.Name = "Column2", ;
>        Column3.ControlSource = "crsTest.Fld3", ;
>        Column3.Name = "Column3", ;
>        Column4.ControlSource = "((crsTest.Fld2*crsTest.Fld3))", ;
>        Column4.Name = "Column4"
>
>
>
>    PROCEDURE Load
>        CREATE CURSOR crsTest (Fld1 Int, Fld2 N(14,2), Fld3 N(14,2))
>        FOR asd = 1 TO 20
>            INSERT INTO crsTest VALUES (asd, asd%9, asd^2)
>        NEXT
>        GO TOP
>    ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: form1
>**************************************************
>
>
>Imagine that Fld2 is Unit Price and Fld3 id Quantity of the invoice. Than last column will show you the total price for that item. ALWAYS.

There are certain kinds of interface when 'calculated' column is not really calculated :), i.e. interface provides users with tools to make adhoc calculation and save result without caring how it was reached. For example, it may allow to apply random discounts to price, 5% (not right ?), ok then 5% more, 4% more etc. until 'final' result (i.e. satisfactory for a customer on phone) is reached. This way 'calculated' field should be saved, though I'm unsure if it's the case for this thread.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform