Skip to main content
Hi, im having some problems with the BulkAttributeRenamer, i've read quite a few other answers and online articles bit can't seem to fix my problem;

 

 

I have a reader '2005Unique' and a writer '2005Gridded'. There is also a reader called 25kGrid, all .shp.

 

 

There are a few attributes coming from 2005Unique that I want '05' appending to the end of (for reasons of inter-year comparison further down the line). Eg Land to Land05 and Area to Area05 etc etc. Originally in my tests I simply renamed the attributes in the writer, stuck 05 on the end of them, as I was only testing data with this one year. 

 

 

Now i'm coming to run the data across 5 year files, 05 to 09. I am looking to set up the dynamic schema to read each year file one by one and write them one by one but obviously i cant just leave the writer attributes with 05 as a suffix, it has to change to 06 when the 2006 stuff runs through. 

 

 

So i set up a SubstringExtractor pointing at the fme_basename (also tried the parameter $Sourcedataset_Shape) and told it to extract characters 2 and 3, i.e '05', and set it to '_substring'. Then, in my BulkAttributeRenamer, i select the required attributes, add a string suffix and then set string to '_substring'. 

 

 

2 issues:

 

1 - why arent the attributes taking on the suffix? they remain the same. If i manually type 05 then they will change but thie way described above makes no impact. they dont change.

 

2 - In my writer, how will the writer attributes be dynamic? How will they change as the file name, and thus the substring suffix, changes? Is this sorted by the dynamic schema?

 

 

 

thanks a lot
Hi,

 

 

1. Attribute names which are shown on the Canvas window are determined at creation time of the workspace. If you specified "05", new attribute name has been determined at that time. But possible values of "_substring" are unknown, so the new attribute names cannot be shown on the Canvas.

 

However, the BulkAttributeRenamer works expectedly. New attribute names will be determined at run-time and you can see them (e.g."Land05", "Area05") on the Feature Information window of Data Inspector.

 

If you need to expose them on the Canvas, consider using the AttributeExposer.

 

 

2. If the feature schema would be changed in the workflow, you cannot use the reader's schema as resource of dynamic schema configuration.

 

In such a case, a possible way to apply dynamic schema is to create a writer's schema definition table and read it as a workspace resource. See the Example 3 of this documentation.

 

http://fmepedia.safe.com/articles/Samples_and_Demos/Dynamic-Schema-Examples-FME2011#heading_toc_j_10

 

 

Takashi
Thanks Takashi,

 

 

re 1) thats the thing, the new attribute names do not appear in data inspector, even in the info window.

 

 

I am doing a SaptialRelator to a polygon grid and, in fact, any attributes that are nominated in the BulkRenamer have all of their data deleted where there is a spatial join, but the attribute name remains at the top (unchanged).

 

 

re 2 & 3) thanks i'll have an explore. The structure of the data doesnt change so i think i can work with it. If I can get point 1 to work!
I believe the new attribute names must appear on Data Inspector (Feature Information window) if they have been created correctly with the BulkAttributeRenamer.

 

I would recommend you to add an Inspecter connected to the BulkAttributeRenamer output in order to check whether new attribute names have been created.
Sorry that was my point, I have data inspected every stage and they do not appear in Inspector, which seems very odd to me. If i point to another attribute in BulkRenamer (a standard one that already exists in the workbench) then that will be suffixed no problem, as will standard text manually typed in. However, it is when using SubStringExtractor to create attribute '_substring' that BulkRenamer is simply not picking anything up at all and actually begins to delete data in the attributes that are being renamed. Odd.
This image is a simplified workspace and the result. Is there any difference from yours?

 

 


No difference, aside from I obviously dont need the AttributeCreator. Doesnt appear in inspector or AttributeExposer. 

 

 

Right, i'll continue to work at this. I know the SubStringExtractor works as i've just used it on another workbench. I'm thinking of a work around involving Concatenators and AttributeRenamer which should solve it. Perhaps there is just something wrong with my data structure etc.

Reply