Jun-07-2019, 06:36 PM
Hi, I have this Checkboxes, 
any combination can be selected, and each checkbox selected results in a different query. Instead of using if else, can someone suggest an alternative method, because the combination is gonna be endless

any combination can be selected, and each checkbox selected results in a different query. Instead of using if else, can someone suggest an alternative method, because the combination is gonna be endless
[python] from tkinter import * import arcpy from tkinter import ttk def select_landuse(): arcpy.env.workspace = C:/Users/umroot/Documents/ArcGIS/Projects/RecentINSE6421project/affectationpu" in_features = "AffectationPU.shp" out_feature_class = "C:/Users/umroot/Documents/ArcGIS/Projects/RecentINSE6421project/pythonOutput/affectationpu" if (landuse1.get() and landuse3.get() and landuse4.get() and landuse5.get()and landuse6.get()and landuse7.get() and landuse10.get())==TRUE : where_clause= "\"categorie\" IN (\'activites diversifiees\',\'conservation\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\', \'residentiel\')" elif(landuse1.get() and landuse3.get()and landuse4.get() and landuse5.get() and landuse6.get() and landuse7.get() and landuse8.get() and landuse9.get() and landuse10.get())==TRUE: where_clause="\"categorie\" IN (\'activites diversifiees\',\'conservation\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\', \'residentiel\')" elif (landuse1.get()and landuse2.get() and landuse4.get()and landuse4.get()and landuse6.get()and landuse7.get()and landuse9.get() and landuse10.get())==TRUE: where_clause= "\"categorie\" IN (\'activites diversifiees\',\'conservation\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\',\'religieux\',\'residentiel\')" elif (landuse1.get()and landuse2.get() and landuse3.get()and landuse4.get()and landuse4.get()and landuse6.get()and landuse7.get()and landuse9.get() and landuse10.get())==TRUE: where_clause= "\"categorie\" IN (\'activites diversifiees\',\'conservation\',\'agricole\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\', \'religieux\',\'residentiel\')" elif (landuse1.get()and landuse2.get() and landuse3.get()and landuse4.get()and landuse4.get()and landuse6.get()and landuse7.get()and landuse8.get() and landuse10.get())==TRUE: where_clause= "\"categorie\" IN (\'activites diversifiees\',\'conservation\',\'agricole\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\', \'parc\',\'residentiel\')"[/python]