xsharp.eu • FoxPro table didn't open in X# FoxPro Console - Page 5
Page 5 of 6

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 4:15 pm
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

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 4:17 pm
by Chris
Cecil, please include the new files.

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 4:25 pm
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

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 4:26 pm
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

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 4:37 pm
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!

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 4:40 pm
by cecilchamp
No problem. I hope ultimately that the testing helps to find any issues that need to be resolved.

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 4:42 pm
by Chris
cecilchamp wrote:No problem. I hope ultimately that the testing helps to find any issues that need to be resolved.
Absolutely!

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 5:19 pm
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

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 8:01 pm
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

FoxPro table didn't open in X# FoxPro Console

Posted: Sun Nov 24, 2019 11:33 pm
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.