BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
natalie_
Community Trekker

Assigning a value to a cell in a different data table

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;

);

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Assigning a value to a cell in a different data table

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 3
Craige_Hales
Staff (Retired)

Re: Assigning a value to a cell in a different data table

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

Rows

Craige
txnelson
Super User

Re: Assigning a value to a cell in a different data table

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

Re: Assigning a value to a cell in a different data table

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

0 Kudos