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

Script only works when run step-by-step

Names Default to Here(1);

Query = current data table();

Query_piv = (Data Table( "SO Query" ) << Tabulate(
	Add Table(
		Column Table(
			Grouping Columns( :Year, :Week ),
			Analysis Columns( :QTY Ordered )
		),
		Row Table(
			Grouping Columns( :Item, :Item Description, :Channel, :Product Type )
		)
	)
));

Query_tab = Query_piv << Make Into Data Table;

Query_piv << close window;

Col_Start = 5;

Query_tab << group columns("Weeks",column(Col_Start), N cols(Query_tab) - Col_Start + 1);
Col_group = Query_tab << get column group ("Weeks");

Query_stack = Query_tab << Stack(
	columns( Column Group( "Weeks" ) ),
	Output Table( "Stacked History" )
);

I have a set of data (weekly order volume) that I'm tabulating and then stacking.  This script works fine if I run it pieces at a time.  However, when I try to execute it as a whole I get the following error.  Any ideas?

 

Phil_Nash_0-1759866194395.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Script only works when run step-by-step

How big starting table you have? How big tabulate do you end up with? Does the script work properly if use values instead of variables with the group columns?

 

You could try adding data table reference to Column instead of relying on current data table, so use

Column(Query_tab, Col_Start)

Also if Data Table("SO Query") is same as Query = Current Data Table(), I would replace it with dt to make it more robust.

-Jarmo

View solution in original post

5 REPLIES 5
hogi
Level XIII

Re: Script only works when run step-by-step

try 

Query_tab = Query_piv << Make Into Data Table;
wait(0);

The issue may be caused by JMP performing the grouping action before the data table has been populated.

Phil_Nash
Level II

Re: Script only works when run step-by-step

I tried wait there.. I also tried it after Col_start = 5.  No luck.

hogi
Level XIII

Re: Script only works when run step-by-step

Hmm, I cannot reproduce the issue with some dummy data. It might be a timing issue, but why doesn't wait(0) work?

 

You could skip the grouping step and use the column references directly as input for Stack.
Remove from() to start with column #5.

 

Query_tab = obj << Make Into Data Table;
cols = Query_tab  << get column references;
Remove From( cols, 1, 4 );

Query_tab << Stack( columns( cols ) ) ;

 

jthi
Super User

Re: Script only works when run step-by-step

How big starting table you have? How big tabulate do you end up with? Does the script work properly if use values instead of variables with the group columns?

 

You could try adding data table reference to Column instead of relying on current data table, so use

Column(Query_tab, Col_Start)

Also if Data Table("SO Query") is same as Query = Current Data Table(), I would replace it with dt to make it more robust.

-Jarmo
Phil_Nash
Level II

Re: Script only works when run step-by-step

Adding the table reference solved the problem.  Thanks!!

Recommended Articles