Setting link ID in jsl seems not to work - what is wrong?I am trying to set a link ID in JSL, but when setting it in JSL, the link ID seems to be set in the table like it should, but the link reference in the other table that is supposed to reference it does not work.
If I remove the link ID and set it by right clicking on the link ID, everything works fine.
I use this:
dfps:name( "Country" ) << Set Property( "Link ID", 1 );
Can't see what is wrong with this. Am I missing some refresh operation to make it work? Any suggestions?
Mass CustomizationRe: Setting link ID in jsl seems not to work - what is wrong?Thanks Mandy,
sometimes you don't want things saved.
But thanks for pointing out that this issue is fixed in JMP 17. I'm on 16.2. It is not always easy to update to a newer software version in a larger company, but now I know it would be worth the effort.
Re: Setting link ID in jsl seems not to work - what is wrong?Thanks for sharing these comments and insights. It has been encouraged many times to save the tables before creating these link id and link references for tables, to make sure it saves properly. However, we did have a defect reported on this, and it was fixed during the 17.0 JMP cycle. So this scripting behavior no longer fails.
Instal the new JMP 17.0 and this behavior should be more improved. Thanks.
Re: Setting link ID in jsl seems not to work - what is wrong?@Robbb I just sent a note to the dev team; I've not tested your theory, but I'm hoping you've identified a cause of the unpredictability. It is believable because there is something different about the current directory when a script isn't saved, and the tables depend on something related to that, maybe.
Re: Setting link ID in jsl seems not to work - what is wrong?As Craige mentions, I believe it is a "save" issue. I've had this problem before, and frustratingly, I had it only on PC. On the Mac, I did not need to perform the save.
Ensuring my table was saved first, fixed the problem.
Brady
Re: Setting link ID in jsl seems not to work - what is wrong?I discovered somethink new:
If the JSL script that I am executing is not saved and was never saved before (so if source code was written or copied into a brand new opened scripting window), linking two unsaved data tables works like a charm.
If it is saved or if it is an existing script that was just modified and not saved, it is not working.
Re: Setting link ID in jsl seems not to work - what is wrong?Hi everybody,
I have got the very same problem with linking two tables via script.
It behaves exactly as @ThomasZatValcon described.
After doing it manually through clicking I then copied the two lines of code from the log.
Then it depends where they are inserted. If I insert them in a new script window, the script works. If I insert them in my current script under development (from which the two tables were opened originally) it does not work.
Are there some new insights into this issue?
Cheers
Robert
Btw. In the meantime I found a related thread. The workaround is to save the datatables first, but this is not always convenient.
https://community.jmp.com/t5/Discussions/Virtual-Join-via-JSL-does-not-work/td-p/360675
Re: Setting link ID in jsl seems not to work - what is wrong?Try saving the tables before linking and see if your results become consistent. I'm not sure how the links work internally, but it might depend on a file name being available.
Re: Setting link ID in jsl seems not to work - what is wrong?It's two different tables. The one to the left is the table with the ID, the left table is the table with the reference.
Yes, I tried column(dt...) and dt:name()... referencing.
I also tried to put the code that works (when it is run from a separate script window) into a separate file and include it. Didn't work either. I tried to put it into an expr() and evaluate it. Also didn't help.
But the two lines of code work if I create a separate script window and run them from there, which is unexpected.
Re: Setting link ID in jsl seems not to work - what is wrong?Are they supposed to be the same? Because the two tables have different number of columns.
Have you looked that `dfps` is right? Or tried using `Column(dt, "Country")`?Re: Setting link ID in jsl seems not to work - what is wrong?Still haven't figured it out, but I am getting some truly strange behavior here:
Having the same code in two windows:

When I run the code in the left window, notice the icon with the two keys is grey (it doesn't work):

When I run the same two lines in the right window it works:

The code in the left window is where the jsl was created. All the code is just running in the global namespace. I even tried with names default to here(1) and get the same behavior which surprised me, as I expected not to be able to reference the table variables from another script window.
Re: Setting link ID in jsl seems not to work - what is wrong?Thanks. I modified your code to represent better what is going on (tables are only in memory) to represent what is going on more closely and expected it to fail, but it actually works. Still haven't figured out what makes my other code fail, but will update this thread if I find out.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
// creating a unique ID
dt2 = dt << subset( all rows, all columns );
dt2 << New Column( "_Row", <<SET each="" value=""></SET>
Re: Setting link ID in jsl seems not to work - what is wrong?Are you saying that you're setting the reference before the ID? Not sure how you'd do that, but this works fine for me.
Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
// creating a unique ID
dt << New Column("_Row", << Set Each Value(Row()));
// subsetting just so I have something to link
dt_sub = dt << Subset(
Selected Rows( 0 ),
Rows( [1, 2, 3, 4, 5] ),
columns( :_Row )
);
Column(dt, "_Row") << Set Property( "Link ID", 1 );
Column(dt_sub, "_Row") << Set Property( "Link Reference",
Reference Table( "$SAMPLE_DATA\Big Class.jmp" )
);