cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
RK1
RK1
Level II

Comparing Names of column from two different data table

Hello,

I am writing a script where user will select  particular column name from one data table using panel box. Then selected column will be compared against column name from a different table and select the column when it matches. 

 

I am facing a problem related to {"x"}. When i am selecting column from panel box and storing in variable, it is getting stored as selected_cols= {"BIN"}. Now when i am comparing it against column names from 2nd data table, result is giving no column matches even though 2nd table has BIN column . When i checked when comparing its comparing {"BIN"} against BIN and giving no matching, I even tried putting char (selected_cols) but it makes {"BIN"} to "{\!"BIN\!"}".

Please help in getting this issue resolved. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Comparing Names of column from two different data table

I am not totally sure of the issue, without seeing the code, but I am guessing that you are running into an issue where you are ending up comparing a list to a string.  {"x"} is a list.  If you want to compare it to a string, you need to use it's subscript......

a={"x"};

b="x";

show(a==b);

show( a[1]==b);

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Comparing Names of column from two different data table

I am not totally sure of the issue, without seeing the code, but I am guessing that you are running into an issue where you are ending up comparing a list to a string.  {"x"} is a list.  If you want to compare it to a string, you need to use it's subscript......

a={"x"};

b="x";

show(a==b);

show( a[1]==b);

Jim
RK1
RK1
Level II

Re: Comparing Names of column from two different data table

Thanks for quick help. it worked. You were right i was comparing list with a string that's why not getting result.