Solved

How to add Group By to a transformer?

  • 15 September 2018
  • 7 replies
  • 58 views

Userlevel 4
Badge +13

Sometimes I really need to use a Group By in a transformer, but the parameter is not available. Is there anyway I can hack it?

icon

Best answer by xiaomengatsafe 15 September 2018, 01:22

View original

7 replies

Badge +2

Yes, you might be in luck. There is a way to expose the Group By parameter on a transformer. However, please note, there might be a reason certain transformers don’t support Group By, out of the box (e.g. transformers that process each feature individually won't work with a Group By parameter). So please verify the outcome of the translation carefully, and make sure it is producing the expected result, when you use this hack. Here it goes:

  1. Right click on the transformer in question and Create Custom Transformer from it.

     

    (more detail on Custom Transformer )
  2. In the Custom transformer tab, find “Parallel Process By” under Transformer Parameters>Advanced. Right Click and Create User Parameter…

     

    You may consider changing the parameter Prompt to “Group By”

     

    (This part of the advanced training can be helpful here. Although, no need to enable Parallel Processing, if you only want the Group By feature.)
  3. Now the Group by parameter is available to be specified in the Main tab, on the transformer in question.

*If you are using a FME Version earlier then 2019.0, there is a caveat about this hack:

To make Group by work this way, Feature Caching needs to be turned off. (this issue has been fixed and available in 2019.0 beta)

Badge +22

Yes, you might be in luck. There is a way to expose the Group By parameter on a transformer. However, please note, there might be a reason certain transformers don’t support Group By, out of the box (e.g. transformers that process each feature individually won't work with a Group By parameter). So please verify the outcome of the translation carefully, and make sure it is producing the expected result, when you use this hack. Here it goes:

  1. Right click on the transformer in question and Create Custom Transformer from it.

     

    (more detail on Custom Transformer )
  2. In the Custom transformer tab, find “Parallel Process By” under Transformer Parameters>Advanced. Right Click and Create User Parameter…

     

    You may consider changing the parameter Prompt to “Group By”

     

    (This part of the advanced training can be helpful here. Although, no need to enable Parallel Processing, if you only want the Group By feature.)
  3. Now the Group by parameter is available to be specified in the Main tab, on the transformer in question.

*If you are using a FME Version earlier then 2019.0, there is a caveat about this hack:

To make Group by work this way, Feature Caching needs to be turned off. (this issue has been fixed and available in 2019.0 beta)

Another thing to note, if you have enabled the parallel processing group by, feature counts will no longer appear on connections in the custom transformer.

 

 

Badge +2
Another thing to note, if you have enabled the parallel processing group by, feature counts will no longer appear on connections in the custom transformer.

 

 

Hi @jdh, can you share a workspace that demonstrate this issue? I can't seem to reproduce it with the transformer I tried.

 

Badge +22
Hi @jdh, can you share a workspace that demonstrate this issue? I can't seem to reproduce it with the transformer I tried.

 

Here you go @XiaomengAtSafe. Note that there are no feature counts between the Input and Output ports. If you change the parallel processing level from Minimal to No Parallelism, you will see a feature count.

 

 

parallelprocessgroupby.fmw

Badge +2
Here you go @XiaomengAtSafe. Note that there are no feature counts between the Input and Output ports. If you change the parallel processing level from Minimal to No Parallelism, you will see a feature count.

 

 

parallelprocessgroupby.fmw

Ah, I see it now. Thanks @jdh! I'll report it to our developers and see if they can figure out why this is happening.

 

Badge +22
Ah, I see it now. Thanks @jdh! I'll report it to our developers and see if they can figure out why this is happening.

 

I assume it has something do to with how transport sender/receiver works when multiprocessing.

 

 

Badge +2
I assume it has something do to with how transport sender/receiver works when multiprocessing.

 

 

Yeah, just had another discussion on this topic. You are correct, with the current infrustruction, we are not able to get the count, when using parallel processing.

Reply