I want to compose a filtering script for a transform on a query tag binding.
My script so far, is working.
valueHeaders = ['Line','Year Month', 'Stops','Attempted','Palletized']
data=[]
for row in range(value.getRowCount()):
Line= value.getValueAt(row,'Line')
yearMonth= value.getValueAt(row,'Year_Month')
stops= value.getValueAt(row,'Stops')
Attempted =value.getValueAt(row,'Attempted')
Palletized=value.getValueAt(row,'Palletized')
data.append([Line,yearMonth,stops, Attempted, Palletized])
data = system.dataset.toDataSet(valueHeaders, data)
filterLine=self.parent.parent.getChild("Dropdownrow").getChild("Dropdown").props.value
filterCode =self.parent.parent.getChild("Dropdownrow").getChild("NumericEntryField").props.value
return data
But I have two dropdowns to filter with.
In a query, I usually write:
where (t_stamp>DATEADD(month, -6,EOMONTH( GETDATE()))) and (Code<1002) and (:code=0 or :code=code) and ( :machine=-1 or
Line=Case when :machine=1 then 'Brm1'
When :machine=2 then 'Brm2'
When :machine=3 then 'Brm3'
When :machine=4 then 'Brm4'
When :machine=5 then 'Brm5'
When :machine=6 then 'Brm6'
When :machine=11 then 'Cym1'
When :machine=12 then 'Cym2'
When :machine=13 then 'Dyg3'
When :machine=14 then 'Dyg7'
When :machine=15 then 'Eeg5'
When :machine=16 then 'Eeg6'
else null end )
I think I figured it out as I was writing it.
I think I say like if Line = filterLline and code=filter code then all this stuff and append.