def returnParametersAsList(self, groupid, ignore_aggregates=False): parameterList = "" counter = 1 # Traverse through each parameter in object's list for param in self.parameters: new_param = utils.xstr(self.name + "." + param) is_changed = False if self.ignore_aggregates == False: # Apply any functions to the parameter, ie SUM, AVG, etc. new_param, alias, is_changed = export_utils.apply_selection_function( utils.xstr(self.name + "." + param), groupid ) # For subqueries it is nessesary to create an alias for the aggregation function if is_changed: new_param += " as " + param # Concatenate to parameterList and add a comma if not the end of the list parameterList += new_param if counter != len(self.parameters): parameterList += "," counter += 1 if "uuid" not in self.parameters: if parameterList is not "": parameterList += "," + self.name + ".uuid" else: parameterList += self.name + ".uuid" return parameterList
def returnGroupByAsList(self, groupid, ignore_aggregates=False): groupbyList = "" # Traverse through each parameter in object's list for param in self.parameters: is_changed = True if self.ignore_aggregates == False: # Apply any functions to the parameter, ie SUM, AVG, etc. is_changed = export_utils.apply_selection_function(utils.xstr(self.name + "." + param), groupid)[2] # If no change was made by function, then it belongs in the groupby list if not is_changed and param not in self.groupByList: self.groupByList.append(param) # Groupby Required Parameters - make sure they are there if "uuid" not in self.groupByList: self.groupByList.append("uuid") # Traverse through the new groupby list, this is the original parameter list, without parameters with math functions counter = 1 for groupby_param in self.groupByList: groupbyList += self.name + "." + groupby_param if counter != len(self.groupByList): groupbyList += "," counter += 1 return groupbyList