Skip to main content

I'm making a custom transformer at the moment which I intend on putting onto the Hub at some stage soon. With my transformer there are two possible output streams. One adds certain attributes to the input, and the other makes a list instead of the attributes.

 

I would like this to go to the same output port but only expose the relevant attributes depending on which stream. I'm finding that if I have the transformer settings so that it makes a list attribute then the other attributes will still be listed, but as <missing>. I would like there not to be empty columns.

 

I can't seem to work out how to get into to only expose the attributes that exist and not just all possible ones from both streams. Changing the settings in the screenshot to the relevant selected attributes will look fine for one of the streams but not the other.

 

As a side question, I have a <Rejected> output port. I'm trying to make the documentation for the Hub but I can't seem to get the <> to display in the markdown.

 

Any tips? I can't seem to find if the conditional attribute output is possible in any help files or one the community.

HI @james_c_452​ ,

In order to get the <> to display you need to put a <backSlash\\> before closing the tag.

For the conditionally exposing attributes, I'm actually not sure what the best approach would be here... perhaps two output ports or does the transformer need to have a single output port? Alternatively, I wonder if the SchemaScanner could be used here because it can remove empty attributes from schema definitions (although this may require you to write and read the data back in). You could use a SchemaScanner in the custom transformer and dynamically write out an FFS file with that schema definition. Then use a FeatureReader to bring that file back in (attributes will be present on features but not exposed.

Python might also be an option as well.


HI @james_c_452​ ,

In order to get the <> to display you need to put a <backSlash\\> before closing the tag.

For the conditionally exposing attributes, I'm actually not sure what the best approach would be here... perhaps two output ports or does the transformer need to have a single output port? Alternatively, I wonder if the SchemaScanner could be used here because it can remove empty attributes from schema definitions (although this may require you to write and read the data back in). You could use a SchemaScanner in the custom transformer and dynamically write out an FFS file with that schema definition. Then use a FeatureReader to bring that file back in (attributes will be present on features but not exposed.

Python might also be an option as well.

Thanks for the answer Chris.

I would prefer the transformer to have one output port. Its a 3D nearest neighbour one I've had for a while but thought I should put up for others to use. I've made it so that it looks similar to the existing 2D one.

The problem comes when you wish to find more than one neighbour. In this case it stores the new attributes in a list, but on output it has the <missing> individual attributes. If I make it so that it doesn't output the attributes then they won't be there for the case of the single neighbour. Though perhaps a way around it is to just make everything go to a list.

Sounds like there isn't a simple solution then, I thought there might be because I am self taught. Potentially I could use the schema scanner, though that might have to go on a future release if I edit it

Unfortunately I don't know any python. Though I suspect that will still have the same issue for the output. The attributes aren't there but they are writen with the output port settings. So I imaging removing them again will still have the same problem.

If anyone else has an easy solution that would be great to hear


Reply