Hi Mike,
>That may be so, but I really have to ask, why not do it the optimal way the first time?
I know you're obsessed with these kind of optimizations, but what is optimized really depends on the population. For only two records having an index lookup really means LESS performance compared to a table scan.
As all in software development. If there is a performance problem, try to take it out. It really does not make sense to spend a lot of time to optimize each and every program line in a project.
Programming from a performance pov is only neccesary if you expect that piece of software to be susceptible to performance problems. Otherwise don't bother, your time is not worth it.
Walter,
>>Thanks for the feedback Mike.
>>
>>As it is right now, I'm not worried about optimizing the query since the table (sec_ca) only has 2 records! Perhaps when it gets "larger" I'll use your code.
>>
>>Regards,
>>
>>Mike
>>
>>
>>>Hi Mike
>>>
>>>>VFP9 Beta (and yeah I know it expires shortly).
>>>>
>>>>I've added a cursor adaptor to my form's dataenvironment and am trying to set it up via code as follows:
>>>>
>>>>
>>>>SELECT * FROM SEC_CA WHERE CATEGORY = UPPER(ALLTRIM(this.caption)) INTO CURSOR csrCA
>>>
>>>FYI, you can get better performance out of that select command. Even if you have no indexes on sec_ca, you should avoid the this.caption and the upper(alltrim()) like this....
>>>
>>>LOCAL lcCaption
>>>lcCaption = UPPER(ALLTRIM(THIS.Caption))
>>>SELECT * FROM SEC_CA WHERE CATEGORY = m.lcCaption
>>>
>>>and if you have an index like UPPER(CATEGORY)
>>>
>>>then SELECT * FROM SEC_CA WHERE UPPER(CATEGORY) = m.lcCaption would be the optimal way to do it.
>>>
>>>
>>>
>>>>
>>>>THISFORM.oDE.ADDOBJECT("ca"+this.caption, "caSectional")
>>>>oCA = EVALUATE("thisform.oDE.ca"+ ALLTRIM(this.caption))
>>>>
>>>>WITH oCA
>>>> .Alias = "csr" + lcCategory
>>>> .BufferModeOverride = 5
>>>> .CursorSchema = ""
>>>> .DataSourceType = "NATIVE"
>>>> .FetchSize = -1
>>>> .KeyFieldList = "SECT_NO"
>>>> .SelectCmd = ALLTRIM(csrCA.Selcmd)
>>>> .Tables = ALLTRIM(csrCA.tablenames)
>>>> .UpdatableFieldList = ALLTRIM(csrCA.Updfldlst)
>>>> .UpdateNameList = ALLTRIM(csrCA.UpdnamLst)
>>>>* The following line gets the data AND automatically displays it in a browse window!
>>>>* Needless to say, that's very annoying.
>>>> .CursorFill()
>>>>ENDWITH
>>>>
>>>>
>>>>All of the cursor adaptor's settings are being filled in from values stored in a table. Prior to me doing this, I hardcoded them and the CursorFill() method did not cause the browse window to appear. What's causing it now?
>>>>
>>>>Regards,
>>>>
>>>>Mike