DecodeDate raise an variant error
Hi !
I receive an "Invalid variant type conversion", when I call the "EncodeDate" method.
FastScript example:
var
aDate: TDateTime;
begin
aDate := EncodeDate(2004,10,01)
Regards
Christian
I receive an "Invalid variant type conversion", when I call the "EncodeDate" method.
FastScript example:
var
aDate: TDateTime;
begin
aDate := EncodeDate(2004,10,01)
Regards
Christian
Comments
Result from debugger:
function TfsMethodHelper.GetValue: Variant;
var
v: Variant;
i: Integer;
s: String;
Instance: TObject;
begin
if Assigned(FOnCall) then
begin
v := VarArrayCreate([0, Count - 1], varVariant);
for i := 0 to Count - 1 do
v := Params.Value; <<< Here
VALUES:
count = 2
i = 1
Params[0] = 2004
Params[1] = 10
Params[2] = 1
It happens in the second loop (i=1)
I tried it in the FastScript demo program, and I get the same error.
Christian
This example works:
decodeDate(date,y,m,d);
da := encodeDate(y,m,d);
- but this don't:
d := 1;
m := 1;
da := encodeDate(y,m,d);
I debugged the TfsMethodHelper.GetValue function, and notify that the parameter variant type is "varInteger" in the first example and is "varInt64" in the last example, for ???day???, ???month??? and ???year???.
The error happens when the parameter variant type is varInt64
Please help
Christian
I got the problem after I updated to FastScript 1,7
I've 2 solutions:
1)
Go back to FastScript 1,6
2)
Modify the code in unit fs_iinterpreter
if Assigned(FOnCall) then
begin
v := VarArrayCreate([0, Count - 1], varVariant);
// Modified >>
for i := 0 to Count - 1 do begin
if varType(Params.Value) <> varInt64 then
v := Params.Value
else
v := Integer(Params.Value);
end;
// << Modified
What do you prefer?