Handling AdNumeric datatype in Navision

Hi I’m having trouble getting Navision to accept the datatype AdNumeric from a ‘Microsoft ActiveX Data Objects 2.7 Library’.Recordset automation control. here’s an example of the problem: if RecordSet.Fields.Item(FieldNo).Type = 131 then // 131 = adNumeric Table.Field := RecordSet.Fields.Item(FieldNo).Value // error - datatype not supported [}:)] else Table.Field := RecordSet.Fields.Item(FieldNo).Value; // success… [:)] I’ve tried using format, mdac 2.8 and every property, method or trigger i could think of in Navision and the RecordSet… [|)] Do you know a solution or workaround [?] - I don’t have the option of changing the datatype because data is acutally being fetched from a Navision C5 database using odbc… [xx(]

to simplify the question, what I am searching is a way to change the datatype adNumeric (standard Microsoft ADO datatype) into Navision decimal format. now, much more clear isn’t it [;)]

Hi, Try defining a function called “ReadADOFieldDecimal” Local Parameters adField Automation ‘Microsoft ActiveX Data Objects 2.7 Library’.Field Local ReturnValue DecimalValue Decimal Local Variables adStream Automation ‘Microsoft ActiveX Data Objects 2.7 Library’.Stream Code CREATE(adStream); adStream.Open; adStream.WriteText(adField.Value); adStream.Position := 0; IF EVALUATE(DecimalValue,adStream.ReadText) THEN ; Then call the function: NaviTable.NaviField := ReadADOFieldDecimal(adRecordset.Fields.Item(FieldNo)); I didn’t test it with the adNumeric datatype but I use it for a lot of other stuff so I think it should be OK…

Hi Nelson Alberto, Thanks alot, you’re a lifesaver… [:D] Now I can import adNumeric datatypes to Navision. Nice! [8D] Thanks again, mate!

Doesn’t EVALUATE(DecimalValue,RecordSet.Fields.Item(FieldNo).Value) work then?

Hi, Some data types used by other applications/languages are simply not supported in Navision. There is no need for it, because Navi is not a development/programming tool. If you try to access one of this unsupported data types you will get this error text: This message is for C/AL programmers: This data type is not supported by C/SIDE. You can access data from any of the following data types: VT_VOID, VT_I2, VT_I4, VT_R4, VT_R8, VT_CY, VT_DATE, VT_BSTR and VT_BOOL However, C/SIDE is powerful enough to work around this “issue”. By using the “Stream” Automation object, one can transform any external data type into a string that can be read by Navi, and then EVALUATE’d into the desired data type. I hope everything is clear

So what you are saying is the value in “RecordSet.Fields.Item(FieldNo).Value” is kind of binary (garbage for navision) and needs to be converted first.

Exactly! And if you want to know even more just post it.

Can someone suggest me the solution for the above mentioned error?

What is “Stream” Automation???