Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

SQLExec ODBC Column:table_x.Pwr_T not found

Solved!
Go to solution

Okay,  That worked for me.  Thanks!

 

Now...

 

I need advise on setting up dynamic (programmatic) LocalTime values for the queries.  Basically, I want to do Math_Avg queries for different intervals but always starting from current time going back by the interval amount.  I can do this with expressions and math but I'm having trouble and it looks like I can only insert static sort of code in the query like Text Entry.

 

Ideas on what types of objects I can use and the syntax I need to pass this equivalent logic to SQL?:  LocalTime <= Now() AND LocalTIme > Now() - Interval

 

Ed

0 Kudos
Message 11 of 15
(3,175 Views)

Basically the idea is to calculate the time in numeric, and convert the result to text in SQL.

 

For example,

use expression to calculate the time for Now()-interval, like

expression = now(trigger) - 00:00:01

 

The interval can be in just numeric, like 0.00004

 

And then, write this code in SQL

LocalTime > ' "&text((expression), "mm/dd/yyyy hh:mm:ss")" '

 

Is this what you want?

Ryan Shi
National Instruments
Message 12 of 15
(3,172 Views)

My vesion of your statement:

 

LocalTime > ' "&text((expression), "mm/dd/yyyy hh:mm:ss")" '

 

gives Error: Unexpected character: "

 

Here is my exact substitute on LocalTime contraints after working statement with static times:

 

LocalTime > ' "&text((Exp_Sql1), "mm/dd/yyyy hh:mm:ss")" '

 

I tried other combos of parenthesis but no luck.

 

Ed

0 Kudos
Message 13 of 15
(3,167 Views)

Got it...

 

Just needed ending &....

 

LocalTime > ' "&text((Exp_Sql1), "mm/dd/yyyy hh:mm:ss")" '

 

works great.  Thanks!

0 Kudos
Message 14 of 15
(3,163 Views)

yes, I miss a &

it should like

'"&text(...)&"'

Ryan Shi
National Instruments
0 Kudos
Message 15 of 15
(3,160 Views)