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

[JSL Bug] Got problem when try to concatenate two tables from different directory

Hi All,

I'm a new user in JMP scripting and need help to find bugs in my code.

 

What I'm trying to do here is to concatenate already opened data files (dt1 and dt2). I found that the script did not concatenate the two tables. line 41 and so on was not executed plus with no error message

Can anyone help me with it?

 

Thanks

 

achid03_0-1625220512282.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: [JSL Bug] Got problem when try to concatenate two tables from different directory

This works fine:

 

Names Default To Here(1);
dt1_dir = Pick Directory("Pick dir", "$SAMPLE_DATA/");
dt1 = Pick File(
	"Select JMP File",
	dt1_dir,
	{"JMP Files|jmp;jsl;jrn", "All Files|*"},
	1,
	0,
	0
);
Show(dt1);
dt1 = Open(dt1);
Show(dt1);

dt2_dir = Pick Directory("Pick dir", "$SAMPLE_DATA/");
dt2 = Pick File(
	"Select JMP File",
	dt2_dir,
	{"JMP Files|jmp;jsl;jrn", "All Files|*"},
	1,
	0,
	0
);
Show(dt2);
dt2 = Open(dt2);
Show(dt2);

concat_dt = dt1 << Concatenate(dt2,
	Output Table("Concat datatable"),
	Create Source Column
);

Do similar changes to your code and check if it works (check Concatenate())

-Jarmo

View solution in original post

6 REPLIES 6
jthi
Super User

Re: [JSL Bug] Got problem when try to concatenate two tables from different directory

I think you will have to reassign dt1 and dt2 to open command after Pick File as Pick File will return path to the picked file.

Names Default To Here(1);
dt1 = Pick File(
	"Select JMP File",
	"$DOCUMENTS",
	{"JMP Files|jmp;jsl;jrn", "All Files|*"},
	1,
	0,
	"newJmpFile.jmp"
);
dt1 = Open(dt1);
-Jarmo
achid03
Level I

Re: [JSL Bug] Got problem when try to concatenate two tables from different directory

I did reassign dt1 and dt2. But it didn't work
jthi
Super User

Re: [JSL Bug] Got problem when try to concatenate two tables from different directory

This works fine:

 

Names Default To Here(1);
dt1_dir = Pick Directory("Pick dir", "$SAMPLE_DATA/");
dt1 = Pick File(
	"Select JMP File",
	dt1_dir,
	{"JMP Files|jmp;jsl;jrn", "All Files|*"},
	1,
	0,
	0
);
Show(dt1);
dt1 = Open(dt1);
Show(dt1);

dt2_dir = Pick Directory("Pick dir", "$SAMPLE_DATA/");
dt2 = Pick File(
	"Select JMP File",
	dt2_dir,
	{"JMP Files|jmp;jsl;jrn", "All Files|*"},
	1,
	0,
	0
);
Show(dt2);
dt2 = Open(dt2);
Show(dt2);

concat_dt = dt1 << Concatenate(dt2,
	Output Table("Concat datatable"),
	Create Source Column
);

Do similar changes to your code and check if it works (check Concatenate())

-Jarmo
achid03
Level I

Re: [JSL Bug] Got problem when try to concatenate two tables from different directory

yeah it works! and why you put "show" two times?
Craige_Hales
Super User

Re: [JSL Bug] Got problem when try to concatenate two tables from different directory

Look in the log and you'll see the show before the assignment is a string, and after the assignment is a data table.

Craige
Craige_Hales
Super User

Re: [JSL Bug] Got problem when try to concatenate two tables from different directory

...normally I'd name these variables differently:

dt1Name = "c:\...data.jmp";
dt1 = open(dt1Name);

so the name better describes the contents of the variable. Sometimes I reuse variables, but it usually causes me to make mistakes.

 

Craige