jsn

HELP!!! How to pass the current ArcMap Layer to a Model Builder Calculate Value tool

Discussion created by jsn on Jun 25, 2012
Latest reply on Jun 26, 2012 by jsn
Hi all

I am trying to pass to a Calculated Value tool in Model Builder 9.3 the current ArcMap layer to check if there is any record selected. I need to use the current ArcMap layer because editors are working in their own version of SDE, so Model builder must run in the current SDE Version.

To test the tool the only thing I am doing is passing the name of the layer from ArcMap and I am getting the following error message:


Executing (Calculate Value):

Executing (Calculate Value):
CalculateValue getSelectedFeatures(%FC%) "def  getSelectedFeatures(s):\n    import arcgisscripting;\n    gp = arcgisscripting.create();\n    # Set the workspace to in-memory.\n    gp.Workspace = "in_memory";\n    print s;\n    return false;\n" Boolean #
Start Time: Mon Jun 25 12:44:56 2012
ERROR 000539: Error running expression: getSelectedFeatures(WServicePoint) <type 'exceptions.NameError'>: name 'WServicePoint' is not defined
Failed to execute (Calculate Value).
End Time: Mon Jun 25 12:44:56 2012 (Elapsed Time: 0.00 seconds)



The layer WServicePoint exists!  I am using it for something else in the Model and it works.


This is the code

   
Expression: getSelectedFeatures(%FC%)


Code Block
def  getSelectedFeatures(s):
    import arcgisscripting;
    gp = arcgisscripting.create();
    # Set the workspace to in-memory.
    gp.Workspace = "in_memory";
    print s;
    return false;





Help!!!

Outcomes