cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
jb
jb
Level IV

How to run JSL from within Visual Basic (VB)

Hello. I would like to run JSL from within VB.

 

I'm trying to combine a set of 2 character columns into a single character column "X", with each field separated by a space (" ").

 

In the JMP User Interface, I would select the 2 columns in the data table and then go to Cols > Utilities > Combine Columns.

 

Can anyone advise why the code below does not work?

 

I'm get the following error:

        Name Unresolved: jmp_dt in access or evaluation of 'jmp_dt' , jmp_dt/*###*/

 

Dim jmp_app As JMP.Application

Dim jmp_doc As JMP.Document

Dim jmp_dt  As JMP.DataTable

Dim str     As String

Set jmp_app = CreateObject("JMP.Application")

jmp_app.Visible = True

Set jmp_doc = jmp_app.OpenDocument("C:\Program Files\SAS\JMP\12\Samples\Data\Big Class.jmp")

Set jmp_dt = jmp_doc.GetDataTable

str = "Combine Columns( delimiter("" ""), Columns(:sex,:age), Column Name(""X"") );"

jmp_dt.JSLFunction (str)

1 ACCEPTED SOLUTION

Accepted Solutions
jb
jb
Level IV

Re: How to run JSL from within Visual Basic (VB)

From reading other JMP User Community threads, I learned about the Current Data Table function.

  
This function enables JSL to reference a table that is already open (in my case, it was opened by Visual Basic), and now my code works.

 

Here are my revised last 2 lines of code:

 

str = "dt = Current Data Table();" & _

      "dt << Combine Columns( Delimiter( "" "" ), Columns(:sex,:age), Column Name(""X"") );"

       

jmp_app.RunCommand str

  

Thanks to the JMP User Community for all the good information!

jb

View solution in original post

1 REPLY 1
jb
jb
Level IV

Re: How to run JSL from within Visual Basic (VB)

From reading other JMP User Community threads, I learned about the Current Data Table function.

  
This function enables JSL to reference a table that is already open (in my case, it was opened by Visual Basic), and now my code works.

 

Here are my revised last 2 lines of code:

 

str = "dt = Current Data Table();" & _

      "dt << Combine Columns( Delimiter( "" "" ), Columns(:sex,:age), Column Name(""X"") );"

       

jmp_app.RunCommand str

  

Thanks to the JMP User Community for all the good information!

jb