Skip to main content
Solved

How to Load User Parameter Choices From a PythonCaller Loop Result

  • November 30, 2023
  • 2 replies
  • 110 views

bhk
Contributor
Forum|alt.badge.img+3
  • Contributor

I have a simple PythonCaller (for now) which basically is something like this

import fme
import fmeobjects
import arcpy
 
class FeatureProcessor(object):
    def __init__(self):
        """Base constructor for class members."""
        pass
 
    def input(self, feature):
        
        geom = ["Point""Multipoint""Polyline""Polygon","Envelope"]
        for geo in geom:
          print(geo) 
 
        self.pyoutput(feature)
 
    def close(self):
        pass
 
    def process_group(self):
        pass

Can you please let me know 

1- Pass the Result of Python  from PythonCaller to User Parameter Choices 

 

image 

2- How to Pass selected values from here to second PythonCaller2 to only simply print out the selected choice?

 

I tried to make it as simple as possible and sorry for confusion!

 

Best answer by david_r

As mentioned by @Takashi Iijima​ , all parameters are read-only once the workspace has started.

To retrieve a user parameter in Python, use the fme.macroValues dictionary, e.g.

import fme
param_value = fme.macroValues.get('USER_PARAM_NAME''My default value')

See also this article: https://community.safe.com/s/article/python-and-fme-basics#Parameters

View original
Did this help you find an answer to your question?

2 replies

takashi
Evangelist
  • November 30, 2023

Hi @bhk​ ,

Unfortunately there is no way to configure a user parameter at run time dynamically, you will have to configure the parameter when you create the workspace. 


david_r
Celebrity
  • Best Answer
  • November 30, 2023

As mentioned by @Takashi Iijima​ , all parameters are read-only once the workspace has started.

To retrieve a user parameter in Python, use the fme.macroValues dictionary, e.g.

import fme
param_value = fme.macroValues.get('USER_PARAM_NAME''My default value')

See also this article: https://community.safe.com/s/article/python-and-fme-basics#Parameters


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings