Subscribe Bookmark RSS Feed

Rows from table as part of formula for columns in a different table

daniel_harding

Community Trekker

Joined:

Jul 2, 2012

Hi all,

I am attempting to make a new data table with columns based on a formula using row values from a previous table, each row used at a time like this:

dttest << New Column( "Test 1",

  formula(random normal( (slope* Row1 of first table)  + meantime, assay ))

  );

  dttest << New Column( "Test 2",

  formula(random normal ( (slope * Row2 of first table) + meantime, assay))

  );

  dttest << New Column( "Test 3",

  formula(random normal ( (slope * Row3 of first table) + meantime, assay))

thanks for any help or tips in the right direction

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Consider this approach. It will create the column values as desired, but will not be dynamic. If the first table is updated, it will not update the values in dttest. If this is not a requirement, then set each value can be a flexible command to introduce values and references from other tables or from inside variables.

dttest << New Column( "Test 1",

  <<seteachvalue(random normal( (slope* column(first table global, column name or number from first table)[1])  + meantime, assay ))

  );

  dttest << New Column( "Test 2",

<<seteachvalue(random normal ( (slope * column(first table global, column name or number from first table)[2]) + meantime, assay))

  );

  dttest << New Column( "Test 3",

  <<seteachvalue(random normal ( (slope *column(first table global, column name or number from first table)[3] ) + meantime, assay))

2 REPLIES
Solution

Consider this approach. It will create the column values as desired, but will not be dynamic. If the first table is updated, it will not update the values in dttest. If this is not a requirement, then set each value can be a flexible command to introduce values and references from other tables or from inside variables.

dttest << New Column( "Test 1",

  <<seteachvalue(random normal( (slope* column(first table global, column name or number from first table)[1])  + meantime, assay ))

  );

  dttest << New Column( "Test 2",

<<seteachvalue(random normal ( (slope * column(first table global, column name or number from first table)[2]) + meantime, assay))

  );

  dttest << New Column( "Test 3",

  <<seteachvalue(random normal ( (slope *column(first table global, column name or number from first table)[3] ) + meantime, assay))

daniel_harding

Community Trekker

Joined:

Jul 2, 2012

This works well, thanks so much