cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
drew_baumgartel
Level III

Value label not preserved in journal

I have a script that uses the bivariate platform to produce a plot of data over discrete time units (e.g. 202101 for 1st week of 2021). The time units used are not negotiable and do not space correctly if treated as continuous: the distance between 202052 and 202101 will not be the same as the distance between 202101 and 202102, but these distances should be the same as they are consecutive weeks. My solution was to create a "Sequence" column with values 1,2,3,... and pair it with 202052, 202101, 202102, .... , and apply value labels to the "Sequence" column (1 has value label 202052, 2 has value label 202101, 3 has value label 202102) then use the "Sequence" column as the X in Fit Y by X. This solution works beautifully, except when I journal the output: the value labeling doesn't hold and the plot in the journal reverts to the original values in the Sequence column instead of using the value labels. Every once in a while, the value labels do transfer to the journal, but after I save and re-open, the x-axis values have reverted to the original values. I believe the difference is using script or ctrl + J to journal (value labels preserved temporarily) vs copy --> paste to journal (value labels not preserved).

 

I might be able to find another way to do this, or perhaps someone can suggest another way, but I'm more interested in knowing if value labels not transferring from a report window to a journal is the intended JMP behavior. Can this behavior change in future versions of JMP?

 

I'm using JMP Pro 14.3.0. I've confirmed the issue also occurs in JMP Pro 15.2.1. Below is an example script that re-creates the issue.

 

// Data Table
dt = New Table( "Label Example",
	Add Rows( 6 ),
	New Column( "Week", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [202052, 202052, 202101, 202101, 202102, 202102] ) ),
	New Column( "Sequence", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 1, 2, 2, 3, 3] ) ),
	New Column( "Value", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [12, 39, 9, 1, 22, 9] ) ),
	New Column( "Group", Character, "Nominal", Set Values( {"A", "B", "A", "B", "A", "B"} ) )
);

week_list = :Week << get values;
sequence_list = :Sequence << get values;

week_list_names = {};

// Build the Value Labels List
For( i = 1, i <= N Items( week_list ), i++,
	If( !Contains( week_list_names, Parse( "\!"" || Char( sequence_list[i] ) || "\!" = \!"" || Char( week_list[i] ) || "\!"" ) ),
		Insert Into( week_list_names, Parse( "\!"" || Char( sequence_list[i] ) || "\!" = \!"" || Char( week_list[i] ) || "\!"" ) )
	)
);

:Sequence << Data Type( Character );
:Sequence << Value Labels( week_list_names );
:Sequence << Data Type( Numeric ) << Modeling Type( Continuous );

value_by_week = Bivariate(
	Y( :Value ),
	X( :Sequence ),
	Fit Where( :Group == "A", Fit Each Value( {Line Color( {212, 73, 88} )} ) ),
	Fit Where( :Group == "B", Fit Each Value( {Line Color( {66, 112, 221} )} ) ),
	SendToReport(
		Dispatch( {}, "Bivariate Fit of Value By Sequence", OutlineBox, {Set Title( "Bivariate Fit of Value By Sequence" )} ),
		Dispatch( {}, "1", ScaleBox, {Inc( 1 ), Minor Ticks( 0 ), Label Row( Show Major Grid( 1 ) ), Label Row( Label Orientation( "Angled" ) )} ),
		Dispatch( {}, "2", ScaleBox, {Inc( 10 ), Minor Ticks( 5 ), Label Row( Show Major Grid( 1 ) )} ),
		Dispatch( {}, "Sequence", TextEditBox, {Set Text( "Week" )} )
	)
);

value_by_week_rep = value_by_week << Report;
my_jrn = New Window( "Test Journal", <<Journal );
value_by_week_rep << Journal;

// Now save journal and re-open. Value labels are gone.
1 ACCEPTED SOLUTION

Accepted Solutions
stan_koprowski
Community Manager Community Manager

Re: Value label not preserved in journal

Hi @drew_baumgartel,

I see the same behavior when using your example script.

However, I was able to see the value labels if you go to the red triangle and select rerun in new window.

Rerun in new windowRerun in new window   results after rerunning in new windowresults after rerunning in new window

 

cheers,

Stan

View solution in original post

4 REPLIES 4
stan_koprowski
Community Manager Community Manager

Re: Value label not preserved in journal

Hi @drew_baumgartel,

I see the same behavior when using your example script.

However, I was able to see the value labels if you go to the red triangle and select rerun in new window.

Rerun in new windowRerun in new window   results after rerunning in new windowresults after rerunning in new window

 

cheers,

Stan

drew_baumgartel
Level III

Re: Value label not preserved in journal

Interesting! I never would have thought to try that, but "rerun in new window" works for me as well. I'm glad that the issue is fixed in JMP 16. This is an acceptable workaround until I get around to installing it. Thank you for sharing.

txnelson
Super User

Re: Value label not preserved in journal

I replicated your error in JMP 15.2.  It appears to be fixed in JMP 16.

Jim
pauldeen
Level VI

Re: Value label not preserved in journal

You could choose to extract the year and week values from your x-column and convert it to timestamp. Then if you throw it on the x-axis it will automatically space correctly and if you play with the formating of the x-axis you can get it to show dates however you like.