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

Entering dates into data table from dialog box

 

I'm looking to enter a date into a specific row in a data table after the user inputs it from a dialog box (ex: into row 5). Is there a way to do this?

 

Thanks

 

Names default to Here(1);
dt = New Table( "Untitled", 
						New Column( "Date 1", Numeric, "Continuous", Format( "yyyy-mm-dd", 12 )),
						New Column( "Date 2", Numeric, "Continuous", Format( "yyyy-mm-dd", 12 )),
);



q = New Window( "Enter Dates",		// Window for entering dates 
		Spacer Box( size(500, 30)), 
    H List Box(
		Spacer Box(Size(100, 10)),
		V list box (
		    Spacer Box(Size(10, 15)),
            Text Box("Enter Dates (yyyy-mm-dd)"),
            Spacer Box(Size(10, 20)),
			Text Box("Enter Date 1"),
			Spacer Box(Size(10,10)),
			fontobj = da =  Number Edit box(),
				da << Set Format( Format("yyyy-mm-dd", 12)),
				da << Set (Date MDY ( 12, 31, 2000)),
			Spacer Box(Size(10,10)),
			Text Box("Enter Date 2"),
			Spacer Box(Size(10,10)),
			fontobj = db =  Number Edit box(),
				db << Set Format( Format("yyyy-mm-dd", 12)),
				db << Set (Date MDY ( 12, 31, 2000)),
        ),
    ),
    Button Box( "Continue",
		
		//code for adding dates to data table
		
		q <<closewindow;
	)
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Entering dates into data table from dialog box

Here is a modification to your code to handle both the text input of date, and the numeric input of date.  Also note that one has to add rows to the data table before they can be populated.

Names Default To Here( 1 );
dt = New Table( "Untitled",
	New Column( "Date 1", Numeric, "Continuous", Format( "yyyy-mm-dd", 12 ) ),
	New Column( "Date 2", Numeric, "Continuous", Format( "yyyy-mm-dd", 12 ) ),

);
dt << add rows( 1 );



q = New Window( "Enter Dates", 		// Window for entering dates 
	Spacer Box( size( 500, 30 ) ),
	H List Box(
		Spacer Box( Size( 100, 10 ) ),
		V List Box(
			Spacer Box( Size( 10, 15 ) ),
			Text Box( "Enter Dates (yyyy-mm-dd)" ),
			Spacer Box( Size( 10, 20 ) ),
			Text Box( "Enter Date 1" ),
			Spacer Box( Size( 10, 10 ) ),
			fontobj = da = Number Edit Box(),
			da << Set Format( Format( "yyyy-mm-dd", 12 ) ),
			da << Set( Date MDY( 12, 31, 2000 ) ),
			Spacer Box( Size( 10, 10 ) ),
			Text Box( "Enter Date 2" ),
			Spacer Box( Size( 10, 10 ) ),
			fontobj2 = db2 = Number Edit Box(),
			db2 << Set Format( Format( "yyyy-mm-dd", 12 ) ),
			db2 << Set( Date MDY( 12, 31, 2000 ) ),

		),

	),
	Button Box( "Continue",
		dt:Date1[1] = da << get;
		dt:Date2[1] = Informat( db2 << get text, "yyyy-mm-dd" );
		//code for adding dates to data table
		
		q << closewindow;
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Entering dates into data table from dialog box

Here is a modification to your code to handle both the text input of date, and the numeric input of date.  Also note that one has to add rows to the data table before they can be populated.

Names Default To Here( 1 );
dt = New Table( "Untitled",
	New Column( "Date 1", Numeric, "Continuous", Format( "yyyy-mm-dd", 12 ) ),
	New Column( "Date 2", Numeric, "Continuous", Format( "yyyy-mm-dd", 12 ) ),

);
dt << add rows( 1 );



q = New Window( "Enter Dates", 		// Window for entering dates 
	Spacer Box( size( 500, 30 ) ),
	H List Box(
		Spacer Box( Size( 100, 10 ) ),
		V List Box(
			Spacer Box( Size( 10, 15 ) ),
			Text Box( "Enter Dates (yyyy-mm-dd)" ),
			Spacer Box( Size( 10, 20 ) ),
			Text Box( "Enter Date 1" ),
			Spacer Box( Size( 10, 10 ) ),
			fontobj = da = Number Edit Box(),
			da << Set Format( Format( "yyyy-mm-dd", 12 ) ),
			da << Set( Date MDY( 12, 31, 2000 ) ),
			Spacer Box( Size( 10, 10 ) ),
			Text Box( "Enter Date 2" ),
			Spacer Box( Size( 10, 10 ) ),
			fontobj2 = db2 = Number Edit Box(),
			db2 << Set Format( Format( "yyyy-mm-dd", 12 ) ),
			db2 << Set( Date MDY( 12, 31, 2000 ) ),

		),

	),
	Button Box( "Continue",
		dt:Date1[1] = da << get;
		dt:Date2[1] = Informat( db2 << get text, "yyyy-mm-dd" );
		//code for adding dates to data table
		
		q << closewindow;
	)
);
Jim
EMB
EMB
Level I

Re: Entering dates into data table from dialog box

Thanks!