BookmarkSubscribe
Choose Language Hide Translation Bar
warnost
Community Trekker

Set Values produces empty cells, no errors

Hi,

I am looping through some data sets and trying to label the data from each by its file name. Everything comes together fine except the filename field is blank. I created a table by hand to try to get the new column code from jump which looked something like this:

mytable << New Column( "Filename", Character, Nominal, Set Values( {"filename"} ) );

This seems simple enough, so I tried inserting it into my code which I have summarized below:

y = Files In Directory(mypath);

For(i = N Items(y), i > 0, i--,

   

     /*Get my Data*/

     /*Now label the data with the filename*/

     mytable << New Column( "Filename", Character, Nominal, Set Values( y ) );

     /*Merge with other results*/

);

I have tried several variations of Set values. /*edit*/ The column always populates with "subscript" if I use {y}. I have tried something like mystring = y; ... Set Values(mystring). I have been through the scripting guide and google and I cant find the answer as to what is wrong. It must be something simple but it escapes me.

Thanks for your help.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User ms
Super User

Re: Set Values produces empty cells, no errors

Set Values require a list (or matrix) and it seems that Set Values does not fully evaluate the argument.

Try:

mytable << New Column( "Filename", Character, Nominal, Set Values( Eval List( {y[i]} ) ) );

0 Kudos
2 REPLIES 2
ms
Super User ms
Super User

Re: Set Values produces empty cells, no errors

Set Values require a list (or matrix) and it seems that Set Values does not fully evaluate the argument.

Try:

mytable << New Column( "Filename", Character, Nominal, Set Values( Eval List( {y[i]} ) ) );

0 Kudos
warnost
Community Trekker

Re: Set Values produces empty cells, no errors

This works, thank you!

0 Kudos