cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Alex19
Level III

Combine Data by Row

Hello, 

I am trying to do the following:

Given Product Column and Lot Column, I need to create "Lots in Product" Column so that it combines all the "lots' based on the same product.

Alex19_0-1733840030799.png

The final purpose is to get the Tabulate:

Alex19_1-1733840281096.png

The X1, X2, X3, X4 does not have to be present in the single cell, this will work as well (whichever is easier):

Alex19_2-1733840342515.png

Manually this process is insane when I have a table of thousands of datapoints.

Thank you so much!

JMP table is attached.

Alex.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jackie_
Level VII

Re: Combine Data by Row

Here is one way

 

Names Default To Here(1);

dt = Current Data Table();	

custom_sql = Eval Insert(
"\[SELECT Product, GROUP_CONCAT(DISTINCT CAST("Lot" as TEXT)) as "Lots in Product"
FROM t1
GROUP BY Product
]\");

dt_concat = Query(
	Table(dt, "t1"),
	custom_sql
);

New window("Tablebox",<<Type("Dialog"),
Data Table Box( dt_concat ));

View solution in original post

4 REPLIES 4
hogi
Level XIII

Re: Combine Data by Row

Very common question.

There are a lot of tricks and workarounds.

 

In a future version of JMP it will be very easy:

:folded_hands: Summary and Tabulate: add aggregation option for Character columns 
... if enough users follow the link and vote.

Jackie_
Level VII

Re: Combine Data by Row

Here is one way

 

Names Default To Here(1);

dt = Current Data Table();	

custom_sql = Eval Insert(
"\[SELECT Product, GROUP_CONCAT(DISTINCT CAST("Lot" as TEXT)) as "Lots in Product"
FROM t1
GROUP BY Product
]\");

dt_concat = Query(
	Table(dt, "t1"),
	custom_sql
);

New window("Tablebox",<<Type("Dialog"),
Data Table Box( dt_concat ));
hogi
Level XIII

Re: Combine Data by Row

another one:

dt = Current Data Table();
dt << New Column( "rank", Formula( Col Rank( 1, :Product ) ), );

dtsplit = dt << Split(
	Split By( :rank ),
	Split( :Lot ),
	Group( :Product ),
	Remaining Columns( Drop All ), 

);

cols = dt split << get column names();
cols = cols[2 :: N Items( cols )];

dt split << New Column( "concat", Character, Set Each value( Concat Items( cols, "," ) ) );

dt << Update(
	With( dt split),
	Match Columns( :Product = :Product ),
	Add Columns from Update Table( :concat ),
	Replace Columns in Main Table( None )
);
Alex19
Level III

Re: Combine Data by Row

Works beautifully! Thank you!

Recommended Articles