Subscribe Bookmark RSS Feed

How to refer to a column that was selected in a window but is made into a new data table.

alexhemmert1

Community Trekker

Joined:

Mar 17, 2016

The script below creates a window that the user must select the specific columns that hold each specific map shapes for the vehicle. From there the script is set up to select only the data points that are represented in each of the columns and make a new data table (dt1,dt2 and dt3). The problem that I'm having is that I want to use the column selected in the first window on dt as a reference in dt1 to graph that column. Does anyone know how to reference the window selected column in a linked data table?

 

 

dt = Current Data Table();
If( Is Empty( dt ),
	Try( dt = Open(), Throw( "No data table found" ) )
);

nc = N Col( dt );
lbWidth = 200;

custdial = New Window( "Type C Report",
	H List Box(
		H List Box(
			Panel Box( "Select Columns", colListData = Col List Box( All, width( lbWidth ), nLines( Min( nc, 10 ) ) ) ), 
			
			V List Box(
				Panel Box( "Left Side of Vehicle Column",
					Lineup Box( N Col( 2 ), Spacing( 3 ),
						Button Box( "Left", colListL << Append( colListData << GetSelected ) ),
						colListL = Col List Box( width( lbWidth ), minitems( 1 ), maxitems( 1 ), nLines( 1 ) )
					)
				), 
						
				Panel Box( "Right Side of Vehicle Column",
					Lineup Box( N Col( 2 ), Spacing( 3 ),
						Button Box( "Right", colListR << Append( colListData << GetSelected ) ),
						colListR = Col List Box( width( lbWidth ), minitems( 1 ), maxitems( 1 ), nLines( 1 ) )
					)
				),
				Panel Box( "Top of Vehicle Column",
					Lineup Box( N Col( 2 ), Spacing( 3 ),
						Button Box( "Top", colListT << Append( colListData << GetSelected ) ),
						colListT = Col List Box( width( lbWidth ), minitems( 1 ), maxitems( 1 ), nLines( 1 ) )
					)
				)
			),

		),
		Panel Box( "Action",
			Lineup Box( N Col( 1 ),
				Button Box( "OK", OKScript ),
				Button Box( "Cancel",
					custdial << CloseWindow;
					Throw();
				), 
				
			)
		)                             					// End of HListBox
	) //end vlist box
);


OKScript = Expr(
	custdial << CloseWindow;

//get the columm list a = colListX; dt = Current Data Table(); dt << Clear Row States; dt << Select Where( :Measurement Location == "Top" ); dt1 = dt << Data View; dt1 << Set Name( "Vehicle Top" ); r = dt1 << Select Where( :ED Pass Rate == "5. Point Not Measured" ); r << Hide and Exclude;

//this line is where the code has a problem graph1 = dt1 << Graph Builder( Size( 873, 719 ), Show Legend( 0 ), Legend Position( "Bottom" ), Variables( Color( :ED Pass Rate ), Shape( :Name( "a" ) ) ), Elements( Map Shapes( Legend( 2 ), Show Missing Shapes( 1 ), Aspect Ratio( 1.02565192625141 ) ) ), SendToReport( Dispatch( {}, "", ScaleBox, {Label Row( Show Major Labels( 0 ) )} ), Dispatch( {}, "", ScaleBox( 2 ), {Min( 10.4984925982116 ), Max( 89.7351316066539 ), Inc( 10 ), Minor Ticks( 0 ), Label Row( Show Major Labels( 0 ) )} ), Dispatch( {}, "graph title", TextEditBox, {Hide( 1 )} ), Dispatch( {}, "Y title", TextEditBox, {Hide( 1 )} ) ) ); TopEDV = Report( graph1 )[Picture Box( 1 )]; TopEDV << save picture( "S:\Material Quality\_Chemicals\Quality Assurance\Paint Film Build\Film Build Data Requests\04 Type C Audit\Working File\Top ED Vehicle.jpeg", jpeg ); );

 

 

1 REPLY
uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

@alexhemmert1
       Not sure if I understood the question completely , but maybe you can try this ? 

dt = Current Data Table() ; 
SelCol = dt << Get Selected Columns(); 

SelCol will have the name of the column for the column you have selected in dt which you can use . 

 

Note : There doesnt seem to be any text highlighted in red - so not sure exactly which fragment of code gave you a problem 

 

Best 

uday