Computing delta based on few orderly attributesHi Guys,
I have the following problem that I think probably a script will help. I would like to find the delta as shown at the Delta column. In Table1, the delta is derived based on the same ID and test_id, it will get the result from test_type =31/main_rad=2/sub_rad=0 and minus it out from test_type =33/main_rad=2/sub_rad=0. And the process continue.
In table2, the delta is derived based on the same ID, test_id and test_type, it will get the result from main_rad=2/sub_rad=0 and minus it out from main_rad=3/sub_rad=0. And the process continue for the subsequent main_rad and sub_rad.
* in the actual data, there are thousand of ID and this is tough if I want to compare them one by one based on test_type and main and sub radius. Having scripts to do it will be extremely helpful.
Please refer to picture below:

Thank you.
Re: Computing delta based on few orderly attributesThanks Jim! There was slight error in the script but I managed to figure it out.
Re: Computing delta based on few orderly attributesHere is a little script that does what you asked. It works for the first data table. With minor changes, the same concept will work for the second data table.
Names Default To Here( 1 );
dt = Current Data Table();
For( i = 1, i <= N Rows( dt ), i++,
If( :test_ic[i] == 566,
target_row = (dt << get rows where( :ID == :ID[i] & :test_ic == 568 & :main_rad == :main_rad[i] & :sub_rad == :sub_rad[i] ))[1];
If( Is Missing( target_row ) == 0,
:delta[i] = :result[i] - :result[target_row],
:delta[i] = .
);
,
:delta[i] = .
)
);