Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
marcel_olmo
Partner Ambassador
Partner Ambassador

Purgechar challenge

Hi guys, I have a row of a concatenated values like this : NNN-fieldNNfield. And I'd like to convert it to fieldNNfield. The problem is that if I use the funciont purgechar() to substract the numbers, I'll erase the numbers inside the field too.

Do you have any ideas about how to do it?

Here's a dummy example about what I'm talking about :

FieldOrigin
801-field1name,905-field2name,202-field3name

And I want to convert it into :

FieldDesired
field1name,field2name,field3name

*(The terms field or name are invented for this example, the field could be named with other names, but with numbers inside)

Regards, Marcel.

1 Solution

Accepted Solutions
MarcoWedel

Hi,

concat can have a third parameter for order sequence, so:

concat(Field,',', ID) as [New Field]

could solve the issue.

Regards

Marco

View solution in original post

6 Replies
Not applicable

Try with substring function

MarcoWedel

Hi,

you could try with

Load somefields,

        TextBetween(FieldOrigin&',', '-', ',', IterNo()) as FieldDesired

from ...

While IterNo()<=SubStringCount(FieldOrigin, '-');

This should create one row per subfield.

You could concatenate the result afterwards.

Regards

Marco

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

Thanks Marco for your help.

The original point of that question is that I have an original table like this :

IDField
1field5
2field3
3field1

And I'd like to convert it in :

Field
field5,field3,field1

But when I'm trying to load the original table and make the resident table with the concat function, it always put me the fields in order of the field, not the id. It always does this :

Field
field1,field3,field5

Have you experienced something like this before?

I'm trying to do it like this with no success :

DesiredTable :

  NoConcatenate

  load Distinct

  concat(Field,',') as [New Field]

  Resident Original table Order by lD asc (or desc) ;

MarcoWedel

Hi,

concat can have a third parameter for order sequence, so:

concat(Field,',', ID) as [New Field]

could solve the issue.

Regards

Marco

marcel_olmo
Partner Ambassador
Partner Ambassador
Author

You're right Marco, I forgot that! Regards, Marcel.

MarcoWedel

You're welcome

Regards

Marco