Subscribe Bookmark RSS Feed

Naming subsets in JSL

theo_beluzzi

Community Trekker

Joined:

Mar 8, 2016

Hi!

I have a large dt, and want do make subsets from a column. I've managed to do it, but the subsets have all the columns locked. How I can unlock them in the code?

Also, how can I specify it's names, so I can work with those later?

dt2 << (Subset(

                   By( :Filial ),

                           Selected Rows( 0 ),

                           columns( :Cod. Cliente DPK,

                                         :Desc. Município Cadastro,

                                         :Desc. Cliente,

                                         :Desc. Tipo Cliente N1,

                                         :Desc. Tipo Cliente N2,

                                         :Name( "Sum(Vlr. Venda Comercial)" ),

                                         :Name( "Sum(Vlr. Lucro Bruto)" ),

                                         :Mg Bruta

  )));

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Depending on what you want to happen next, there may be a better way to do what you have in mind (maybe using a data filter instance). But, if you want or need to use 'subset', try something like:

Names Default To Here( 1 );

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dts = dt << subset(By(:sex), Columns(:name, :age)); // Using 'By' makes a subset table for each level in the hspecified column. 'dts' is a list of associated table references

// Change the names of the subset tables

dts[1] << setName("Females");

dts[2] << setName("Males");

2 REPLIES
Solution

Depending on what you want to happen next, there may be a better way to do what you have in mind (maybe using a data filter instance). But, if you want or need to use 'subset', try something like:

Names Default To Here( 1 );

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dts = dt << subset(By(:sex), Columns(:name, :age)); // Using 'By' makes a subset table for each level in the hspecified column. 'dts' is a list of associated table references

// Change the names of the subset tables

dts[1] << setName("Females");

dts[2] << setName("Males");

theo_beluzzi

Community Trekker

Joined:

Mar 8, 2016

Ooh, that's great!

I just want to break the original dt in others, and work with each in different ways... That's the best way of doing the separation?

Another question: when working with each of the subsetted tables, how i specify them? By dts1, dts2, etc.? Or I can also determine that?