column rename with same patter

hi all,

I have a table with column names as listed below

ElecMeter(instance=2, building=1, dataset='energy', appliances=[Appliance(type='air conditioner', instance=1)])
ElecMeter(instance=3, building=1, dataset='energy', appliances=[Appliance(type='sockets', instance=1)])
ElecMeter(instance=4, building=1, dataset='energy', appliances=[Appliance(type='washing machine', instance=1)])
ElecMeter(instance=5, building=1, dataset='energy', appliances=[Appliance(type='dish washer', instance=1)])
ElecMeter(instance=6, building=1, dataset='energy', appliances=[Appliance(type='waste disposal unit', instance=1)])
ElecMeter(instance=7, building=1, dataset='energy', appliances=[Appliance(type='spin dryer', instance=1)])
ElecMeter(instance=8, building=1, dataset='energy', appliances=[Appliance(type='electric furnace', instance=1)])
ElecMeter(instance=9, building=1, dataset='energy', appliances=[Appliance(type='electric hot tub heater', instance=1)])
ElecMeter(instance=10, building=1, dataset='energy', appliances=[Appliance(type='sockets', instance=2)])
ElecMeter(instance=11, building=1, dataset='energy', appliances=[Appliance(type='light', instance=1)])
ElecMeter(instance=12, building=1, dataset='energy', appliances=[Appliance(type='light', instance=2)])
ElecMeter(instance=13, building=1, dataset='energy', appliances=[Appliance(type='light', instance=3)])
ElecMeter(instance=14, building=1, dataset='energy', appliances=[Appliance(type='microwave', instance=1)])
ElecMeter(instance=15, building=1, dataset='energy', appliances=[Appliance(type='fridge', instance=1)])

i have done Extract column header>Transpose>String manupulation

i am stuck at  String manupulation to have a final column name of just the appliance, ie air conditioner, sockets, dish washer,

how do i match the string with java regex expression to catch this pattern

 

 

Hi, could you post a minimal workflow? Just with the column names and no data.

Cheers, Iris

I dont know if i have uploaded the workflow properly.

some appliance however are repeated. so i would like to extract the appliance name and the instance number following it.

I am thinking column think, to extract the phrase within the square bracket [ ] then the appliance name within the single quote and the number following the instance= ,

from: ElecMeter(instance=2, building=1, dataset='Dataport', appliances=[Appliance(type='air conditioner', instance=1)])

I would use a substr, it is a lot easier and works for your solution:

substr($Column Header$,indexOf($Column Header$, "appliances="))

Best, Iris

Dear Iris,

Thanks for your support.

however extracting the column names from the string manupulation node using regex expression cannot finish the loop end (append column) since the column name has changed at the end.

how do i work around this ? i have attached an updated workflow.

Dear Mano,

you don't need a loop for this. You can afterwards apply the insert column header node. This will be much faster than looping :-)

Cheers, Iris