BookmarkSubscribeRSS Feed
Highlighted
Hegedus

Community Trekker

Joined:

Jun 23, 2011

Table Update Bug?

Hi,

 

I am working on script and ran into problem/bug.  I would to validate this or at least understand what is happening.

Here is what I am trying to do: I have a time series of data for a bunch of samples and I want to generate a column that compares the measured value to that when the sample was first meaured. Basically a (Y0-Y)/Y0.

 

Do do that I generate a subset where the first data reading for each sample (which may not be count =1).  I then get the important parameters by doing a table update to the subset.  Changes some names for clarity purposes and Then update the original data table with the intial reading data such that I have a column of Y and seperate column of Y0.

 

The last step causes a problem. The subset table has a column names Cycle_num which represents the minimum value on a per sample basis.  The orginal also has one with that name but includes all the different point.  The last table update matches on sample id and specifies the columns to add.  The list specifically does NOT include cycle_num. Nor is cycle_num used as a match column.  Upon table updating  the data in cycle_num in the original table has been changed to the values from the subtable.  The work around is to delete the cycle_num column from the subtable before using it in the last update step.

 

Has anyone seen a bug like this or are all columns sharing names always used in matches and updated even if not specifically called to?

 

Andy

 

//Get initial Data note: first run may not be at 1 so use min
dt1=dt<<Summary(
	Group( :device_id, :sweep_direction,:temporal_point_type ),
	Min( :cycle_num ),
	Freq( "None" ),
	Weight( "None" ),
	statistics column name format( "column" ),
	Link to original data table( 0 )
);
//get rid of mid values
dt1<<Select Where(:temporal_point_type == "mid");
dt1<<delete rows;

//get important initial data
dt1	<< Update(
	With( Data Table( dt) ),
	Match Columns(
		:device_id = :device_id,
		:sweep_direction = :sweep_direction,
		:temporal_point_type = :temporal_point_type,
		:cycle_num = :cycle_num
	),
	Add Columns from Update table(
		:tvis_bright,
		:tvis_dark,
		:l_star,
		:a_star,
		:b_star,
		:Name( "ChargeTransfer [mC/cm2]" )
	)
);

// Do some clean up to prevent name collision and bring into base table
Data Table (DT1);
:tvis_bright<<Set Name("TVB0");
:Name( "ChargeTransfer [mC/cm2]" ) <<Set Name("CT0");
:tvis_dark<<Set Name("TVD0");
:l_star<<Set Name("LS0");
:a_star<<Set Name("AS0");
:b_star<<Set Name("BS0");
dt1<<delete columns(:cycle_num); //added as work around solution

dt<<
	Update(
	With(Data Table(Dt1)),
	Match Columns( :device_id = :device_id, :sweep_direction = :sweep_direction ),
	Add Columns from Update table(:TVB0,:TVD0,:CT0,:LS0,:AS0,:BS0 ),
);
1 REPLY
Hegedus

Community Trekker

Joined:

Jun 23, 2011

Re: Table Update Bug?

Hi I reproduced the effect and have data table examples.  I have attached files.

Basically I made two tables where I have a column "Fred" in both though they have different values.  I have a column called Match that I use as the matching column.  You can see the different values of Fred in both tables.  I show the dialog box for the update.  I match using match and I select only one column to add to the original, Lucy.  After I execute the update, you see that the values in the column Fred in the original data table have been changed to reflect the values in the addtable.  Note: Fred was not selcted for updating.

Is this the expected/intended behaviour?

 

Andy

Update Selection.pngPost Update.png