FoxPro table didn't open in X# FoxPro Console

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

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

FoxPro table didn't open in X# FoxPro Console

Post by robert »

Karl-Heinz,
Can you show the code ?
Are you specifying the dialect when compiling or are you changing the dialect in the runtime state (which gets set by the compiler).

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4978
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

FoxPro table didn't open in X# FoxPro Console

Post by Chris »

Cecil, please include the new files.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

FoxPro table didn't open in X# FoxPro Console

Post by robert »

Cecil,
I think this was a problem in 2.0.8
In my current version 2.10 (which will be released asap) I am running this:

Code: Select all

RddSetDefault("DBFVFP")
    DbUseArea(FALSE,,"C:TestAddress.dbf")
    LOCAL i AS INT
    FOR i := 1 TO OrderCount()
        ? i, OrdKey(i), OrdFor(i)
    NEXT
    DbCLoseArea()
    RETURN
And the result is

Code: Select all

1 DELETED()
2 id
3 lastupdate
4 RECNO()
5 UPPER(city)+UPPER(lastname)
6 country
7 UPPER(emailaddr)
8 UPPER(contact)
9 hphn
10 UPPER(lastname)+UPPER(firstname)
11 UPPER(title)
12 UPPER(website)
13 wphn
14 UPPER(firstname)
15 UPPER(state)+UPPER(city)
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
cecilchamp
Posts: 49
Joined: Wed Jun 12, 2019 1:44 pm

FoxPro table didn't open in X# FoxPro Console

Post by cecilchamp »

Here is the current code:

I didn't add any records to the zipped file's table this time. I also removed the ID index TAG.

Code: Select all

USING System
USING System.Collections.Generic
USING System.Linq
USING System.Text

#command SET DEFAULT TO <path> => SetDefault(<path>)

FUNCTION Start() AS VOID STRICT
    LOCAL i AS INT
    SET DEFAULT TO "C:addrdata"
        
    SELECT 0
    USE Address
    SCAN for LastName = "Champenois"
        ? LastName, FirstName, City, Country
    ENDSCAN
    WAIT
    *? RddSetDefault()
    *WAIT
    SELECT Address
    USE
	RETURN
Attachments
Address.zip
(1.27 KiB) Downloaded 67 times
User avatar
Chris
Posts: 4978
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

FoxPro table didn't open in X# FoxPro Console

Post by Chris »

Thanks, as Robert says this one works fine here, so it must be a problem fixed in the previous weeks. It shuld work for you as well as soon as the new build is released.

But the (previous) version of the index with "ID" in it still does not work, so it is a bug. Will log this, thanks for your help with testing and finding this!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
cecilchamp
Posts: 49
Joined: Wed Jun 12, 2019 1:44 pm

FoxPro table didn't open in X# FoxPro Console

Post by cecilchamp »

No problem. I hope ultimately that the testing helps to find any issues that need to be resolved.
User avatar
Chris
Posts: 4978
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

FoxPro table didn't open in X# FoxPro Console

Post by Chris »

cecilchamp wrote:No problem. I hope ultimately that the testing helps to find any issues that need to be resolved.
Absolutely!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

FoxPro table didn't open in X# FoxPro Console

Post by Karl-Heinz »

robert wrote:Karl-Heinz,
Can you show the code ?
Are you specifying the dialect when compiling or are you changing the dialect in the runtime state (which gets set by the compiler).

Robert
i select a dialect, compile and run the code. Each time <xbase++> is selected RddSetdefault() returns "DBFNTX", while the other 3 dialects show "DBFVFP"

Code: Select all

FUNCTION Start( ) AS VOID 	
   
    ? RddSetDefault()
  
RETURN

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

FoxPro table didn't open in X# FoxPro Console

Post by robert »

Karl-Heinz,

This is because in the Xbase++ dialect the entry point is called main(). If you change the function name from Start to Main() then it will work as expected.
If you add the following to the code you will also see that the dialect is not properly set if you compile for Xbase++ and name the entry point Start:

? Runtimestate.Dialect:ToString()

The compiler does create the $AppInit() code but does not call that at startup.
If you call the entry point main, then the compiler will generate a start function and will call the $AppInit() code there and will call main from within this start function.
I will see if I can fix that in one of the next builds.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
cecilchamp
Posts: 49
Joined: Wed Jun 12, 2019 1:44 pm

FoxPro table didn't open in X# FoxPro Console

Post by cecilchamp »

Code: Select all

USING System
USING System.Collections.Generic
USING System.Linq
USING System.Text

#command SET DEFAULT TO <path> => SetDefault(<path>)
*#command SET DEFAULT TO <(path)> => SetDefault(<(path)>)

FUNCTION Start() AS VOID STRICT
    LOCAL i AS INT
    SET DEFAULT TO C:addrdata
        
    SELECT 0
    USE names
    SCAN for LastName = "Champenois"
        ? LastName, FirstName
    ENDSCAN
    WAIT
    SELECT Names
    USE
	RETURN	
The SET DEFAULT TO failed, but the program still ran. I have to put quotes around the path either way. In other words I tried both of the #command statements above. Same result.
Post Reply