Hello to all of you!
I am working with InTouch 2017 application for HMI.
So far, so good - configuration is simple, there is two clients, each client has his own SQL database from which we read alarms.
Alarms are working, historical alarms are also working on both of them.
BUT i would like to have an option to have a filter of Historical alarms by date and time ( starting date and time and end date and time) to show only ones that appeared in selected timespan.
So far, I did not manage to make it work.
I can paste here a script i have on a button.
//////////////////////////////////////////////////////////////////////////////////
DIM txtVariable AS MESSAGE;
DIM StartTime AS MESSAGE;
DIM EndTime AS MESSAGE;
DIM HistStartTime AS MESSAGE;
DIM HistEndTime AS MESSAGE;
DIM IsValid AS DISCRETE;
IsValid = 1;
GetPropertyM ("txtStartMonth", txtVariable );
StartTime = Text(StringToIntg(txtVariable),"00");
HistStartTime = Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 1 OR StringToIntg(txtVariable) > 12 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtStartDay", txtVariable );
StartTime = StartTime + "/" + Text(StringToIntg(txtVariable),"00");
HistStartTime = Text(StringToIntg(txtVariable),"00") + "/" + HistStartTime;
IF StringToIntg(txtVariable) < 1 OR StringToIntg(txtVariable) > 31 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtStartYear", txtVariable );
StartTime = StartTime + "/" + Text(StringToIntg(txtVariable),"0000");
HistStartTime = HistStartTime + "/" + Text(StringToIntg(txtVariable),"0000");
IF StringToIntg(txtVariable) < 2000 OR StringToIntg(txtVariable) > 2036 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtStartHour", txtVariable );
StartTime = StartTime + " " + Text(StringToIntg(txtVariable),"00");
HistStartTime = HistStartTime + " " + Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 0 OR StringToIntg(txtVariable) > 23 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtStartMin", txtVariable );
StartTime = StartTime + ":" + Text(StringToIntg(txtVariable),"00");
HistStartTime = HistStartTime + ":" + Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 0 OR StringToIntg(txtVariable) > 59 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndMonth", txtVariable );
EndTime = Text(StringToIntg(txtVariable),"00");
HistEndTime = Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 1 OR StringToIntg(txtVariable) > 12 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndDay", txtVariable );
EndTime = EndTime + "/" + Text(StringToIntg(txtVariable),"00");
HistEndTime = Text(StringToIntg(txtVariable),"00") + "/" + HistEndTime;
IF StringToIntg(txtVariable) < 1 OR StringToIntg(txtVariable) > 31 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndYear", txtVariable );
EndTime = EndTime + "/" + Text(StringToIntg(txtVariable),"0000");
HistEndTime = HistEndTime + "/" + Text(StringToIntg(txtVariable),"0000");
IF StringToIntg(txtVariable) < 2000 OR StringToIntg(txtVariable) > 2050 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndHour", txtVariable );
EndTime = EndTime + " " + Text(StringToIntg(txtVariable),"00");
HistEndTime = HistEndTime + " " + Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 0 OR StringToIntg(txtVariable) > 23 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndMin", txtVariable );
EndTime =EndTime + ":" + Text(StringToIntg(txtVariable),"00");
HistEndTime = HistEndTime + ":" + Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 0 OR StringToIntg(txtVariable) > 59 THEN
IsValid = 0;
ENDIF;
IF IsValid == 1 THEN
#EveDbViewCtrl.EndTime = EndTime;
#EveDbViewCtrl.StartTime = StartTime;
#AlmDbViewCtrl.EndTime = EndTime;
#AlmDbViewCtrl.StartTime = StartTime;
#EveDbViewCtrl.Refresh();
#AlmDbViewCtrl.Refresh();
m_HistStartTime = StringLeft(HistStartTime,16);
m_HistEndTime = StringLeft(HistEndTime,16);
HideSelf;
ENDIF;
//////////////////////////////////////////////////////////////////////////////
so far, all of the alarms from history are displayed, no matter what i write in the filter
Maybe it is not even possible to do this without some ActiveX control or something.
If anyone ha any hint or idea, I would be grateful!
Thanks , cheers!
I am working with InTouch 2017 application for HMI.
So far, so good - configuration is simple, there is two clients, each client has his own SQL database from which we read alarms.
Alarms are working, historical alarms are also working on both of them.
BUT i would like to have an option to have a filter of Historical alarms by date and time ( starting date and time and end date and time) to show only ones that appeared in selected timespan.
So far, I did not manage to make it work.
I can paste here a script i have on a button.
//////////////////////////////////////////////////////////////////////////////////
DIM txtVariable AS MESSAGE;
DIM StartTime AS MESSAGE;
DIM EndTime AS MESSAGE;
DIM HistStartTime AS MESSAGE;
DIM HistEndTime AS MESSAGE;
DIM IsValid AS DISCRETE;
IsValid = 1;
GetPropertyM ("txtStartMonth", txtVariable );
StartTime = Text(StringToIntg(txtVariable),"00");
HistStartTime = Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 1 OR StringToIntg(txtVariable) > 12 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtStartDay", txtVariable );
StartTime = StartTime + "/" + Text(StringToIntg(txtVariable),"00");
HistStartTime = Text(StringToIntg(txtVariable),"00") + "/" + HistStartTime;
IF StringToIntg(txtVariable) < 1 OR StringToIntg(txtVariable) > 31 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtStartYear", txtVariable );
StartTime = StartTime + "/" + Text(StringToIntg(txtVariable),"0000");
HistStartTime = HistStartTime + "/" + Text(StringToIntg(txtVariable),"0000");
IF StringToIntg(txtVariable) < 2000 OR StringToIntg(txtVariable) > 2036 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtStartHour", txtVariable );
StartTime = StartTime + " " + Text(StringToIntg(txtVariable),"00");
HistStartTime = HistStartTime + " " + Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 0 OR StringToIntg(txtVariable) > 23 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtStartMin", txtVariable );
StartTime = StartTime + ":" + Text(StringToIntg(txtVariable),"00");
HistStartTime = HistStartTime + ":" + Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 0 OR StringToIntg(txtVariable) > 59 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndMonth", txtVariable );
EndTime = Text(StringToIntg(txtVariable),"00");
HistEndTime = Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 1 OR StringToIntg(txtVariable) > 12 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndDay", txtVariable );
EndTime = EndTime + "/" + Text(StringToIntg(txtVariable),"00");
HistEndTime = Text(StringToIntg(txtVariable),"00") + "/" + HistEndTime;
IF StringToIntg(txtVariable) < 1 OR StringToIntg(txtVariable) > 31 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndYear", txtVariable );
EndTime = EndTime + "/" + Text(StringToIntg(txtVariable),"0000");
HistEndTime = HistEndTime + "/" + Text(StringToIntg(txtVariable),"0000");
IF StringToIntg(txtVariable) < 2000 OR StringToIntg(txtVariable) > 2050 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndHour", txtVariable );
EndTime = EndTime + " " + Text(StringToIntg(txtVariable),"00");
HistEndTime = HistEndTime + " " + Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 0 OR StringToIntg(txtVariable) > 23 THEN
IsValid = 0;
ENDIF;
GetPropertyM ("txtEndMin", txtVariable );
EndTime =EndTime + ":" + Text(StringToIntg(txtVariable),"00");
HistEndTime = HistEndTime + ":" + Text(StringToIntg(txtVariable),"00");
IF StringToIntg(txtVariable) < 0 OR StringToIntg(txtVariable) > 59 THEN
IsValid = 0;
ENDIF;
IF IsValid == 1 THEN
#EveDbViewCtrl.EndTime = EndTime;
#EveDbViewCtrl.StartTime = StartTime;
#AlmDbViewCtrl.EndTime = EndTime;
#AlmDbViewCtrl.StartTime = StartTime;
#EveDbViewCtrl.Refresh();
#AlmDbViewCtrl.Refresh();
m_HistStartTime = StringLeft(HistStartTime,16);
m_HistEndTime = StringLeft(HistEndTime,16);
HideSelf;
ENDIF;
//////////////////////////////////////////////////////////////////////////////
so far, all of the alarms from history are displayed, no matter what i write in the filter
Maybe it is not even possible to do this without some ActiveX control or something.
If anyone ha any hint or idea, I would be grateful!
Thanks , cheers!