Subscribe Bookmark RSS Feed

How to run JSL from within Visual Basic (VB)

jb

Community Trekker

Joined:

Sep 23, 2015

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
Solution

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

1 REPLY
Solution

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