Subscribe Bookmark RSS Feed

ReNaming Of Data Table using Row Information

d_barnett

Community Trekker

Joined:

Nov 30, 2011

I use routinely Query Builder to output files from a database but get into problems because they all have the same name ( apart from a (1), (2) etc after the name and so I then have go manually go and alter the name to match the experiment the data comes from.

How would I run a script to alter the name to match a certain column or columns in the data table?

So in the attached example I want to change the name from "Experiment Characterisation Results" to "5387_Experiment Name_Experiment Characterisation Results". With the extra bits of the names coming from the data table associated with it.

Regards

David

2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Here is a simple script that will do what you want

Name Defaults to Here( 1 );

dt = current data table();

dt << set name(Char(dt:experiment_id[1]) || "_" || dt:Experiment Plan Name[1] || "_Experiment Characterization Results");

Jim
ron_horne

Super User

Joined:

Jun 23, 2011

hi @d_barnett,

try this

dt = current data table ();

id= dt:EXPERIMENT_ID[1];

name = dt:Experiment Plan Name[1];

sample = dt:Sample Name[1];

dt << set name (char(id)||"_Experiment Name_"||char(name)||" "||char(sample));