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

Join in JSL recreating tables?

I have some JSL I'm running that appears to be re-creating the tables I am joining.  So I start with TableA and TableB, and want to make TableC.  What ends up happening is I make TableA2, TableB2, and TableC, while still having TableA and TableB .    It's the exact same JSL I'm used to using for this so I can't figure out what's up here.  Any help would be appreciated. 

 

TableC = TableA << Join (
	
	With( TableB ),
	Match Flag(0),
	Select( :ID, :PROP, :DATE_, :VALUE_, :CASE,  :CMSQID),
	SelectWith( :Name
		,:origin
		,:region
		,:Season ),
	By Matching Columns( :CMSQID = :CMSQID ),
	Drop multiples( 0, 0 ),
	Include Nonmatches( 1, 0 ),
	Preserve main table order( 1 )
);
3 REPLIES 3
txnelson
Super User

Re: Join in JSL recreating tables?

The behavior you are describing is the standard behavior for the Join platform.  If you want to close Table A and Table B after the join, just specify

close( TableA, nosave );
close( TableB, nosave );
Jim
Evan_Morris
Level IV

Re: Join in JSL recreating tables?

Huh, that's odd because I don't think it did that on a couple of my other joins. Is there a way to specify the object name for the duplicate tables it creates (this would be for the A2 and B2 copies that get made)? Not sure how to close them reliably without having a way to reference them.
txnelson
Super User

Re: Join in JSL recreating tables?

The Join does not make duplicate copies.  I read your initial question as to why the original TableA and TableB tables were still there after the join.  Below is a rework of your Join statement, using the Big Class and Big Class Families data tables.  It opens the 2 tables and then joins them together into a third table.  This is the expected behavior

Names Default to Here( 1 );
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
TableA = Open( "$SAMPLE_DATA/Big Class.jmp" );


// Open Data Table: Big Class Families.jmp
// → Data Table( "Big Class Families" )
TableB = Open( "$SAMPLE_DATA/Big Class Families.jmp" );

TableC = TableA << Join (
	
	With( TableB ),
	Match Flag(0),
	Select( :Age, :Height),
	SelectWith( :Name
		,:sports
		,:family cars
		,:sibling ages ),
	By Matching Columns( :Name = :Name, :Age == :Age ),
	Drop multiples( 0, 0 ),
	Include Nonmatches( 1, 0 ),
	Preserve main table order( 1 )
);
Jim