Hi, I have two questions about keys and SQL (Working on SQL):
1)
Supose you have a key defined consisting of Field1, Field2 and Field3. Now you want to use this key to 'filter' on Field1 and Field3.
I know it is not best to use that key for this reason, but in some cases (with more keyfields) it can be useful to use the key instead of creating a new one.
SETCURRENTKEY("Field1","Field2","Field3");
SETRANGE("Field1",value1);
SETRANGE("Field2"); // Does this line matter?
SETRANGE("Field3",value3);
The question is wether the line with range on Field2 does matter?
2) Supose you have a key defined consisting of Field1, Field2 and Field3 (in that order!). With this key you define a SQLIndex (and you maintain an SQLIndex) Field3, Field2 and Field1 (in this order). In code it is probably best to write
SETCURRENTKEY("Field1","Field2","Field3");
SETRANGE("Field1",value1);
SETRANGE("Field2",value2);
SETRANGE("Field3",value3);
But is this automatically converted to the correct SQLIndex? Because the first field to 'filter' on there is Field3. How is this done by Navision?
Tx.
Bohr-ing.
0
Comments
These will give you a good idea into how this works.
It is completely different from Native and way to complex to explain in just one short reply.
Please let me know if any questions are there after viewing the webcast.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool