Tagxxx() functions

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Tagxxx() functions

Post by Karl-Heinz »

Hi Robert and Chris,

While trying out some Tagxx() functions i noticed some problems. The sample uses a structural and a non-structual compound index. Each CDX has 3 Tags

-TagCount () does not differentiate whether a CDX is specified or not. The func always returns the number of all available (6) TAGs.

-The Tag() function needs a parameter check since I always have to type e.g. Tag ( , 1) instead of Tag (1)

-My FP-DOS Order() results are different than the X# Order() results. I created a Order_Fix() function that shows the same results as FP-DOS. Maybe someone from the VFP community verifies that ?

the required DBF and CDXs are attached.

Code: Select all


/*

	FP-dialect
   
	xsharp.core
	xsharp.rt
	xsharp.vfp 

*/

FUNCTION Start( ) AS VOID 
LOCAL cPath, cDBF, cCDX AS STRING 

    ? RddSetDefault() // "DBFVFP"
    ?
    
	cPath = "d:test"
	
	cDBF = "small.dbf" 
	cCDX = "small1x.cdx" 
	
	
	DbUseArea ( TRUE, , cPath + cDBF )  // auto opens small.cdx  
	
	DbSetIndex ( cPath + cCDX )  // open small1x.cdx
	  
	DbSetOrder ( 5 )
	
	? "Total No. of Tags" , DbOrderInfo(DBOI_ORDERCOUNT )  // 6    ok 
	?  
	? "No. of SMALL Tags" ,  DbOrderInfo(DBOI_ORDERCOUNT , "SMALL" ) , "must show 3" // 6 instead of 3  , VO shows correctly 3
	? "TagCount() SMALL" , TagCount ( "SMALL" ) , "must show 3" // 6   instead of 3
	? 
	? "No. of SMALL1X Tags" , DbOrderInfo(DBOI_ORDERCOUNT , "SMALL1X" ) , "must show 3" // 6 instead of 3  , VO shows correctly 3
	? "TagCount() SMALL1X" , TagCount ( "SMALL1X" ) , "must show 3" // 6   instead of 3 
	? 
	? 
	
	FOR VAR i = 1 TO TagCount() 
		 ? Cdx (i) , TAG_FIX( i ) , TagNo ( Tag ( , i) ,Cdx(i) )  
	NEXT
    ? 
    
    // note: above, the active order was set to 5 . That´s "ORDER2" of the small1x.cdx  
    
	? "*" , Order("small",1)	// ok, "d:testsmall1x.cdx"
	? "*" , Order("small" )		// wrong  "d:testsmall1x.cdx"
	? "*" , Order( 1 )			// wrong  "d:testsmall1x.cdx"                                       
	? "*" , Order ()			// wrong  "d:testsmall1x.cdx"
	?	
	? "*" , Order_Fix("small",1)	// ok, "d:testsmall1x.cdx"
	? "*" , Order_Fix("small" )		// ok, "ORDER2" 
	? "*" , Order_Fix( 1 ) 			// ok, "ORDER2"                                        
	? "*" , Order_Fix ()    		// ok, "ORDER2" 
	? 
	
    DbSetOrder(0)
    
	// ok, shows empty strings only
	
	? "*" , Order("small",1) 
	? "*" , Order("small" ) 
	? "*" , Order( 1 )                                        
	? "*" , Order ()
	?
	? "*" , Order_Fix("small",1) 
	? "*" , Order_Fix("small" ) 
	? "*" , Order_Fix( 1 )                                        
	? "*" , Order_Fix ()    	   
    
    DbCloseArea()
      
RETURN

FUNCTION TAG_FIX ( CDXFileName, nTagNumber, uArea ) AS STRING CLIPPER
    
	// a param check is needed, something like ...
	
	IF PCount() = 1 
		IF IsNumeric ( CDXFileName )  
			nTagNumber = CdxFileName
			CdxFileName = NIL 			
		ENDIF 
	ENDIF 
			
	RETURN Tag ( CDXFileName , nTagNumber , uArea ) 
	
FUNCTION Order_Fix ( uArea, nPath) AS STRING 
	
	IF PCount() == 0 
		RETURN DbOrderInfo(DBOI_NAME, , 0) // Tag ( , 0) 
		
	ELSEIF PCount() == 1 
		RETURN (uArea)->DbOrderInfo(DBOI_NAME, , 0)  //nTag ( , 0) 
		
	ELSEIF PCount() == 2 
		IF IsNumeric ( nPath ) 
		   RETURN (uArea)-> DbOrderInfo(DBOI_BAGNAME) 
		ENDIF 
		
	ENDIF 
	
	RETURN ""	
regards
Karl-Heinz
Attachments
small.zip
(1.52 KiB) Downloaded 62 times
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Tagxxx() functions

Post by robert »

Karl-Heinz ,

Thanks for the report. This is indeed not correct.
We'll fix this, but this will not be included in build 2.5 that we'll release any time now.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Tagxxx() functions

Post by Karl-Heinz »

Hi Robert,

should i open a ticket ?

BTW. I subscribed to the "Announcement" option a few days ago, but I didn't receive a notification about the new build. When I log in, i see the button text "Unsubscribe", so I'm registered, right ? Did anyone who signed up receive a notification ??

https://www.xsharp.eu/forum/announcemen ... um-created

regards
Karl-Heinz
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Tagxxx() functions

Post by robert »

Karl-Heinz,
Yes please open a ticket.
And w.r.t. the announcement: I see no subscription to the Announcement forum in your forum profile.
I have added this for you now.
There are several others (Wolfgang, Johan, Karl) who were subscribed to this forum and they should have received the notification.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
FFF
Posts: 1590
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Tagxxx() functions

Post by FFF »

Robert,
Nope, no mail. Got two from the forum re my Xide question, but none other...
EDIT:Strange, while sitting at the strand, i saw a message on the mobil, about 17:53 - but back in the house it seems to be gone. Never mind...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Tagxxx() functions

Post by Karl-Heinz »

Hi Robert,

Argghhh,... it seems i triggered the [subscribe] button that´s below your very first topic "New announcement forum created" , and not the "Announcements" forum button

regards
Karl-Heinz
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Tagxxx() functions

Post by wriedmann »

Hi Robert,
I can confirm that I have received this notification.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply