Skip to main content
Solved

Dynamically add suffix to attributes with BulkAttributeRenamer


aaron
Contributor
Forum|alt.badge.img+10
  • Contributor

I’m trying to dynamically add a suffix to all attributes in two Excel files. The suffix will come from the last 10 characters of each Excel file (fme_basename), which is the date the file was produced. I have not been able get this to work using the BulkAttributeRenamer. When choosing the Action “Add String Suffix”, only constants appear to work. I’ve tried using the Text Editor to dynamically create the suffix in the String dialog. I’ve also tried creating the suffix beforehand with an AttribuiteCreator and choosing it for String. Neither work. I’m using FME Form 2023.2.0.0 (Build 23764). Any insight or advice?

Best answer by jkr_wrk

This seems to work:

Be aware that the new attributes are Unexposed.

If you know your filenames (fme_basename values) on forehand you could use an AttributeExposer to expose the new attributes.

But FME can't do anything with unexposed attributes because it is not able to predict what filenames you will feed it. But you can dynamicly write the unexposed attributes to a new file.

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

4 replies

jkr_wrk
Influencer
Forum|alt.badge.img+28
  • Best Answer
  • May 30, 2024

This seems to work:

Be aware that the new attributes are Unexposed.

If you know your filenames (fme_basename values) on forehand you could use an AttributeExposer to expose the new attributes.

But FME can't do anything with unexposed attributes because it is not able to predict what filenames you will feed it. But you can dynamicly write the unexposed attributes to a new file.


aaron
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • May 30, 2024

I think I understand what you mean @jkr_wrk. If I use fme_basename as the suffix, the new attributes come over but are unexposed because fme_basename is not known in advance. But typing a constant in the String dialog box automatically exposes the attributes because the text is known in advance. Is that correct? Unfortunately, I don’t know what the Excel file names will be in advance. The user will select them to compare data from two time periods.


jkr_wrk
Influencer
Forum|alt.badge.img+28
  • May 31, 2024

So the question becomes… Why would you want to suffix the basename to the attribute. Because it looks like there are better solutions than doing that.

For comparing 2 datasets with two dates, using a changedetector, a matcher or a featuremerger could solve your problem.


aaron
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • June 3, 2024

Adding the basename suffix to attributes is just a way for people viewing the output to see the time period between the data being compared. I’m using a FeatureMerger to calculate differences between the data in the two time periods.


Reply


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