It is currently Sun May 19, 2013 9:51 am




 Page 1 of 1 [ 3 posts ] 
Author Message
 Post subject: sql int interpretation problem
PostPosted: Tue Jan 04, 2011 9:48 am 
Regular Contributor
Regular Contributor

Joined: Fri Dec 17, 2010 10:22 am
Posts: 12
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


Offline
 Profile  
 
 Post subject: Re: sql int interpretation problem
PostPosted: Tue Jan 04, 2011 9:58 am 
Regular Contributor
Regular Contributor

Joined: Fri Dec 17, 2010 10:22 am
Posts: 12
If I cast it to an int, it works properly:

cast([Temp] as int)


Offline
 Profile  
 
 Post subject: Re: sql int interpretation problem
PostPosted: Tue Jan 04, 2011 5:04 pm 
Noventri Digital Signage Expert
Noventri Digital Signage Expert
User avatar

Joined: Thu Dec 10, 2009 1:51 pm
Posts: 98
Location: Maryland, USA
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.



_________________
Trent Semler
Art Director
Specialized Communications Corp. / Noventri
20940 Twin Springs Dr.
Smithsburg, MD 21783-1510 USA
301-790-0103
Digital Information Display
Menu Display
Flight Board
Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 3 posts ] 


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

cron