Skip to main content

I have a workspace and I want to turn it into a CutsomTransformer - as part of that process I want to rename a bunch of attributes to include a prefix (e.g., from a JSONFlattener) - This is mostly for readability.

For example I have several attributes which are coming from a JSONFlattner - in the original I never added a prefix, however, now I want to prefix with something like “layer.” - so something like “extent” would become “layer.extent”. 

The issues is that when I add that prefix in then all the downstream transformers which use the properties break. Obviously going through and changing them would have taken me less time than writing this question but it’s certainly not the first time I’ve had this kind of issue.

In similar situations in the past I’ve been lazy and have simply renamed the new attribute to the old value. 

There are quite a few situations where I think having this kind of functionality would do a lot to improve workspaces readability with little effort on the authors part. For example often when building a workspace it’s pretty common to just reuse the out-out-the box default attribute names (e.g., _area). Then once you’ve finished the bulk of the work maybe you see that it’s unclear what “_area” actually is so you want to rename it - only to find our you’ve used it in several places. Perhaps you decide you can’t be bothered to rename it.

Has anyone run into this issue as well? How did you solve it (if at all)?

P.S - I added an idea: 


 

There is this idea: 

 


@virtualcitymatt thats an interesting question, I faced the same challenge and used different kind of solutions like you described already but found no Best Practice yet. 

I also found this idea:
Search for all places an attribute is modified or published parameter is used | Community


There is this idea: 

 

Thanks, how did I not find this?! 


@virtualcitymatt I guess your new idea can be removed then? 😀
I upvoted the idea shared by ​@geomancer 

Add a way to propagate attribute renaming to downstream references | Community


Edit: Added to the idea as well

I like that idea, similar to how a parameter ID is updated on the canvas across all instances of it.

I can however, see it as being problematic in a couple of ways:

  1. I don’t always want it to change downstream references to it. I may want to change all, none or some. Regardless, it would need to have a user confirmation
  2. There will be a lot of trust in it working correctly, instances of the attribute used in lists, python, sql, json, xml, xquery, using @value(<attr>)
  3. What happens in instances where you have two branches merging into one, with the same attribute on both branches. If you rename on only one of the branches, what happens downstream where one branch isn’t renamed?

 

None of those are impossible to solve, but worth considering!


Reply