Skip to main content
Solved

Feature Counts

  • October 6, 2024
  • 2 replies
  • 52 views

mr_fme
Enthusiast
Forum|alt.badge.img+9

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?

 

Best answer by nielsgerrits

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • October 6, 2024

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.


hkingsbury
Celebrity
Forum|alt.badge.img+65
  • Celebrity
  • October 7, 2024

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.