Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
User12321
Contributor III
Contributor III

Load fields ending with a fixed word

Hi,

I have a table with fields Id, Date, Outlet and ending with a particular word like Service.

I want to arrive at a table where all the fields ending with Service are put together in a single column.

Can someone help me please. Thank you.

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

It's not possible to query and/or conditionally modify the origin field-names within a load. For such tasks you will always need additionally measures in beforehand or afterwards which give you the information to pick respectively to filter on the wanted values.

In your case I wouldn't go this expensive way else I would do something like this:

t1: crosstable(Company, Service, 3) load * from Source;

t2: load ID, Date, Outlet, Company, mid(Service, 1, index(Service, ' ', -1)-1) as Service
resident t1 where subfield(Service, ' ', -1) = 'Service';

- Marcus

View solution in original post

1 Reply
marcus_sommer

It's not possible to query and/or conditionally modify the origin field-names within a load. For such tasks you will always need additionally measures in beforehand or afterwards which give you the information to pick respectively to filter on the wanted values.

In your case I wouldn't go this expensive way else I would do something like this:

t1: crosstable(Company, Service, 3) load * from Source;

t2: load ID, Date, Outlet, Company, mid(Service, 1, index(Service, ' ', -1)-1) as Service
resident t1 where subfield(Service, ' ', -1) = 'Service';

- Marcus