Hi,
@XanderBakker , @DavidPike , @SMehta
How can I use an Inline Variable as a field name in Select Layer by Attribute in code block.
I want to get the field name from multivalued variable table rather than from Attribute Table. In Select Layer by Attribute Year and %VariableFieldName% value in "where clause" comes from string Var2 as shown in the Image.
def x(Var2):
for i in Var2.split(";"):
a,b=shlex.split(i)
with arcpy.EnvManager(scratchWorkspace=r"D:\GBT_R_Drive\GBT_GIS\ICEMIgdb\ICEM\BldgEmission.gdb", workspace=r"D:\GBT_R_Drive\GBT_GIS\ICEMIgdb\ICEM\BldgEmission.gdb"):
lyr = arcpy.management.SelectLayerByAttribute(r"D:\GBT_R_Drive\GBT_GIS\ICEMIgdb\ICEM\BldgEmission.gdb\IDEAL_SHAPE_TimeSeries_Feb14_V1", "NEW_SELECTION", f"Year = {a} And %VariableFieldName% >0, None)
Data type :
Long

I will really appreciate your help
Thanks