Alarm filtering by DB query

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
smolenak
Posts: 22
Joined: Tue Nov 20, 2012 3:06 am

Alarm filtering by DB query

Post by smolenak »

Hello,

what would be proper syntax for querying ActiveTime column (datetime) from AlarmServer table (Database.sdf)?
I have datetime format like 8.12.2013 8:26:26.

This is ok and works:
DatabaseViewer1.SendSelectQuery("Select * from AlarmServer", "Database.sdf");

This for example fails.. It just doesn't return anything, althought I have alarms in DB within those dates.
DatabaseViewer1.SendSelectQuery("Select * from AlarmServer where ActiveTime > 5.1.2013 00:00:00", "Database.sdf");


Thanks!

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Alarm filtering by DB query

Post by mark.monroe »

Take a look at this forum post. It points you to the DatabaseViewer. That can be used to test your database queries.

There are many SQL references available on the internet. You should take a look at them and use the DatabaseViewer.exe to run test queries against your database.

You can either export a database from your HMI, or you use the Sample_Alarm project, that comes with iX Developer, on your PC to populate a database with sample alarms.

First run the project on your PC and cause a few alarms. Then open the below file using DatabaseViewer.exe.

C:\Users\Public\Documents\Beijer Electronics AB\iX Developer 2\Sample Projects\Sample_Alarm\Temp\Output\Database.sdf

C:\Program Files (x86)\Beijer Electronics AB\iX Developer 2.0.356\Bin\DatabaseViewer.exe
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Post Reply