Get the last item in PAL (PARADOX 4.x DOS)

19 views
Skip to first unread message

M.Emmanuel

unread,
Jun 12, 2025, 4:53:32 AMJun 12
to TheDBCommunity
I want to retrieve the EOY value of a table:

Query
 LR101501 |      DATE        | CLOSE | DIVIDEND |
          | Check 12/../2024 | Check | Check    |

Endquery

- How would I get the last value of the result and assign to global variable EOY_PRICE?
- Can I replace the hardcoded 2024 by a global variable named YEAR?

Thanks

Steven Green

unread,
Jun 12, 2025, 9:01:49 AMJun 12
to TheDBCommunity
two step process.. first you do a calc max query (or sort, filter, etc) to get your date.. then you can get the record for that date

first query 

checkmark what you need
[that field] "calc max"
do_it!

var = [max of that field]

next query

checkmark what you need
[that field] = ~var
do_it!

M.Emmanuel

unread,
Jun 12, 2025, 10:36:42 AMJun 12
to TheDBCommunity
Thanks, I begin to see the logic behind this.

How can you make 12/../2024 using 12/../TYEAR where TYEAR is a global variable?


; *** GET DECEMBER ENTRIES
Query

 Lr101500 |       DATE       | CLOSE  | DIVIDEND |
          | Check 12/../2024 | Check  | Check    |

Endquery
DO_IT!

; *** GET LAST DECEMBER DATE AND EXTRACT EOY_DATE
Query

 ANSWER   |       DATE       | CLOSE  | DIVIDEND |
          | Calc Max         |        |          |

Endquery
DO_IT!
EOY_DATE = [MAX OF DATE]

; *** GET THAT RECORD AND EXTRACT EOY_PRICE
Query

 LR101500 |       DATE       | CLOSE | DIVIDEND |
          | ~EOY_DATE        | Check |          |

Endquery
DO_IT!
EOY_PRICE = [CLOSE]

; *** CLEAR SCREEN
CLEARALL

Steven Green

unread,
Jun 12, 2025, 11:43:05 AMJun 12
to TheDBCommunity
> How can you make 12/../2024 using 12/../TYEAR where TYEAR is a global variable?

myvar = dateval("1/1/" + strval(myyear))

in the query, use ~myvar

Reply all
Reply to author
Forward
0 new messages