first test in 2.8 high priority! All the fields values have the same value:false

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

Post Reply
jpmoschi
Posts: 77
Joined: Thu May 21, 2020 3:45 pm

first test in 2.8 high priority! All the fields values have the same value:false

Post by jpmoschi »

good morning for me, forum:
A simple error beginning the test of the 2.8 review. May by, it is a project setting option?

my code say
local lseleant := select()

The error is 'Select()' threw an exception of type 'System.ArgumentException'
Data: {System.Collections.ListDictionaryInternal}
HResult: -2147024809
HelpLink: null
InnerException: null
Message: "El valor no está dentro del intervalo esperado."
ParamName: null
Source: "XSharp.RT"
StackTrace: " at XSharp.RT.Functions._SelectFoxPro(__Usual[] Xs$Args)
at XSharp.RT.Functions.Select(__Usual[] Xs$Args)"
TargetSite: {XSharp.__Usual _SelectFoxPro(XSharp.__Usual[])}
XSharp.RT.Select()
error CS0234: The type or namespace name 'Select' does not exist in the namespace 'XSharp.RT' (are you missing an assembly reference?)


Is it a setting option?
thanks in advance

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

first test in 2.8

Post by robert »

Juan,
Will look at this asap.
This looks like a bug to me.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
jpmoschi
Posts: 77
Joined: Thu May 21, 2020 3:45 pm

first test in 2.8 high priority! All the fields values have the same value:false

Post by jpmoschi »

ok, it is not important because i can replace Select() with DBGetSelect() without alotof work

but it is really important. The query below execute correctly but all the fields values have the same value:false

if SqlExec(1 , "select m03codoper, m03vigente from m03oper","w03oper")= 1
?Evaluate("m03codoper")
False ( Logic )
Value: FALSE

?Evaluate("m03vigente")
False ( Logic )
Value: FALSE

endif
And in whatch window apparently is correct. It should be clarified that the data types of the fields are M03CODEOPER Char(8) and M03VIGENTE Char(1)

XSharp.RDD.DataSession.Sessions {XSharp.RDD.DataSession[1]} XSharp.RDD.DataSession[]
[0] Global datasession Id: 1 XSharp.RDD.DataSession
CurrentWorkarea DBFVFPSQL (W03OPER) XSharp.RDD.IRdd {XSharp.RDD.DBFVFPSQL}
CurrentWorkareaNO 1 Dword
Id 1 Int
Name "Global datasession" String
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

first test in 2.8 high priority! All the fields values have the same value:false

Post by robert »

Juan Pablo,
The evaluate() function uses the macro compiler to evaluate the expression. The macro compiler does not know if the string that you are passing it is a field, local variable, public variable or private variable. This makes it a relatively expensive operation. And apparently (I did not check this) it also fails to resolve this correctly.

Can you try:

Code: Select all

?Evaluate("w03oper.m03codoper")   // Cursor DOT FieldName
?Evaluate("w03oper->m03codoper")   // Cursor ALIAS operator FieldName
These 2 also use the macro compiler
And what is the result if you code:

Code: Select all

? w03oper.m03codoper
or

Code: Select all

? FieldGetAlias("w03oper", "m03codoper")

or

Code: Select all

? FieldGetSym("m03codoper")

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
jpmoschi
Posts: 77
Joined: Thu May 21, 2020 3:45 pm

first test in 2.8 high priority! All the fields values have the same value:false

Post by jpmoschi »

hi Robert . The Evaluate() was only used in inmediate window. The screen capture attached is more clear to show the problem.
i create a new Console App
Then run and watch ...
Attachments
Captura.PNG
Captura.PNG (42.54 KiB) Viewed 462 times
jpmoschi
Posts: 77
Joined: Thu May 21, 2020 3:45 pm

first test in 2.8 high priority! All the fields values have the same value:false

Post by jpmoschi »

I know what is happening. The sqlexec return the result but the record pointer is in eof() in the new 2.8. release
Post Reply