Hi,
I have a problem with importing data from Oracle into Navision. I have made connection and it's working fine with date and text types. If I try to read data which have Number type and empty (null) values then I'll get an error message "The call to memeber Writetext failed. Type mismatch"
For text and data fields I have added following line:
IF ADORecSet.Fields.Item('Descr').Value.ISTEXT THEN BEGIN .. and it works perfectly. But I cannot find option for Number type, I have tried ISDECIMAL and ISINTEGER but neither of them is suitable. I will post also my code which I've been using:
//IF ADORecSet.Fields.Item('CUSTOMERNO').Value.ISINTEGER THEN BEGIN
ADOStream.Open;
ADOStream.WriteText(ADORecSet.Fields.Item('CUSTOMERNO').Value);
ADOStream.Position:= 0;
FieldValue:= ADOStream.ReadText;
ADOStream.Close;
OraSalesInv."Sell-to Customer No." := FieldValue;
//END;
I really appreciate if someone could help me with this.
Thanks in advance,
Anti
0
Answers
Is there any way you can instead create an Oracle view on your table that converts the nulls to 0 - I believe this is the NVL() function, and use the view that instead of the table?
Alternatively, if you are using the SQL Server Option of Navision, you could create a SQL Server view into your Oracle table, using a linked server, and create a LinkedObject from Navision on top of that. This is a bigger change to what you have, but the advantage is that Navision will handle data type conversions for you.
This posting is provided "AS IS" with no warranties, and confers no rights.
Is there something that I'm missing or are there some other functions in Navision which can test null values and skip these fields?
IF ADORecSet.Fields.Item('NO').Value.ISDECIMAL THEN BEGIN
with line
IF FORMAT(ADORecSet.Fields.Item('NO').ActualSize) <> FORMAT(0) THEN BEGIN
and it's working