« [Tip] Sybase Central: connection profiles | Main | [TIP] Add a HTML Calendar with only 1 method »
March 21, 2006
[tip] the magic of -1
by Marcel Trapman
www.it2be.com
Again, talking to a fellow developer. We were discussing the use of 'refreshRecordFromDatabase(foundset, recordindex)'. Hmm, he said, that's a nice function but I can not use it because I want to touch the complete foundset and not just one record.
After going back and forth for a while I suddenly remembered the magic of '-1'. In some cases it sets default values in other cases it means 'all'. In this case, when setting the recordindex to -1 it solved the issue because it means 'all'...
Another example is calling a form in dialog. By setting the x,y,w,h coordinates to '-1' one sets the dialog at the default position and the width and height are based on the form width and height.
Cool huh...
Hope you will remember this one when you need it :)
Marcel
| Posted by IT2Be on March 21, 2006 at 08:54 AM in Tips | Permalink
Comments
If I might add: getDatasetByQuery also takes a -1 as last parameter if you simply want all records that meet the query.
Posted by: Patrick Ruhsert | Mar 22, 2006 3:43:52 AM
Great addition Patrick, and there are a lot more of those floating around...
Posted by: Marcel Trapman | Mar 22, 2006 3:49:23 AM