BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Highlighted
zjuv007
Contributor

How do I apply filter to a column AND then make just that data go into a New Data Table?

Hi all,

This seems straightforward, but is currently causing me troubles.

 

I have a data set in which one column I'm looking to filter, and instead of manually right clicking the "Selected" rows to do a Data View and generate a new table, I'm wanting to script this action.

 

How do I perform this in script? I've tried the filter function and it does highlight the correct rows which contain the filtered value, but does not generate a brand new table. I would like all of the original columns to come over in this new table.

 

Thank you,

Zach

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How do I apply filter to a column AND then make just that data go into a New Data Table?

Here is a simple piece of code that will create such a subset:  The assumption is that dt is pointing to the data table you want to subset

dt2 = dt << subset( selected rows(1), selected columns(0));

Selected Rows(1) will subset only the rows that are currently selected.

Selected Columns(0) will select all columns, not just selected columns.

You should take the time to read the JSL documentation

     Help==>Books==>Scripting Guide

Jim
2 REPLIES 2
txnelson
Super User

Re: How do I apply filter to a column AND then make just that data go into a New Data Table?

Here is a simple piece of code that will create such a subset:  The assumption is that dt is pointing to the data table you want to subset

dt2 = dt << subset( selected rows(1), selected columns(0));

Selected Rows(1) will subset only the rows that are currently selected.

Selected Columns(0) will select all columns, not just selected columns.

You should take the time to read the JSL documentation

     Help==>Books==>Scripting Guide

Jim
zjuv007
Contributor

Re: How do I apply filter to a column AND then make just that data go into a New Data Table?

Thank you!
0 Kudos