cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
powerpuff
Level IV

How to delete a column after performing join in jsl?

For example, 

dte << Join(
                With(dtf),
               By Matching Column(:Y = :Y ),
               Preserve main table order(1),
               output table("Joined Table");
);

After I run this script, a new table is generated having the "Y" columns from both the tables, but after joining I want to get rid of those columns. Their names are different every time. For example, "Y of Untitled 50" and "Y of Untitled 51". How do I delete these columns? Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: How to delete a column after performing join in jsl?

1. You need to read the Scripting Guide.  

     Help==>Scripting Guide

It will show you that columns can be referenced by name or by number in most cases.

2. You need to try things on your own, 

dtx << delete columns(3);

works just fine

Jim

View solution in original post

Jeff_Perkinson
Community Manager Community Manager

Re: How to delete a column after performing join in jsl?

A couple of options here:

 

  1. The Join operation will let you specify which columns to output to the resulting table. That may be easier than trying to clean up afterward. Do the join interactively, selecting the columns to output and then examine the JSL in the Source script for the JSL syntax.
  2. The Delete Columns() message takes a name or column number.
-Jeff

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How to delete a column after performing join in jsl?

Here is code that will do it

dtx = dte << Join(
	With( dtf ),
	By Matching Column( :Y = :Y ),
	Preserve main table order( 1 ),
	output table( "Joined Table" )
);

dtx << delete columns( {"Y of Untitle 50", "Y of Untitled 51"} );

If you used the "Merge Same Name Columns element in the Join Platform, you can simplify the delete code

dtx = dte << Join(
	With( dtf ),
	By Matching Column( :Y = :Y ),
	Preserve main table order( 1 ),
	output table( "Joined Table" ),
	Merge same name columns(1)
);

dtx << delete columns( {"Y"} );
Jim
powerpuff
Level IV

Re: How to delete a column after performing join in jsl?

Thanks for the response @txnelson but is there a way to delete, say for example column number 3 in a table?

txnelson
Super User

Re: How to delete a column after performing join in jsl?

1. You need to read the Scripting Guide.  

     Help==>Scripting Guide

It will show you that columns can be referenced by name or by number in most cases.

2. You need to try things on your own, 

dtx << delete columns(3);

works just fine

Jim
Jeff_Perkinson
Community Manager Community Manager

Re: How to delete a column after performing join in jsl?

A couple of options here:

 

  1. The Join operation will let you specify which columns to output to the resulting table. That may be easier than trying to clean up afterward. Do the join interactively, selecting the columns to output and then examine the JSL in the Source script for the JSL syntax.
  2. The Delete Columns() message takes a name or column number.
-Jeff