Skip to main content

This is my first question so do tell me if I'm missing anything in the description of the question.

 

I currently have a workspace where part of the functionality includes the merging of 5 columns (two of which are always empty). The data that isn't merged should be preserved for each of the rows that are created or already in existence.

 

Below is an Excel example of what I mean:

This is the current situation

 

This is what it needs to become

 

As you can see the data from the first three columns are merged into one but the other three columns (ID, Type and Type 2) remain unchanged and are copied to the new rows.

 

This causes for example the row with ID 500 to split into three rows, all of which contain all attribute information from the original that wasn't merged.

 

I looked for similar questions but the solutions didn't work for me such as the Attribute Exploder, which does not currently have an option to select what you want to explode.

 

The solution given in this question came close but did not give me the correct amount of rows: https://knowledge.safe.com/questions/68241/merge-values-of-two-columns.html

The expected amount of rows is 409 (from the original 213) but after running it I only got 255 rows from this method.

 

The Attribute Pivoter was something I also tried but had no success in. Perhaps this will solve it but I just can't get it to work in the manner that I want it to.

 

Any ideas are welcome.

Create an attribute containing the 3 merged values as comma separated values (you'll need a conditional formula to handle that they're not always populated), an attribute splitter to split on the comma then a list exploder.

You could also use the renaming approach you mentioned, but after renaming you will need to test that the attribute has a value since you have blanks in your merged columns e.g.


you can list_concatenate the 3 columns by row_id.

Then explode list.

FeatureMerge with the other columns on key= row_id. Process duplicates and explode.

Sort.


I would use a stringconcatenator to concatenate the three strings that need to be merged. Then use a AttributeSplitter with Drop Empty Parts = Yes to create a list called Merged. The last step is to Explode this list with the ListExploder.


Create an attribute containing the 3 merged values as comma separated values (you'll need a conditional formula to handle that they're not always populated), an attribute splitter to split on the comma then a list exploder.

You could also use the renaming approach you mentioned, but after renaming you will need to test that the attribute has a value since you have blanks in your merged columns e.g.

So far this has come the closest to solving it but it's still off by a few features. It probably needs some more tweaking on my end. Thanks.


So far this has come the closest to solving it but it's still off by a few features. It probably needs some more tweaking on my end. Thanks.

If your input is originally coming from excel the first thing I'd check is whether some of the merge columns have spaces in rather than being blank


If your input is originally coming from excel the first thing I'd check is whether some of the merge columns have spaces in rather than being blank

It's coming from a GDB file and I also don't think spaces are being used because all the unused rows are showing up as 'Null' rather than being blank.

 

Off topic, how do I go about reporting small things such as typos? Because I know that for ideas or feature requests there is a section but something as small as a typo probably wouldn't warrent its own topic.


It's coming from a GDB file and I also don't think spaces are being used because all the unused rows are showing up as 'Null' rather than being blank.

 

Off topic, how do I go about reporting small things such as typos? Because I know that for ideas or feature requests there is a section but something as small as a typo probably wouldn't warrent its own topic.

Hi @bkgg. I'm not the expert, so can't be much help with this particular workflow.

 

Regarding your question on how to report small issues. If it is a small typo you spotted on the website, or in the documentation, I'd suggest Live Chat would be the easiest way. If you don't have access to Live Chat due to time differences, feel free to send in a quick support case, through this form. Thank you so much for helping us make our product better, by reporting problems.

Hi @bkgg. I'm not the expert, so can't be much help with this particular workflow.

 

Regarding your question on how to report small issues. If it is a small typo you spotted on the website, or in the documentation, I'd suggest Live Chat would be the easiest way. If you don't have access to Live Chat due to time differences, feel free to send in a quick support case, through this form. Thank you so much for helping us make our product better, by reporting problems.

Thanks. I just finished filling in the form.


Reply