Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the last number in a table - and adding to a query

Status
Not open for further replies.

cobweb

IS-IT--Management
May 5, 2002
95
GB
Hello:

I am using Paradox 9 to pull from Oracle a large table.
The process is quite long and I would like to think I can pull the data down incrementally as follows:
1. Pull all data out of Oracle up to a given number (the order number)
2. Pull all data out of Oracle since the last order number
3. repeat 2 as and when required.

So I think it would be something like finding the last number in the table, storing the order number in an array or similar, then running the query using as a criteria the last order number plus one.

I have just asked how to run a query with a selection criteria - can anybody help me with how to determine the last order number and store it for the query to collect?

Thanks
 
Since I have no idea how you do data entry, I will have to guess that you handle order numbers by hard coding an incremetal number scheme. If so, you should be able to grab the last number from wherever you store it.

If I'm totally off base or if you are using a auto-increment field (ULP!). Then you have to access the table, go to the last record and grab the order number. In a Paradox table you would use a tCursor, like this:

Code:
var
  lastOrder  string
  tc         tCursor
endvar

tc.open(":myAlias:myTable.db")
tc.end()
lastOrder = tc."orderNum"
tc.close()

Now you have the number in the variable 'lastOrder', which you can then insert into a query, using the tilde operator (as in the example in your other post).

If your order numbers are truly numeric, then you could change the orderNum variable to an integer and do math on it: i.e. lastOrder = (tc."orderNum"+1).



Mac :)

"Do not delve too deeply in the arts of your enemy and so become ensnared by them"

langley_mckelvy@cd4.co.harris.tx.us
 
Thank you very much; this is just what I needed.
Once again you have saved me a lot of effort!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top