Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index on View
Message
From
03/09/2002 19:18:31
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
03/09/2002 17:46:49
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00696421
Message ID:
00696444
Views:
15
>Forgot a piece of the code:
>
>It was suggested that I use sys(2015) to name my index files so they would be unique for multi user.
>
>uidfthis = Sys(2015)
>Index On custno To uidfthis
>
>Seek(AllT(This.DisplayValue)) Order uidfthis
>ThisForm.Refresh
>
>This will not give me the sys(2015) generated variable.

You need to use name expression, i.e. enclose the variable in parentheses:
lcCdxFileName=forcepath(forceext(sys(2015), "cdx"), justpath(dbf()))
index on custno tag custno of (lcCdxFileName)
...
seek(AllT(This.DisplayValue), "viewAliasGoesHere"[, "custno"])
* you can omit the third parameter if you are sure Custno is the current order
Two remarks:
The path mumbo-jumbo I employed in the first line is just to make sure the file goes to your temp directory, and I'm getting that directory with justpath(dbf()) - the view resides there. Without setting the path, the temp index file is likely to end in the current directory, which is not where we want it.
"Index on ... to ..." will produce old 2.x-style (older actually) idx files, which are not compact, take up more space, can't have more than one tag per file, and lack some of the Rushmore stuff. Help states that they are used for Rushmore speedups, but I've read otherwise in this very thread. You can force an IDX file to newer technology (like 12 years versus 16) by adding the COMPACT keyword. Still, using the "index on ... tag ... of {filename}" syntax gives you a regular, multi-tagged cdx index file.

The only difference between this and the index you create on your regular tables is that it's not structural, which means it doesn't have the same name as the underlying table (which doesn't matter here, this is a view), it won't open whenever you open the table (doesn't apply to views anyway, they have no structural indexes) and so it won't update automatically unless you specifically open it (which we also don't care about here, because this is a temporary index).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform