Hello,
We are currently developing a Magento - NAV integration. For that we use ADO so we can control everything from NAV. This works very well so far but now a problem with the decimal format came up. In Magento for example prices are stored as decimal(12,4). And when I access these fields I get the following error message:
"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, ... "
It looks that there is no way to format the result I get the same message. Somewhere I read something of using the CAST() function, but that did not work either. Does anyone have an idea what we could do here?
Best regards
0
Comments
Can you post a code snippet on how you are accessing the decimal value from mySQL? I'm not sure, but maybe you can first store the value in a NAV variant type.
Regards
Thomas
Please find below the most important part of the code:
Even when I try to read the value with MESSAGE(FORMAT(...), it does not work. So it must be an issue with C/SIDE. Maybe you have an idea?
Best regards,
Felix
I have no access to a mySQL DB, so we need a kind of try and error...
Can you try to get the value first in a variable of type variant, eg:
myVariant := OdbcRecord.Fields.Item('qty_ordered').Value;
If this works, you could try to convert the value then, either with the format or the evaluate command.
Good luck
Thomas
I've worked alot with NAV-MySQL integrations. I'm creating an integration with Interspire Shopping Cart now. You can do it in two commands.
Sql := 'SELECT * FROM [CUSTOMVALUE] WHERE [CUSTOM]=' + SingleQuote + FORMAT(CustomID) + SingleQuote;
ADOrs.Open(Sql, ADOConn, OpenMethod, LockMethod);
....
ADOField := ADOrs.Fields.Item('VALUE');
EVALUATE(WebSalesLine."Unit Price", CONVERTSTR(FORMAT(ADOField.Value), ',', '.'));
WebSalesLine.VALIDATE("Unit Price");
You can probably skip the whole ADOField step if you don't need the ADO field and go:
EVALUATE(WebSalesLine."Unit Price", CONVERTSTR(FORMAT(ADOrs.Fields.Item('VALUE').Value), ',', '.'));
Thank you for your answers.
I tried both of your ideas, but none of them worked with the Magento database. Maybe they use a special decimal format which is not compatibel with NAV.
However I found a solution for the problem. I changed my SQL statement and the code as follows:
I am not sure if this is the best solution but for now it works. Thank you for your input.
Best regards,
Felix
Nav, T-SQL.