Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access the Name property of a combobox.
Message
 
To
26/11/2003 16:07:42
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00853637
Message ID:
00854576
Views:
17
Stephan,

Thanks for the suggestions. I think I will go with them. I understand it and it makes sense.



>
>>     SELECT metadata
>>     SET FILTER TO ALLTRIM(datafield) = ALLTRIM(This.Name)
>
>
>> Right now I'm ending up using the first example with DO CASE ...ENDCASE
>> statements for the name of each combobox that I want to use this for. But > I'd like to know why I can't just refer to the "This.Name" property in my > Filter statement.
>
>The filter is evaluated in the context of the table it is set on, so the 'datafield' thingy will get resolved as you expect. However, the 'THIS' part will refer to whatever object is in the closest scope when the filter executes. Quick fix:
>
>
>   local cName
>   cName = upper(alltrim(this.Name))
>   set filter to upper(alltrim(DATAFIELD)) == "&cName" in metadata
>
>
>Some remarks regarding stylistic issues (so that we can compare notes - that's what a forum like this is for, innit? *g*):
>
>(1) Fox mangles the case of things every chance it gets so the UPPER() on the object name would be a wise precaution, I think; the UPPER() on the field value is a wise precaution in case you want to keep the names in your table in properly cased form without having to review all uses of the field values in your code; identifieres are case-insensitive in Fox anyway so distinguishing between 'Foo' and 'foo' would be somewhat moot
>
>(2) switching work areas unless necessary is rarely a good idea - you'd have to ensure that the original work area is restored afterwards or document that your function changes the work area; neither of these options is particularly attractive, and switching work areas seems to incur a runtime penalty
>
>(3) 'alltrim(a) = alltrim(b)' doesn't make sense; if you want an exact match then you should use the '==' operator because '=' is sensitive to environment settings but if you want the xBase style partial match then the trimming on the left hand side is redundant; from your code the intent is not clear to the reader
Elgin Rogers
Epic Solutions
www.epicsolutions.net
Previous
Reply
Map
View

Click here to load this message in the networking platform