Hi,
I've setup the RDBMS interface to output equipment meters, once a day using a scan class, to the maintenance department's CMMS database (Infor EAM and SQL Server 2005). This in turn automatically generates work orders for PMs when appropriate. The solution works well but there is one issue I would like to improve. Currently, new meter readings will be added to the CMMS for all equipment regardless of whether their meter values have changed.
I tried to use the following SQL statement...
IF ? > dateadd(hour, -24, getdate()) INSERT INTO R5READINGSINTERFACE (REI_METER, REI_DATE, REI_RECORDED, REI_READING, REI_OBTYPE, REI_OBRTYPE, REI_OBJECT, REI_CALCUOM, REI_OBJECT_ORG, REI_USER, REI_ORG) VALUES ('SAP-PSTN1750-CYCLE', {Fn NOW()}, ?, ?, 'A', 'A', 'PSTN1750', '75', 'SAP', 'SAP.METER', 'SAP');
Exdesc: P1='SAP.Proc.S1700.PSTN1750.Travel.Strokes'/TS P2=P1 P3='SAP.Proc.S1700.PSTN1750.Travel.Strokes'/VL
which should make the SQL execution require that the meter was updated in the last 24 hours. Unfortunately, it doesn't work because the interface's SQL parser tries to interpret the "IF" as an out-of-order keyword which causes the whole statement to fail.
Any ideas how I can solve this?