cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Ronaldo
Level II

How do I input different values for each JMP file using a script?

open=("C:\source\new.jmp);

For (
i=1,
i<= nitems(files),
i++,
data table("new")<<new column("month",charcter,formula(eval("Jan")));
);

I know that the above script is wrong, and I wrote it as a rough example.

There are 3 JMP files of the same type in the source folder.

After creating a new column using the For SCRIPT
I want to put January, February, and March in the file order.

I need help figuring out what to do.

1 ACCEPTED SOLUTION

Accepted Solutions
Georg
Level VII

Re: How do I input different values for each JMP file using a script?

Dear @Ronaldo , welcome to the community.

You can do it like below, tested for JMP16, earlier versions should use old loop syntax, BR

 

edit: sorry, misunderstood first, maybe now it's what you need.

Names Default To Here( 1 );

dt1 = new  table("Table 1", add rows(10), new column ("Column A", formula(row())));
dt2 = new  table("Table 2", add rows(10), new column ("Column B", formula(row())));
dt3 = new  table("Table 3", add rows(10), new column ("Column C", formula(row())));

dt_lst = List( dt1, dt2, dt3 );

month_lst = List( "Jan", "Feb", "Mar" );

For Each( {value, index}, dt_lst, value << New Column( "Month", "Character", set each value( (month_lst[index]) ) ) );
Georg

View solution in original post

2 REPLIES 2
Georg
Level VII

Re: How do I input different values for each JMP file using a script?

Dear @Ronaldo , welcome to the community.

You can do it like below, tested for JMP16, earlier versions should use old loop syntax, BR

 

edit: sorry, misunderstood first, maybe now it's what you need.

Names Default To Here( 1 );

dt1 = new  table("Table 1", add rows(10), new column ("Column A", formula(row())));
dt2 = new  table("Table 2", add rows(10), new column ("Column B", formula(row())));
dt3 = new  table("Table 3", add rows(10), new column ("Column C", formula(row())));

dt_lst = List( dt1, dt2, dt3 );

month_lst = List( "Jan", "Feb", "Mar" );

For Each( {value, index}, dt_lst, value << New Column( "Month", "Character", set each value( (month_lst[index]) ) ) );
Georg
Ronaldo
Level II

Re: How do I input different values for each JMP file using a script?

thank you very much!!!
i got it!