Subscribe Bookmark RSS Feed

How to ask title or other text to Journal in Dialog?

sami_hokkanen

New Contributor

Joined:

Aug 30, 2016

I have been doing a script that asks from user which two columns from original data will be chosen for Journal. I have manage to do that (see the code) but I want to add also item for input dialog where you could put any text that will appear later in the Journal (preferable before table). I do not know how to add "user can write text" option in dialog nor how to "print" that text later in Journal. I know that with 

Current Journal () << Append (TextEditBox("Change Me"));

you can add text to Journal but I want to ask the text with same time as "which two columns to choose" dialog.

 

You can try this script with any data table but I also attached one very simple table with two columns.

  

dt = Current Data Table();

If( Is Empty( dt ),
	dt = Open()
);

DraftTabl = Current Data Table() ;//<< Get Name;

col_name_list = dt << get column names( string );
Show( col_name_list );

dialogA = Empty();
If( Contains( col_name_list, "A" ),
	dialogA = Column( "A" )
);
dialogB = Empty();
If( Contains( col_name_list, "B" ),
	dialogB = Column( "B" )
);

// Dialog to choose column roles, ...
dlg = Column Dialog(
	ACol = Col List( "A param",
		Min Col( 1 ),
		Max Col( 1 ),
		Columns( dialogA )
	),
	BCol = Col List( "B param",
		Min Col( 1 ),
		Max Col( 1 ),
		Columns( dialogB )
	)
);
// I want to add here item for input where you could put any text that will show later in Journal

Show( dlg["Button"] );
If( dlg["Button"] == -1,
	Throw()
);

Remove From( dlg );
Eval List( dlg );
ACol = ACol[1] << get name;
BCol = BCol[1] << get name;


DT = Data Table(DraftTabl) <<
	Subset(
		columns (	Column(ACol), 
					Column(BCol),
				),
		Output Table Name("Draft_table")
		)
;

Data Table("Draft_Table") << Journal;

 

Thank you in advance for any hint.

 

 

 

1 REPLY
ian_jmp

Staff

Joined:

Jun 23, 2011

Try 'Help > Scripting Index' and seraching for 'Column Dialog'. I added 'Edit Text()' to the example given to get the code below.

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Consumer Preferences.jmp" );
Column Dialog(
	ex y = ColList( "Y",
		Min Col( 1 ),
		Max Col( 2 ),
		Data Type( "Numeric" )
	),
	ex x = ColList( "X",
		Max Col( 1 ),
		Modeling Type( {"Continuous", "Multiple Response"} )
	),
	Line Up( 2,
		Text Box( "Alpha" ), ex = EditNumber( .05 ),
		Text Box( "Beta" ), ey = EditText( "xyz" )
	),
	HList( cb = Check Box( "check", 1 ) ),
	HList( combo = Combo Box( "option1", "option2" ) ),
	HList( rb = RadioButtons( "a", "b" ) ),
	HList( et = EditText( "Edit Me" ) )
);