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

re-use standard application code?

Is the Application code behind standard dialogues available from the JMP installation?

Can I edit it in Application Builder?

 

Possible use case:
To use the same kind of file selector like in Import Multiple Files, but to load files different from CSV/XMLJSON/PDF.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XI

Re: re-use standard application code?

I just found this post by @Craige_Hales :

https://community.jmp.com/t5/Uncharted/Directory-Tree-Explore-Space-Used-by-Folders/ba-p/456571#U456...

 

Cool trick: pipe your settings as messages into MFI and get the filelist via

boxtop = mfi << createwindow;
dtFiles = boxtop[Table Box( 1 )] << MakeIntoDataTable( invisible( 1 ) );
boxtop << closewindow;

View solution in original post

6 REPLIES 6

Re: re-use standard application code?

No, that is compiled code and proprietary. You can construct your dialog window. It is documented in the JSL Guide.

 

You can also submit a request for an enhancement to the Import Multiple File command to accommodate another file format.

hogi
Level XI

Re: re-use standard application code?

I just found this post by @Craige_Hales :

https://community.jmp.com/t5/Uncharted/Directory-Tree-Explore-Space-Used-by-Folders/ba-p/456571#U456...

 

Cool trick: pipe your settings as messages into MFI and get the filelist via

boxtop = mfi << createwindow;
dtFiles = boxtop[Table Box( 1 )] << MakeIntoDataTable( invisible( 1 ) );
boxtop << closewindow;

Re: re-use standard application code?

You asked how to hook into MFI so you could use the dialog and write your code to import file formats that are not currently supported. You did not ask to get the list of files to be imported from MFI. I was confused.

hogi
Level XI

Re: re-use standard application code?

Yes, you are right.

 

@Mark_Bailey You are right, my first approach was to just use the user interface of MFI and the code behind i to get the file list.

I learned from this post that - unfortunately - this is not possible because MFI is proprieatary and there is no source code available

 

Next thing would be to re-write the interface and the code behind.

Half of it can be skipped by Craige's trick.

So, the only thing that one has to do is:
provide some interface to pick the main folder (and e.g. file type selector), then just pipe the variables into MFI and get the filelist
(all subfolders, selected filetype -> great).

Not exactly what I wanted - but close enough. Let's say: not as disappointing as it was after the first reply

hogi
Level XI

Re: re-use standard application code?

Let's think about a next level:
How to just get the file names that match the MFI search criteria?

hm ...

 

a workaround:
use the background color of the HTML export

Fortunately, I found this post:
Search a string for all occurrences of a pattern *) 

Thanks @Craige_Hales !!!

 

Great that there is a way in JMP to do global pattern matching without a for loop ....
but I also agree with @jthi: an option GLOBAL MATCH for Regex Match would be nice: 
Add flag to Regex Match() to find all non-overlapping occurances of pattern 

anybody else who wants to support the wish with a Kudo?

 

I am still struggling to understand how it works exactly -  e.g. why is the 

| Pat Len(1)

necessary?

 

mfi = Multiple File Import(
<<Set Folder( "C:\TEMP\" ),
<<Set Name Filter( "*.txt;" ),
<<Set Name Enable( 1 )
);

boxtop = mfi << createwindow; scb=boxtop[StringColBox("File Name")]; txt = scb <<get html; palindrome = Pat Regex( "bgcolor=#000000.*?>" ) + // selected filename by background color (Pat Regex( ".*?")) >> middlePart + // this is what we want to get Pat String("</td"); // the tail list = {}; Pat Match( txt, Pat Repeat( (palindrome + Pat Test( Insert Into( list, middlePart ); 1 // pat Test returns 1(OK) because we are not actually testing anything...just wanted to run some JSL )// ) | // above adds to list, below skips forward a letter to try again Pat Len( 1 ) // this bit is more important than it looks; it matches all the text that isn't interesting ) ); Show( list);



 

Craige_Hales
Super User

Re: re-use standard application code?

  • Glad you could find it. I wish the archived posts were a bit more visible.
  • Good usage of .*?
  • The pattern matching language is similar to the Snobol4 pattern matching language from Bell Labs, a long time ago. The tour de force example (not really useful for learning though) is in Colossal Cave Adventure . The Fortran code is compiled by a single call to the pattern matcher.
  • In your background color parser above, the repeat is around two alternatives:
    • find your pattern at the current location
    • use len(1) to move the current location forward one character

 

Craige