Hello. I have created a historical chart on my project. This chart will be used by leaders to see where an operator badges in. This chart has dropdowns tied to it that filter through Line, Workcenter, Name, Start Date and EndDate. They are all separate dropdowns and all have different scripts. They are live dropdown filters, so when you choose a selection the table changes immediately through several if statements.
For example:
#Line is not empty, Area/Name/StartDate/EndDate is empty, do this:
if (Line != "") and (Area == "" and Name == "" and StartDate == "" and EndDate == ""):
system.db.runNamedQuery("Historical/Line/1", {"Line" :Line})
returnedData = system.db.runNamedQuery("Historical/Line/1", {"Line" :Line})
self.parent.parent.getChild("Table").props.data = returnedData
The above named query “Historical/Line/1” filters so that every item in the database with a matching line will display in the table and so on for every combination available for each and every dropdown filter. My problem is that the dropdown filter does not filter until I hit the clear button I have to clear the filters. If I try to filter before hitting the clear button, the table simply says “Empty Data Source”. I’m not sure what is causing this problem. My clear buttons’ code is as follows:
self.getSibling("LineDropdown").props.value = ""
self.getSibling("WorkCenterDropdown").props.value = ""
self.getSibling("StartDateDropdown").props.value = ""
self.getSibling("EndDateDropdown").props.value = ""
self.getSibling("NameDropdown").props.value = ""
system.db.runNamedQuery("ClearFilter", {"Line" :Line, "Area" :Area, "Name" :Name, "StartDate" :StartDate, "EndDate" :EndDate})
returnedData = system.db.runNamedQuery("ClearFilter", {"Line" :Line, "Area" :Area, "Name" :Name, "StartDate" :StartDate, "EndDate" :EndDate})
self.parent.parent.getChild("Table").props.data = returnedData
The “ClearFilter” named query only returns * from the database that the table is binded to. Any tips or knowledge is appreciated. Thanks in advance.