Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to sort grid box record when clicking the header?
Message
De
07/02/1999 18:40:48
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
07/02/1999 16:26:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00184218
Message ID:
00184932
Vues:
21
>>>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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform