Subscribe Bookmark RSS Feed

Name Unresolved error for existing column

asdf

Occasional Contributor

Joined:

Oct 23, 2017

Hi,

I'm having trouble getting my code to recognize Column 16, "Bias Setpoint".  I'd like to have my code step through each Bias Setpoint row and add adjacent rows to output RAPi.  However, I get a Name Unresolved error for "Bias Setpoint" column.  I've tried to just call on it by using Column(16), but that did not work either.  I had even tried to simplify the expression and just equate :RAPi[i]=:Name("Bias Setpoint")[i] , but still no success.  I've also tried defining bsp=Column(dt,16);  and For Each Row(:RAPi=:bsp); but still no success.  Can someone assist in this debug?  I'm not sure what I'm doing incorrectly.  Thank you

 

csvfile=Pick File("choose file","$Documents" );

dt=Open(csvfile,

Import Settings(

End Of Field( Comma ),

Scan Whole File( 1 ),

// Labels( 1 ),

Column Names Start(53 ),

Data Starts( 54),

//scan

)

);

dt = Current Data Table();

//Define RAP cycle, RAP times

dt<<NewColumn("RAPi", Numeric, "Continuous", Format("Best",12) );

RAPi[1]=0;

dt2= dt<<Summary( N, Freq( "None" ), Weight( "None" ) );

totalrows =N[1];

dt<<NewColumn( "RowAvg", Numeric, "Continuous", Format("Best",12), );

//Find TCP initial turn on. NOte: you must change turnon value if you use tcp for chucking and it is incorporated in data.

turnon=0.1;

dt<<Select Where(:Name("TCP Setpoint")<=turnon)<<Hide(1)<<Exclude(1)<<Delete Rows("all");

//Rap Cycle Number

w=NRow(dt);

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

:RAPi[i]=:Name("Bias Setpoint"[i] +:Name("Bias Setpoint")[i+1])

);

1 REPLY
ms

Super User

Joined:

Jun 23, 2011

The summary table dt2 is created after dt, and thus it looks like dt2 will be the "current" data table when the assignment within the loop is run. 

 

On way to avoid this is to include the table variable when addressing table data.

For example:

For(i = 1, i <= w, i++,
    dt:RAPi[i] = dt:Name("Bias Setpoint")[i] + dt:Name("Bias Setpoint")[i + 1]
);