Esempio n. 1
0
	def formulastring(self, grid_refs=False, inputs={}):
		if grid_refs:
			if self.name in self.parent_module.functions:
				function = self.parent_module.functions[self.name]
				loc = spreadsheet.location_to_excel_reference(function.output_location(inputs))
				return loc
			elif self.name in self.parent_module.dimensions:
				loc = spreadsheet.location_to_excel_reference(self.parent_function.dimension_location(inputs, self.name))
				return loc
			elif self.name in self.parent_module.consts:
				const = self.parent_module.consts[self.name]
				loc = spreadsheet.location_to_excel_reference(const.output_location)
				return loc
			else:
				Exception("Invalid Word in expression")
		else:
			return self.name
Esempio n. 2
0
	def conditionstring(self, inputs):
		loc = spreadsheet.location_to_excel_reference(self.parent_function.dimension_location(inputs=inputs, dimension_name=self.word))
		if self.op == "==": return loc + "=" + str(self.literal)
		elif self.op == ">": return loc + ">" + str(self.literal)
		elif self.op == "<": return loc + "<" + str(self.literal)
		elif self.op == ">=": return loc + ">=" + str(self.literal)
		elif self.op == "<=": return loc + "<=" + str(self.literal)
		elif self.op == "!=": return loc + "<>" + str(self.literal)
Esempio n. 3
0
	def conditionstring(self, inputs):
		# Determine if word is a dimension or function (or const?! TODO)
		if self.word in self.parent_module.dimensions:
			loc = self.parent_function.dimension_location(inputs=inputs, dimension_name=self.word)
		elif self.word in self.parent_module.functions:
			loc = self.parent_module.functions[self.word].output_location(inputs)
		loc = spreadsheet.location_to_excel_reference(loc)
		if self.op == "==": return loc + "=" + self.expr_check.formulastring(grid_refs=True,inputs=inputs)
		elif self.op == ">": return loc + ">" + self.expr_check.formulastring(grid_refs=True,inputs=inputs)
		elif self.op == "<": return loc + "<" + self.expr_check.formulastring(grid_refs=True,inputs=inputs)
		elif self.op == ">=": return loc + ">=" + self.expr_check.formulastring(grid_refs=True,inputs=inputs)
		elif self.op == "<=": return loc + "<=" + self.expr_check.formulastring(grid_refs=True,inputs=inputs)
		elif self.op == "!=": return loc + "<>" + self.expr_check.formulastring(grid_refs=True,inputs=inputs)