Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Last filled column
Message
From
03/05/2008 08:41:44
 
 
To
03/05/2008 08:08:49
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01314907
Message ID:
01314908
Views:
6
>Dear Experts
>
>Price.dbf has following Five fields
>
>date ---- d(8)
>rate1 ---n(4)
>rate2 ---n(4)
>rate3 ---n(4)
>rate4 ---n(4)
>
>Data in fields as
>
>Date ---- rate1-----rate2-----rate3------rate4
>22/01-----195---------0----------0----------0---
>24/01-----195-------180---------0----------0---
>25/01-----225-------230-------215---------0--
>24/01-----335-------180-------200-------205
>
>Text1.value=25/1
>
>How to findout the value in last filled column in four columns i.e rate1,rate2,rate3 and rate4.
>
>The answer must be 215
>

Assuming you're looking at the right record, something like this:

nResult = 0
DO CASE
CASE NOT EMPTY(Rate4)
nResult= Rate4
CASE NOT EMPTY(Rate3)
nResult = Rate3
CASE NOT EMPTY(Rate2)
nResult = Rate 2
OTHERWISE
nResult = Rate 1
ENDCASE

However, the reason you need all that code is that your data isn't normalized. You'd be better off using a table with a structure like:

dDate
nRateNumber
nRate

Then, you could use a query to pull out the item with the maximum rate number for the specified date.

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform