General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only