if Table1.find('-') then repeat Table2.reset; Table2.setcurrentkey(No.,Type,Amount); Table2.setrange(No.,Table1.No.); Table2.setrange(Type,Table1.Type); Table2.setrange(Amount,Table1.Amount); if Table2.find('-') then repeat //some code that would update another table, say table3 until Table2.next = 0; until table1.next = 0;
Comments
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
They are pointing to different tables.
tsv
2) If SQL, you do not need the SetCurrentkey if you do not need to go through the table in some predefined order. (it will only add sorting process to the set, if you remove it, it will be sorted by primary key)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
am using SQL. My primary key is "No.", along with the primary field i need to setrange for two more fields
(type, Amount). Will it increase the performance by sorting Table1 with three fields( No., type, Amount) as given in the above code.. Table1 and 2 is having lakhs of records.
Thanks in advance
tsv
you don't need to use setcurrentkey function, unless you need to order your dataset result (as said in kine's 2nd point)
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
As Belias wrote, the Setcurrentkey have no effect to which key will be used (not directly), it is adding only "ORDER BY" clausule to the resulting SQL query, and SQL is sorting the result as last thing. Which key will be used is on the SQL planning system...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
"No., type, Amount" is not my primary key...
do i have to keep this as my primary key.
tsv
but it must exist as secondary key if you want to order your data like this...(SETCURRENTKEY returns error if the key does not exist )
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
tsv