I have a question coming from one of our developers who is trying to read NAV Item Data from a SQL Database.
Does anyone know of a way to read Navision DateFormula fields using Microsoft SQL Server. I have a value of ‘30D’ (or “1W+1D)” which I can see in the NAV client, but SQL Server returns a value of ‘30’.
We were advised to look at this post from Peter Wijntjes from 2007, has anyone implemented something like this? Your insights are much appreciated.
if you want to be able to read the date formula from SQL this might be of use:
select [Due Date Calculation] , cast ([Due Date Calculation]as varbinary) as Binary, description from [testcompany$Payment Terms]
I have created a number of test entries in de Payment Terms table and the resultset is like this:
so, appearently all numerical values are stored as there Char representative ( ‘3’ –> 0x33, ‘1’ –> 0x31 ) the ‘+’ sign as well and the special (language independent elements) are coded: C = 0x01 *current D = 0x03 W = 0x04 M = 0x05 Y = 0x07 (and the WD is translated to D) in this example.
—————————— Aydan Golaszewski Lead ERP Analyst Jason Pharmaceuticals (Medifast) Owings Mills MD ——————————
CREATE FUNCTION [dbo].[FormatDateFormula] ( @DateFormula varchar(32) ) RETURNS varchar(50) AS BEGIN
SET @DateFormula = REPLACE(@DateFormula,CHAR(1),’C’) SET @DateFormula = REPLACE(@DateFormula,CHAR(2),’D’) SET @DateFormula = REPLACE(@DateFormula,CHAR(3),’WD’) SET @DateFormula = REPLACE(@DateFormula,CHAR(4),’W’) SET @DateFormula = REPLACE(@DateFormula,CHAR(5),’M’) SET @DateFormula = REPLACE(@DateFormula,CHAR(6),’Q’) SET @DateFormula = REPLACE(@DateFormula,CHAR(7),’Y’)
Please note:
This action will also remove this member from your connections and send a report to the site admin.
Please allow a few minutes for this process to complete.
Report
You have already reported this .
Welcome to our new site!
Here you will find a wealth of information created for peopleĀ that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!