Alarm filter using start and end date popup calendar

Hello,

I’m trying to filter the alarm journal table using the start and end date selected from the calendar. filter alarm display in the alarm journal table. This problem uses two different windows. The first main window for the alarm journal table and button. when clicking the button then open the popup window. this window selects the start and end date then click the button. Then filter the alarm and display the first window alarm journal table.

Thanks,
Priyanka

you can use something like this:

window =   system.gui.getWindow(your main window path)`

window.getRootContainer().getComponent(alarm journal table).startDate`= 'your selected date' 

Hello,

@lachguerabdallah thank you for your suggestion. I’m trying your solution for the popup window but the following error occurs.

Traceback (most recent call last):
File “event:actionPerformed”, line 5, in
java.lang.ClassCastException: java.lang.ClassCastException: Cannot coerce value '03/16/2021 00:00 ’ into type: class java.util.Date. Invalid date format.

caused by ClassCastException: Cannot coerce value '03/16/2021 00:00 ' into type: class java.util.Date. Invalid date format.

Ignition v8.1.0 (b2020110211)
Java: Azul Systems, Inc. 11.0.7

following script used for the popup window.

table = system.gui.getWindow(“Main_Windows/Alarms”).rootContainer.getComponent(‘AlarmJournal’)
start = event.source.parent.getComponent(‘Start_Time’).text
end = event.source.parent.getComponent(‘End_Time’).text

success = system.alarm.queryJournal(start, end,‘AlarmJournal’)
table.data = success.getDataset()

if not success:
event.source.parent.getComponent(‘Start_Time’).requestFocusInWindow()

This is my main window for the alarm journal table

This is the popup window used for select start and end date using popup calendar.

start_time and end_time are the calendar componentes?
if true, you have to choose the ‘date’ property, no ‘text’ property


start=event.source.parent.getComponent('start date').date
system.gui.getWindow(“Main_Windows/Alarms”).rootContainer.getComponent(‘AlarmJournal’).startDate=start
1 Like

Hello,

@lachguerabdallah thank you so much for your suggestion. I tried your solution (choose ‘date’ property) and this is working. Now my problem solve.

Thank you for the fast response, it was really useful for determining what was the best suitable option for my project.

Good. another solution is to use clients tags as a connection between multiple windows.

1 Like

Ok. I will try this solution.

Hello @lachguerabdallah,

I’m trying to download the selected alarm in pdf format. I’ve used the following script file downloaded but blank. not showing any data please any suggestion.

data = system.gui.getWindow(“Main_Windows/Alarms”).rootContainer.getComponent(‘AlarmJournal’).selectedAlarms
filename = system.file.saveFile(“SelectedAlarm.PDF”)
if filename is not None:
system.file.writeFile(filename, data)

Thanks,
Priyanka

Did you try the report module?

Yes. work was done successfully but I trying to using a button in vision.

you can put the ‘report viewer’ component in a window that you open with the button. in the report viewer you can read the report and save it

1 Like