Some questions about columns<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Hi all,
I am writing some code for an application which checks several test conditions of a device, and if it has passed, it gets added to a data table with all of its data.
My last column is Vd_V, and there are values in each row from 50-650 in 10 V steps. If the device has passed, I would like to append a column of data to the same data table. Therefore, my number of columns in changing. It looks something like this.
Vd_V Device_1 Device_4
50 1 1
60 2 2
70 3 3
80 4 4
... ... ...
... ... ...
I have written some code which is not quite working the way I thought it would. In the data table dtSummary I search for the number of columns. In the data table with all the device's data ( dt1 ), I am copying the data to some variable and I would like to add it to dtSummary .
However, it is not adding it to the right columns. I have copied the piece of my code which is giving me some trouble.
dtSummary << New Column ("Device_" || char(deviceName)) ;
col = column("Device_" || char(deviceName));
col << Data Type ("Numeric");
cc = dtSummary << Get Column Names ("Continuous");
ncols = N Items(cc);
for(i=1, i<=60, i++,
Current Data Table(dt1);
col = Column(i+16);
colValue = col;
Current Data Table(dtSummary);
col2 = Column(ncols);
col2=colValue;
);
Re: Some questions about columnsAh, I can't believe I didn't think of that!
Also, when I was checking the log, some of the columns were being changed from Numeric to Character. This was because colValue was a character and not a number. I changed it to a number and everything is working.
Thanks a lot!
dtSummary << New Column ("Device_" || char(deviceName)) ;
col = column("Device_" || char(deviceName));
col << Data Type ("Numeric");
cc = dtSummary << Get Column Names ("Numeric");
ncols = N Items(cc)+1;
for(i=1, i<=60, i++,
Current Data Table(dt1);
col = Column(i+16);
colValue = col;
Current Data Table(dtSummary);
col2 = Column(ncols);
col2=Num(colValue);
);
Re: Some questions about columnsguessing, but I think cc is a list of the continuous columns, which is probably not ALL of the columns. ncols is actually the number of continuous columns and probably not the index of the last column, or even the last continuous column. (because you might have other column types in between your continuous columns.) so, 3 lines from the end, Column(ncols) may not reference the column you want.