Subscribe Bookmark RSS Feed

Assigning a value to a cell in a different data table

natalie_

Community Trekker

Joined:

Jan 6, 2016

Hi again,

I'd like to to assign a value to a cell.  I have two data tables.  I have set a variable equal to a cell from one data table, and I would like to put that value into a cell of a different data table.  I can assign the value to the variable without any problems, but I can't assign it to a cell in a different table. 

ht2 = Current Data Table () << get rows where(:Test == "HT2 test");

n=N Rows(ht2);  //number of HT2

dt2 = New Table("I",

  New Column("Device ID"),

  New Column("I"),

  );

For (i=1, i<=n,i++,

  newdtRows = N Rows (dt2);

  idss =  dt:X[i+61];

  dt2:I[newdtRows+1] = idss;

);

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

The issue is that your new data table doesn't have any rows in it.

ht2 = Current Data Table () << get rows where(:Test == "HT2 test");

n=N Rows(ht2);  //number of HT2

dt2 = New Table("I",

  New Column("Device ID"),

  New Column("I"),

  );

For (i=1, i<=n,i++,

  idss =  dt:X[i+61];

  dt2<<add rows(1);

  dt2:I = idss;

);

Jim
3 REPLIES
Craige_Hales

Staff

Joined:

Mar 21, 2013

I think you need to add some rows to the destination table.

Rows

Craige
Solution

The issue is that your new data table doesn't have any rows in it.

ht2 = Current Data Table () << get rows where(:Test == "HT2 test");

n=N Rows(ht2);  //number of HT2

dt2 = New Table("I",

  New Column("Device ID"),

  New Column("I"),

  );

For (i=1, i<=n,i++,

  idss =  dt:X[i+61];

  dt2<<add rows(1);

  dt2:I = idss;

);

Jim
natalie_

Community Trekker

Joined:

Jan 6, 2016

Thank you both so much!  I didn't realize you had to rows as well.