Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to sort grid box record when clicking the header?
Message
From
07/02/1999 22:42:09
 
 
To
07/02/1999 18:40:48
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00184218
Message ID:
00184961
Views:
20
>>>>I admit I'm a laggard here, not using p-views. Each query, in the case in point, might refer to different source tables with wildly different search conditions. You can set up a p-view using &sqlstr though can't you?
>>>
>>>You can try. I didn't :)
>>>
>>>Actually, trying that animal out may solve some mysteries on the issue of views - like "is the SQL string of a view re-evaluated each time or is it stored compiled" and "if compiled, does an embedded macro force re-evaluation at requery"...
>>
>>One question you may know the (best) answer to ....
>>You can't macro substitute a form property (&thisform.myprop), so if you store an SQL fragment with the intent of using it in a view with an & in it how do you scope the variable?
>
>I'd use a global dummy containing ".t." or something equally harmless so the view gets properly created, and for open and requery I'd issue a real local one with the same name and just the right value. I know it's a dirty trick, non-OOP, kludgy and other four-letter words, but... hey, macros in the view definition were your idea :). Besides, it may work.
>
>No it doesn't. Just tried this:
>
>Lparam TheTable
>CLOSE DATA ALL
>CREATE DATABASE 'TMP.DBC'
>CREATE SQL VIEW "V_MTR" ;
>   AS SELECT * FROM &thetable
>DBSetProp('V_MTR', 'View', 'Tables', TheTable)
>
>
>And it bombs me with "Base table fields have been changed and no longer match view fields. View field properties cannot be set.", probably because I've called it second time with a different table as a parameter. When I added "erase tmp.dbc" just after the Close command, it refused to open the view.
>
>Therefore, I guess you'll have to create many different views with the same structure and Use them under same alias, or different aliases and append to the same cursor, or just create cursors on the fly - that's what they were invented for.
>
>Wait - that's what it did when I used a name expression
...from (TheTable)
. When I put the macro
...from &TheTable
I was able to run this against several tables and use the view right away. But then, I had to re-run this every time - the macro is evaluated only when the view is created. So, back to previous paragraph.

Must work differently then to the SQL source in a list/combo. I can specify a macro in there and on requery it re-evaluates the macro.
Previous
Reply
Map
View

Click here to load this message in the networking platform