SQL and C/SIDE

When writing code in C/SIDE, is there any developer-rules that is good practice when we have an SQL database ? I have heard folllowing : - Don’t use LOCKTABLE in the same way, as with Native DB - Always use ISEMPTY before a IF rec.FIND(’-’) - etc but, is there a list with this “rules” ?

Hello, Have a look at the pdf for the programming and the development certification, the have a chapter about c/side ans SQL server.

Where do I find “the programming and the development certification”, is this a forum here, a website, or ? IF possible, can you mail the pdf-document to me at mengholm@gnresound.dk ?

Hi Micheal, That is not a forum. I believe he is refering to Microsoft Navision Attain certification programme, and specifically the material used for that programme. If you are not an NSC, then you can contact your NSC for help! Meanwhile, I have the pdf I think but I have to look around for the CD. Just send me email if you dont get it by tomorrow, on rbm@techemail.com. Regards Robert

Hi Michael, Why do you have to use ISEmpty before Find(’-’) ? Cristi

Hi Cristi, I have heard that for SQL, a Find(’-’) is very slow if it doesn’t find anything, but IsEmpty will return immediately, so due to performance, your code should look like this : SalesLine.SetFilter(SalesLine.“Item Category Code”,‘ABC*’); IF NOT SalesLine.ISEMPTY THEN IF SalesLine.FIND(’-’) THEN REPEAT … UNTIL SalesLine.NEXT = 0;

This is not really necessary or the purpose. ISEMPTY was made for testing exactly what it says. Instead of using IF FIND(’-’) THEN…, if you only want to know if a set is empty or not for a decision, you should use ISEMPTY. If you intend to loop through the set anyway, if a record is found, you should use FIND as normal. Combining them will just issues 2 server calls if there are records present. Since ISEMPTY was made, for 2.50, FIND(’-’) has been optimized in C/SIDE to issue the appropriate server call based on results of previous calls with the same filter; i.e. to follow a pattern. This is based on finding no records previously; find only 1 record; finding many records. Each of these has an optimial type of server call and it will therefore pick the best (it will readjust its strategy if results change again). Still, if you need to know if a filter set is empty and that is all, use ISEMPTY.

Moved to SQL forum.