cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
zetaVagabond1
Level III

Best Practices for Repeated Joins/Updates in JMP Scripts

Hi all,

I’m running a JSL script that performs Update/Join operations between calculation tables and filtered data tables. I noticed the following behavior:

  1. When the script runs multiple times, JMP automatically renames duplicate columns to avoid name collisions, e.g.,

     
    Batch Number -   Batch Number of table  1, Batch Number of table 2
  2. Even if I close the tables from the panel, the variables (column objects) still exist in memory, so re-running the script creates additional duplicate columns.

  3. My current workaround is to exit JMP and restart before running the script to prevent duplicate columns.

Questions for the community:

  • Are there best practices for repeated Update or Join operations that avoid generating duplicate columns?

  • Is there a recommended way to “clean up” tables/variables after a script run so subsequent runs do not create duplicates?

  • Are there functions or JSL patterns to safely rename or overwrite columns without generating extra copies?

Any suggestions or strategies would be greatly appreciated!

I also tried this code to handle them dynamically but didn't worlk 

 

RenameColumn = Function({dt, oldNamePattern, newName},
    colList = dt << Get Column Names;       // returns a column list object
    n = N Items(colList);                   // number of columns

    For(i = 1, i <= n, i++,
        c = colList[i];                     // get the column name as string
        If(Contains(c, oldNamePattern),
            Column(dt, c) << Set Name(newName);
            Break();                         // optional: stop after first match
        );
    );
);

 

2 REPLIES 2
jthi
Super User

Re: Best Practices for Repeated Joins/Updates in JMP Scripts

What do you wish to do to those columns? If they already exist, don't update/re-add them? Can you provide example script with data which community could look into? 

-Jarmo
hogi
Level XIII

Re: Best Practices for Repeated Joins/Updates in JMP Scripts

I am curious to see the details behind the described issue.

esp.  the variables (column objects) still exist in memory, so re-running the script creates additional duplicate columns.


Besides this, please note:

For Tables/Update, such an issue is caused by a new functionality in JMP19:
Allow Update platform to create new columns if they already exist in the table to be updated 

The additional functionality is cool, but people did not consider the collateral effect!

 

collateral effect: 
With JMP19, it is not possible anymore to use the function in the mode:
"please add columns which are not yet in the target table".
further details: Tables/Update changed! 

Scripts behave differnetly and the uer will get tables like this one: 
(the additional columns are useless - they pollute the table)

hogi_0-1763640191785.png


I hope the developers understand the issue and fix it with the next release.

a possible solution : 2 modes
  automatic tables/update 

  1. use the new approach and add a column (with a postfix) IF (!!!!) the user selects the column
    hogi_3-1763640557118.png
  2. don't use the trick in the Mode "All":
    hogi_1-1763640340016.png

    -> will allow again 
    "add columns which are not yet in the target table"
    (like in previous version s of JMP).

... alternative: an additional setting to enable/disable the new mode.
To guarantee backward compatibility: disable the setting by default.

Recommended Articles