Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Browse
Message
From
02/01/2010 00:04:13
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Browse
Environment versions
Visual FoxPro:
VFP 6 SP3
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01441538
Message ID:
01441578
Views:
48
>Dragan,
>
>Thanks for your timely response. I wish I did have ATAGINFO() but I'm still using VFP6 and as far as I know that function did not appear until Version 7.
>
>I will use a grid but guess I will have to build my own TAG ARRAY. I was hoping someone had already created what I was looking for.
>
>Again, thanks.
>
>Harry


Harry,

I did something like that back in the vfp6 time
&& sample

	use TheTable
	local ti[1], nti
	
	&& all tags
	if( TagInfo_Get(@m.ti, @m.nti, select(0)) )
	
	
	endif
	
	&& only tags involved in relationships
	if( TagInfo_Get(@m.ti, @m.nti, select(0), true) )
	
	endif
	
	&& only primary tag
	if( TagInfo_Get(@m.ti, @m.nti, select(0), false, true) )
	
	endif
	
	&& both primary tag and those involved in relationships
	if( TagInfo_Get(@m.ti, @m.nti, select(0), true, true) )
	
	endif
function	TagInfo_Get
	lparameters	ti, ;	&& array (pass by reference)
				nti, ;	&& number of items in the array (pass by reference)
				WorkAreaOrAlias, ;
				RelationTags, ;	&& Only tags involved in relationships
				PrimaryTag	&& only Primary tag

#if FALSE
	, 1	= Tag name
	, 2	= P/C/U/R
	, 3	= Index key expression
	, 4 = Filter expression
	, 5	= ASCENDING/DESCENDING
	, 6 = Collating sequence
#endif
	
	local Success
	Success = TRUE
	
	if( empty(m.WorkAreaOrAlias) )
		WorkAreaOrAlias = select(0)
	endif
	
	nti = 0
	
	do case
	case !used(m.WorkAreaOrAlias)
		assert FALSE
		Success = FALSE
	
	case m.RelationTags and (dbc() <> cursorgetprop('Database', m.WorkAreaOrAlias))
		assert FALSE
		Success = FALSE
		
	case !empty(cdx(1, m.WorkAreaOrAlias))
		
		nti = tagcount(cdx(1, m.WorkAreaOrAlias), m.WorkAreaOrAlias)
		
		local i, j, n, TableName, TagName, aa[1], naa, RelationTagArray[1]
		
		if( m.RelationTags )
			TableName = cursorgetprop('SourceName', m.WorkAreaOrAlias)
			
			naa = adbobjects(aa, 'Relation')
			
			local RelationTagArray[ max(m.nti, 1) ]
			n = 0
			
			for i = 1 to adbobjects(aa, 'Relation')
				
				for j = 1 to 2
				
					do case
					case aa[m.i, m.j] <> m.TableName 
					
					case !empty(ascan(RelationTagArray, aa[m.i, m.j+2]))
					
					otherwise
						n = m.n + 1
						RelationTagArray[ m.n ] = aa[m.i, m.j+2]
						
					endcase
				endfor
			endfor
			
			dime RelationTagArray[ max(m.n, 1) ]
			
		endif
		
		dime ti[m.nti, 6]
		n = 0
		
		for i = 1 to m.nti
			
			TagName = tag(cdx(1, m.WorkAreaOrAlias), m.i, m.WorkAreaOrAlias)
			
			do case
			case !m.RelationTags and !m.PrimaryTag	&& all tags
				n = m.i
				
			case !( m.PrimaryTag and Primary(m.i, m.WorkAreaOrAlias)) and !(m.RelationTags and !empty(ascan(RelationTagArray, m.TagName)))
				loop
			
			otherwise
				n = m.n + 1
			
			endcase
			
			ti[m.n, 1] = m.TagName
			
			ti[m.n, 2] = iif(Primary(m.i, m.WorkAreaOrAlias), ;
							'P', ;
							iif(Candidate(m.i, m.WorkAreaOrAlias), ;
								'C', ;
								iif(Unique(m.i, m.WorkAreaOrAlias), ;
									'U', ;
									'R' ;
								   ) ;
							   ) ;
						   )
			ti[m.n, 3] = sys(14, m.i, m.WorkAreaOrAlias)
			ti[m.n, 4] = sys(2021, m.i, m.WorkAreaOrAlias)
			ti[m.n, 5] = iif( !descending(m.i, m.WorkAreaOrAlias), 'ASCENDING', 'DESCENDING')
			ti[m.n, 6] = idxcollate(m.i, m.WorkAreaOrAlias)
			
		endfor
	
		if( m.PrimaryTag or m.RelationTags)
			
			if( m.nti <> m.n )
				dime ti[max(m.n, 1), 6]
			endif
			
			nti = m.n
	
		endif
		
	endcase
	
	return m.Success
endfunc
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform