AnsweredAssumed Answered

Global value can't be assigned inside the expression in python toolbox

Question asked by Aarthi02 on Jan 17, 2020
Latest reply on Jan 26, 2020 by lpinner

I am trying to call the global value 'total_rows' inside the expression. But I am getting an error.

and my code is


def execute(self, parameters, messages):
"""The source code of the tool."""
   inputdataset = parameters[0].valueAsText #getting the parameters

   count_rows = arcpy.GetCount_management(inputdataset)
   total_rows = int(count_rows.getOutput(0))

expression = '''

   def getCitation(p_dataset_id):
      global total_rows
      if(total_rows == 5):
   return ds.citation