Skip to main content

Hi,

I have a workspace that reads a shapefile. My workspace has around 450 transformers. I defined published parameters for the user to insert the row quantities of the shapefile.

How can I automatically get the number of features from my file and save it in a published parameter to use in the middle of my workspace, simulating the values inserted by the user?

 

I think this is not possible. Parameters can only be set before the run, not when running. Only a workspace split in two parts with a WorkspaceRunner can do that.

You could try and use VariableSetter and Retriever but those can react fishy in combination with featurecaching.

Depending on the workspace, I would use a StatisticsCalculator at the start and keep the attribute attached until needed.

Or a FeatureWriter and a FeatureReader which writes the number to a temp file, but this probably has a similar effect as the VariableSetter and VariableRetriever.


As @nielsgerrits said, StatisticsCalculator is a great solution. If it is too difficult to keep it exposed on all features, you could make use of a FeatureMerger mid process and merge a single feature with the total count into the workflow at the required point.


Reply