[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP.php on line 128: file_put_contents(./cache/production//s9e_renderer_b9a4ca121d387bc05a3d17f78bb6919b033dd2f8.php): failed to open stream: Permission denied
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Digital Signage Forum - Noventri • sql int interpretation problem
Page 1 of 1

sql int interpretation problem

Posted: Tue Jan 04, 2011 9:48 am
by de-tthomalla
I am Running Suite 2.0.752.

I have text set up to pull data from a SQL server, which works fine. It pulls the most recent record that is the current weather conditions. However, today it is -4, and the database text on my page now shows 65532. This seems to be a 2s complement issue when the software is interpreting the data from SQL. The datatype in SQL is a smallint. Is there a workaround?

Tom

Re: sql int interpretation problem

Posted: Tue Jan 04, 2011 9:58 am
by de-tthomalla
If I cast it to an int, it works properly:

cast([Temp] as int)

Re: sql int interpretation problem

Posted: Tue Jan 04, 2011 5:04 pm
by Trent S
Hello Tom,

Thank you for your enquiry.

This issue is caused by the way smallint is presented through ODBC.

You are correct in casting the temperature as an int to fix this issue.

For the benefit of other Forum users, let's go into some more detail:

This issue can be fixed inside of Noventri Suite by using an advanced select statement.
In Noventri Suite, get into the region that will be displaying your temperature, and then into the "Advanced" tab. Once you've connected to your database with the "Connect" button, click the "Select" button. Click on the "Advanced" radio button, and the use the following select statement in place of the default:

SELECT Your Temperature Column Name = CONVERT(int, Your Temperature Column Name) FROM [Your Table Name]

For example, let's say your table looks like this:

Image

The default select statement is this:
SELECT * FROM TableName

With this select statement, the formatter [1:Temperature] would return: "65532" for a temperature of -4.

Our new select statement to correct this would look like this:
SELECT Temperature = CONVERT(int, Temperature), Place, Date FROM [Table_1]

Which with the same formatter of [1:Temperature] would return: "-4"

Another alternative: Simply convert your Temperature column's data type in your SQL database from smallint to int, and then refresh the database information inside of Noventri Suite.