Couple of VFP to X# issues

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

Post Reply
Loy2888
Posts: 14
Joined: Thu Jul 30, 2020 5:46 pm

Couple of VFP to X# issues

Post by Loy2888 »

I've been evaluating the VFP side of this product for more than a week now and I can see a big opportunity here. I am happy of what I am seeing so far. Kudos to your team developing this amazing product. I understand it's still partially completed but I hope some of the issues I encountered while evaluating this product will be addressed in the next release (or maybe there is already a workaround that I am not aware of)

Here are the issues I found so far that works in VFP but not (yet) in X#:

#1. This code errors out because of the enclosed quotation marks(") in the TEXT/ENDTEXT block. Removing them works or replacing them with single quote (') works as well.

Code: Select all

lcVar = "Loy"
TEXT TO cTemp TEXTMERGE NOSHOW PRETEXT 15
     "<<lcVar>>"
ENDTEXT
#2. Macro substitution doesn't seem to work on objects when accessing it property value.

Code: Select all

obj = createobject("empty")
AddProperty(obj,"MyName","Loy")
? obj.MyName  && prints "Loy" - This works

LOCAL macrovar
macrovar = "obj.MyName"
? &macrovar   && This errors out
	
//This one works when you get the value of the property
LOCAL prop
prop = "MyName"
? obj.&prop

//But, this one errors out when setting the value of the property
obj.&prop = "Jack"

#3. In an existing Table with CDX, if there is at least one index tag that has an index expression that is not yet implemented, you can no longer use any of its index tag. For example:

Code: Select all

USE Employee.dbf New
//Note: My table has the following existing index tags:
//EMPID TAG EMPID
//LASTNAME TAG LASTNAME	
//TTOC(TIMESTAMP)+OTHERFIELD TAG TIMESTAMP

//Note TTOC() function here is not yet implemented, so if I 

SELECT "Employee"
SET ORDER TO "LASTNAME"
GO TOP
SCAN
	? LASTNAME  
ENDDSCAN

//The order will not work. But if I remove the "TIMESTAMP" tag, this will work.



Thank you and all the best to your team.

Loy
FoxProMatt

Couple of VFP to X# issues

Post by FoxProMatt »

On item #3, if you define your own TTOC() function locally in your code that accepts the correct parameter(s) and return the correct data type/value your code and index will work.

Once you have that function implemented you can send the code to the X# Dev Team and perhaps they can use it in the next release of the software. That’s the thing about all the runtime functions… The FoxPro community itself can easily implement those and send in the code. It’s just that not many people have done that yet, but some have.
User avatar
Chris
Posts: 4854
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Couple of VFP to X# issues

Post by Chris »

Hi Loy,

Sorry for the delay getting back to you and thanks a lot for your reports and nice words!

The first 2 compiler problems are confirmed and logged:

https://github.com/X-Sharp/XSharpPublic/issues/469
https://github.com/X-Sharp/XSharpPublic/issues/470

About the problem with the missing function in indexes, I agree with matt that we need to implement the missing function, but at the same time indeed the "other" order should still work, this is both the case in VO and in VFP. Logged this as well:

https://github.com/X-Sharp/XSharpPublic/issues/471
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Loy2888
Posts: 14
Joined: Thu Jul 30, 2020 5:46 pm

Couple of VFP to X# issues

Post by Loy2888 »

Thanks Matt and Chris.

So, item #3 worked when I created a simple TTOC() function:

Code: Select all

FUNCTION ttoc(dt AS DATETIME)
    RETURN dt.ToString('MM/dd/yyyy mm:hh:ss')
ENDFUNC
However, when I set the order to "TIMESTAMP" this time, the order for TIMESTAMP is almost correct except for the last row? :)

Code: Select all

RddSetDefault("DBFVFP")
USE "c:tempemployee" New shared
SET ORDER TO "TIMESTAMP"
GO TOP
SCAN
   ? TTOC(TIMESTAMP)
ENDSCAN

// The result is:
01/01/2020 12:09:51
01/25/2020 17:11:23
03/13/2020 24:03:24
08/06/2020 13:03:14
12/31/2019 10:10:01
FYI

Thanks
User avatar
robert
Posts: 4478
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Couple of VFP to X# issues

Post by robert »

Loy,
This is correct because 12 is larger than 08.
If you want Sort on the value you should probably format it as 'yyyy/MM/dd mm:hh:ss'

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Loy2888
Posts: 14
Joined: Thu Jul 30, 2020 5:46 pm

Couple of VFP to X# issues

Post by Loy2888 »

Ah - yes, Thanks Robert. I was thinking of being sorted by "DateTime" type field where year 2019 supposed to be the first in the order followed by 2020. I did not realize it was sorted in a string type. So, this issue is then fixed. Thanks...
Post Reply