Float Data Value RestApi


#1

Hello, I am using REST API in a SNAP PAC R1 to insert data in SQL Server 2016, the problem is that when reading a floating value, it does so, but incorrectly assigning the decimal point. why it happens ?


#2

The engineers chose to return all floats as engineering units.
There is nothing wrong with your unit, or what you are doing, everything is working as it should.
You can see that here;
http://developer.opto22.com/static/generated/pac-rest-api/swagger-ui/index.html#!/all/readAnalogInputs


#3

That’s right, my confusion was in the JSON response that is in the guide, but the value is with exponential, it’s just a matter of using the CAST function in SQL Server, thanks.

	DECLARE @Table1 TABLE 	--TE
	(IDTable1 int IDENTITY(1,1),
	 Table1Value	REAL)	 
	INSERT @Table1
	(Table1Value)
	Select CAST([Value] AS real) from @kpi_value	
  --SELECT CAST('7.59400024e+02' AS real);
	select * from @Table1