Subscribe Bookmark RSS Feed

Tabulate a variable column list

Highlighted
MuttonChops

Occasional Contributor

Joined:

Mar 30, 2017

I am using the following to generate a column list, which varies but always has an "X_Clean" in the name:

col_list = dt<<get column names(string);
	for(i=nitems(col_list), i>0, i--,
		if(!contains(col_list[i], "X_Clean"),
				remove from(col_list, i);
		)
);

Now I'm trying to create a tabulate box but I'm unsure how to reference this col_list in the Analysis Columns.  

dtLUB= vlistbox(dt<< Tabulate(
	Change Item Label( Statistics( Max, " " ) ),
	Show Control Panel( 0 ),
	Add Table(
		Column Table( Analysis Columns( :Date ), Statistics( Max ) ),
		Column Table(
			Analysis Columns(
Need to insert col_list here somehow
			),
			Statistics( Max )
		),
		Row Table( Grouping Columns( :Entity) )
	),
	SendToReport(
		Dispatch(
			{},
			"Tabulate",
			OutlineBox,
			{Set Title( "PM Counter Summary as of: "|| TimeStamp )}
		)
	),
));
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

This should work

dtLUB= vlistbox(dt<< Tabulate(
	Change Item Label( Statistics( Max, " " ) ),
	Show Control Panel( 0 ),
	Add Table(
		Column Table( Analysis Columns( :Date ), Statistics( Max ) ),
		Column Table(
			Analysis Columns(
				eval( col_list )
			),
			Statistics( Max )
		),
		Row Table( Grouping Columns( :Entity) )
	),
	SendToReport(
		Dispatch(
			{},
			"Tabulate",
			OutlineBox,
			{Set Title( "PM Counter Summary as of: "|| TimeStamp )}
		)
	),
));
Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

This should work

dtLUB= vlistbox(dt<< Tabulate(
	Change Item Label( Statistics( Max, " " ) ),
	Show Control Panel( 0 ),
	Add Table(
		Column Table( Analysis Columns( :Date ), Statistics( Max ) ),
		Column Table(
			Analysis Columns(
				eval( col_list )
			),
			Statistics( Max )
		),
		Row Table( Grouping Columns( :Entity) )
	),
	SendToReport(
		Dispatch(
			{},
			"Tabulate",
			OutlineBox,
			{Set Title( "PM Counter Summary as of: "|| TimeStamp )}
		)
	),
));
Jim
MuttonChops

Occasional Contributor

Joined:

Mar 30, 2017

Thanks Jim!