Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine index type?
Message
 
To
14/02/2003 12:45:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00753313
Message ID:
00753403
Views:
19
Hi Gregory

I can't believe I missed this despite searching the help, but thanks it is exactly what I need.

Simon



>>Hi
>>
>>I ran into a problem where I needed to know if an index was created using the Unique clause. However, I could not find any function that would return this info.
>>
>>Other than routing the Display Status to a text file and searching the results does anyone know how to determine this programmatically?
>>
>>Ideally it would be good to have a function that returned the index type (ie. Primary, Candidate, Unique).
>>
>>Thanks
>>Simon
>
>Simon,
>
>From vfp7 onwards you can use ataginfo()
>
>If you are on vfp6, use the function included below.
>
>What you're after can be found by a combination of Primary(), Candidate() and Unique(). See ti[i, 2] assignment
>
>
>function	TagInfo_Get(ti, WorkAreaOrAlias)
>	
>	if( empty(WorkAreaOrAlias) )
>		WorkAreaOrAlias = select(0)
>	endif
>	
>	local i
>	
>	i = 1
>	
>	if( !empty(cdx(1, WorkAreaOrAlias)) )
>		for i = 1 to tagcount(cdx(1, WorkAreaOrAlias), WorkAreaOrAlias)
>			dime ti[i, 6]
>			
>			ti[i, 1] = tag(cdx(1, WorkAreaOrAlias), i, WorkAreaOrAlias)
>			ti[i, 2] = iif(Primary(i, WorkAreaOrAlias), ;
>							'P', ;
>							iif(Candidate(i, WorkAreaOrAlias), ;
>								'C', ;
>								iif(Unique(i, WorkAreaOrAlias), ;
>									'U', ;
>									'R' ;
>								   ) ;
>							   ) ;
>						   )
>			ti[i, 3] = sys(14, i, WorkAreaOrAlias)
>			ti[i, 4] = sys(2021, i, WorkAreaOrAlias)
>			ti[i, 5] = iif( !descending(i, WorkAreaOrAlias), 'ASCENDING', 'DESCENDING')
>			ti[i, 6] = idxcollate(i, WorkAreaOrAlias)
>		endfor
>	endif
>	
>	return (i-1)
>endfunc
>*---------------------------------------------------------------------------
>
Simon White
dCipher Computing
Previous
Reply
Map
View

Click here to load this message in the networking platform