Skip to main content
Solved

Splitting data from excel cells


Hi All,

I could use some assistance on the problem I am facing.

The data I have looks something like this.

R

A, B, C

?, ?, ?

I want it to look like this.

R

A

?

R

B

?

R

C

?

How would I go about doing that?

 

Regards,

Best answer by ebygomm

The attribute splitter for me splits right to left with arabic characters

So the following process should work

Use two attribute splitters, to split both columns, make sure to give the lists different names. Explode one of the lists, and then use the attribute element index in an attribute creator to access the correct list element for the other column

split2columns.fmwt

View original
Did this help you find an answer to your question?

11 replies

Forum|alt.badge.img+2

Hi @gisuser,

I would use the steps outlined by Takashi on the previous post you commented on here: https://knowledge.safe.com/questions/42016/hi-all-2.html

 

 

But since you need to split two attributes I would perform these steps twice, in parallel and then use a FeatureJoiner and Join on the _element_index attribute produced from the List Exploders to bring these together.

You'll then need to use an AttributeManager to clean up the attributes.

attributesplit.fmw


  • Author
  • October 24, 2019
hollyatsafe wrote:

Hi @gisuser,

I would use the steps outlined by Takashi on the previous post you commented on here: https://knowledge.safe.com/questions/42016/hi-all-2.html

 

 

But since you need to split two attributes I would perform these steps twice, in parallel and then use a FeatureJoiner and Join on the _element_index attribute produced from the List Exploders to bring these together.

You'll then need to use an AttributeManager to clean up the attributes.

attributesplit.fmw

Hi @hollyatsafe

thank you, but the trick in this subject that we have in the second column data in a different language (Arabic),

then based on your test A it merged with "1", but it should be merged with " 3".

 

English characters "L_R", but Arabic is "R_L"

and that what Attributesplitter do split from L to R which make the join based on the index id difficult


Forum|alt.badge.img+2
gisuser wrote:

Hi @hollyatsafe

thank you, but the trick in this subject that we have in the second column data in a different language (Arabic),

then based on your test A it merged with "1", but it should be merged with " 3".

 

English characters "L_R", but Arabic is "R_L"

and that what Attributesplitter do split from L to R which make the join based on the index id difficult

Hi @gisuser,

Ah my mistake, ok well after the ListExploder for the Arabic characters we can add a Sorter to revert the order of _element_index using Numeric / Descending, then add a Counter to replace the _element_index with the correct count.

See the revised workspace to demonstrate this: attributesplitrevised.fmw


  • Author
  • October 25, 2019
hollyatsafe wrote:

Hi @gisuser,

Ah my mistake, ok well after the ListExploder for the Arabic characters we can add a Sorter to revert the order of _element_index using Numeric / Descending, then add a Counter to replace the _element_index with the correct count.

See the revised workspace to demonstrate this: attributesplitrevised.fmw

Thank u so much @hollyatsafe, but what if the case was more complicated like the below table, we have thousands of rows.

????????

UAE

?????, ???, ????

Lebanon, Egypt, Without

????????

UAE

????

Without

????????, ?????, ????

UAE, Lebanon, Without

????????, ??????, ?????

UAE, Jordan, Lebanon

????????

UAE

 


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • Best Answer
  • October 25, 2019

The attribute splitter for me splits right to left with arabic characters

So the following process should work

Use two attribute splitters, to split both columns, make sure to give the lists different names. Explode one of the lists, and then use the attribute element index in an attribute creator to access the correct list element for the other column

split2columns.fmwt


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • October 25, 2019
gisuser wrote:

Thank u so much @hollyatsafe, but what if the case was more complicated like the below table, we have thousands of rows.

????????

UAE

?????, ???, ????

Lebanon, Egypt, Without

????????

UAE

????

Without

????????, ?????, ????

UAE, Lebanon, Without

????????, ??????, ?????

UAE, Jordan, Lebanon

????????

UAE

 

The attribute splitter for me splits right to left with arabic characters

So the following process should work

Use two attribute splitters, to split both columns, make sure to give the lists different names. Explode one of the lists, and then use the attribute element index to in an attribute creator to access the correct list element for the other column


  • Author
  • October 25, 2019
ebygomm wrote:

The attribute splitter for me splits right to left with arabic characters

So the following process should work

Use two attribute splitters, to split both columns, make sure to give the lists different names. Explode one of the lists, and then use the attribute element index in an attribute creator to access the correct list element for the other column

split2columns.fmwt

Thank you @ebygomm, that was so workable and helpful, but what if the case was the Arabic letter for the English was written from lift to right like the below :

 

R1

A, B, C

?, ?, ?

R2

A, B, C

?, ?, ?

 


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • October 25, 2019
gisuser wrote:

Thank you @ebygomm, that was so workable and helpful, but what if the case was the Arabic letter for the English was written from lift to right like the below :

 

R1

A, B, C

?, ?, ?

R2

A, B, C

?, ?, ?

 

There is a custom transformer 'ListReverser' that you could use to reverse the list order, prior to using the attribute creator


  • Author
  • October 25, 2019
ebygomm wrote:

There is a custom transformer 'ListReverser' that you could use to reverse the list order, prior to using the attribute creator

it is ll be workable if we have just one row of the data but when you have multi rows it won't be workable


ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • October 25, 2019
gisuser wrote:

it is ll be workable if we have just one row of the data but when you have multi rows it won't be workable

I'm not sure why you think the number of rows of data matter. Reversing the order of the list happens for each feature individually, exactly as required

If there is the following situation where Column1 should be left to right and Column 2 should be right to left

Column1Column2A,B,C3,2,1B,C,D4,3,2D,E,F5,4,3

 

You can say that column2 needs to be reversed and get this output


Forum|alt.badge.img+2
gisuser wrote:

Thank u so much @hollyatsafe, but what if the case was more complicated like the below table, we have thousands of rows.

????????

UAE

?????, ???, ????

Lebanon, Egypt, Without

????????

UAE

????

Without

????????, ?????, ????

UAE, Lebanon, Without

????????, ??????, ?????

UAE, Jordan, Lebanon

????????

UAE

 

Hi @gisuser,

Having reviewed the suggestion by ebygomm I think that is the simpler solution, however I have also updated my workspace if you'd prefer to go that route. Given a more complex dataset we cannot use the element_index to join as these values will be duplicated for each list. Instead we can create a new attribute to join/aggregate on that we can ensure will be unique for each feature.

attributesplitrevisedv2.fmw


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings