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
HSS
HSS
Level V

Add one more column based on condition and grouping on other columns

Hello All,
Happy new year, 
I stuck at another place, have idea/logic but not able to put into correct formula. Please see the attached image for description. Sample data is also attached.

HSS_1-1641371240772.png

 

 

Any help?
Many thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
frank_wang
Level IV

Re: Add one more column based on condition and grouping on other columns

Hi HSS

I think there are 3 steps need to do to get your want.

1.  Summarize your data table to map. Index is 'sensor' and Values are 'max(Inlet), max(Reture)'. 

//You can use below JSL to summarzie a new data table

Data Table( "Data" ) << Summary(
	Group( :Sensor ),
	Max( :Occurrence ),
	Subgroup( :Name( "Sub-Sensor" ) ),
	Freq( "None" ),
	Weight( "None" ),
	statistics column name format( "column" )
);

2. Input your conditions by if or match. Here I used If and create a new column in summary data table.

If(
	:Name( "Occurrence, Inlet" ) >= 2 & :Name( "Occurrence, Return" ) >= 2, "Both",
	:Name( "Occurrence, Inlet" ) >= 2 & :Name( "Occurrence, Return" ) < 2, "Inlet",
	:Name( "Occurrence, Inlet" ) < 2 & :Name( "Occurrence, Return" ) >= 2, "Return",
	"Empty"
);

3. Join two data table together by 'Sensor' and make sure column' result ' include. Then use condition if to make it real.

// Join summary data table to original data table

Data Table( "Data" ) << Join(
	With( Data Table( "Data By (Sensor)" ) ),
	Select(
		:ID,
		:Sensor,
		:Name( "Sub-Sensor" ),
		:Occurrence,
		:Required Column,
		:Name( "Required Column -Cause" )
	),
	SelectWith( :Result ),
	By Matching Columns( :Sensor = :Sensor ),
	Drop multiples( 0, 0 ),
	Include Nonmatches( 0, 0 ),
	Preserve main table order( 1 )
);

// add formula in column 'Required Column -Cause' as below

If(
	:Name( "Sub-Sensor" ) == "Inlet" & :Result == "Inlet", "Inlet",
	:Name( "Sub-Sensor" ) == "Return" & :Result == "Return", "Return",
	:Name( "Sub-Sensor" ) == "Inlet" | :Name( "Sub-Sensor" ) == "Return" & :Result == "Both", "Both",
	""
);
心若止水

View solution in original post

2 REPLIES 2
frank_wang
Level IV

Re: Add one more column based on condition and grouping on other columns

Hi HSS

I think there are 3 steps need to do to get your want.

1.  Summarize your data table to map. Index is 'sensor' and Values are 'max(Inlet), max(Reture)'. 

//You can use below JSL to summarzie a new data table

Data Table( "Data" ) << Summary(
	Group( :Sensor ),
	Max( :Occurrence ),
	Subgroup( :Name( "Sub-Sensor" ) ),
	Freq( "None" ),
	Weight( "None" ),
	statistics column name format( "column" )
);

2. Input your conditions by if or match. Here I used If and create a new column in summary data table.

If(
	:Name( "Occurrence, Inlet" ) >= 2 & :Name( "Occurrence, Return" ) >= 2, "Both",
	:Name( "Occurrence, Inlet" ) >= 2 & :Name( "Occurrence, Return" ) < 2, "Inlet",
	:Name( "Occurrence, Inlet" ) < 2 & :Name( "Occurrence, Return" ) >= 2, "Return",
	"Empty"
);

3. Join two data table together by 'Sensor' and make sure column' result ' include. Then use condition if to make it real.

// Join summary data table to original data table

Data Table( "Data" ) << Join(
	With( Data Table( "Data By (Sensor)" ) ),
	Select(
		:ID,
		:Sensor,
		:Name( "Sub-Sensor" ),
		:Occurrence,
		:Required Column,
		:Name( "Required Column -Cause" )
	),
	SelectWith( :Result ),
	By Matching Columns( :Sensor = :Sensor ),
	Drop multiples( 0, 0 ),
	Include Nonmatches( 0, 0 ),
	Preserve main table order( 1 )
);

// add formula in column 'Required Column -Cause' as below

If(
	:Name( "Sub-Sensor" ) == "Inlet" & :Result == "Inlet", "Inlet",
	:Name( "Sub-Sensor" ) == "Return" & :Result == "Return", "Return",
	:Name( "Sub-Sensor" ) == "Inlet" | :Name( "Sub-Sensor" ) == "Return" & :Result == "Both", "Both",
	""
);
心若止水
HSS
HSS
Level V

Re: Add one more column based on condition and grouping on other columns

Thanks Frank.

It worked.

Recommended Articles