Question

Using Python Scripted Parameters in Feature Reader - Attributes to Expose

  • 9 November 2022
  • 5 replies
  • 16 views

Badge +6

I am able to use a python scripted parameter to get the list of field names/attributes and they do populate with the scripted parameter as expected, however, when the scripted parameter is plugged into a FeatureReader to expose attributes, it fails.

 

Example:

Scripted Parameter Name: $(scriptedParameter)

Returns the value of:

OBJECTID COMPONENT SITE_NAME JOINT_BASE STATE_TERR COUNTRY OPER_STAT IS_FIRRMA SE_ANNO_CAD_DATA SHAPE_LENG Shape_Length Shape_Area

 

However, when using the same scripted parameter in the FeatureReader Transformer - Generic Port - Attributes to Expose, the result is missing values in an attribute called $(scriptedParamter) (the same name as the parameter).

 

If I hardcode the value of the parameter to my list of attributes, things work fine.

 

Is this a bug with the FeatureReader transformer, or do scripted parameters not work in the FeatureReader Transformer - Generic Port - Attributes to Expose?


5 replies

Userlevel 3
Badge +26

What are you wanting to do with the exposed attributes? If you are only taking them out to a dynamic writer, you don't necessarily need to expose them. They will be used regardless of whether they are exposed in the workspace. I'm assuming the attributes in the scripted parameter are dynamic, meaning you won't reliably be able to build processing to use them.

Badge +6

What are you wanting to do with the exposed attributes? If you are only taking them out to a dynamic writer, you don't necessarily need to expose them. They will be used regardless of whether they are exposed in the workspace. I'm assuming the attributes in the scripted parameter are dynamic, meaning you won't reliably be able to build processing to use them.

I am not dynamically writing them. The tool is a data upload and validation tool which does the following steps:

 

  1. Upload gdb (schema can vary)
  2. Read data mapping config, map fields to destination schema
  3. Validate schema & Create messages depending on schema findings
  4. Generate HTML Report (Schema Validation Report)

 

Everything is working except for being able to dynamically read field names (Attrbutes to Expose), which is why I hoped to use a scripted parameter.

 

Userlevel 3
Badge +26

I am not dynamically writing them. The tool is a data upload and validation tool which does the following steps:

 

  1. Upload gdb (schema can vary)
  2. Read data mapping config, map fields to destination schema
  3. Validate schema & Create messages depending on schema findings
  4. Generate HTML Report (Schema Validation Report)

 

Everything is working except for being able to dynamically read field names (Attrbutes to Expose), which is why I hoped to use a scripted parameter.

 

If the input schema is variable, how will you be defining the data mapping configuration in the 2nd step?

 

I've tested exposing the value from a scripted parameter in build 22765 and I'm seeing the same results you are. But by using a text parameter passing the same string (entered manually), it exposes the attributes fine. So, I agree that it seems to be some kind of bug. I'm just trying to understand how it could actually be used in this case outside of a dynamic writer.

Badge +6

I am not dynamically writing them. The tool is a data upload and validation tool which does the following steps:

 

  1. Upload gdb (schema can vary)
  2. Read data mapping config, map fields to destination schema
  3. Validate schema & Create messages depending on schema findings
  4. Generate HTML Report (Schema Validation Report)

 

Everything is working except for being able to dynamically read field names (Attrbutes to Expose), which is why I hoped to use a scripted parameter.

 

The input schema will be mapped (from the source attribute to destination attribute) with a preset config file.

 

The use case is that many data partners are submitting data to one agency (destination schema). The data partner will fill out a config file and submit their data. The FME workspace will reference those to map the schema. I know I can accomplish this with a series of 2 workbenches (WorkspaceRunner on 1, that sends parameters to 2nd), but this won't work for my environment as we do not have FME Server in the picture and will be using Data Interoperability Server (ArcGIS GP Web Tools created from ArcGIS DI Extension).

Userlevel 1
Badge +22

Hi @Sasha Lockamy​ 

Unfortunately you can't programmatically expose variables. Exposing works in define -time, not run-time.

But the input variables are still present, even though they're not exposed.

If it's about controlling the output, you may want look into manipulating schema features, and use dynamic schema output .

Cheers

Reply