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

Help with updating a text edit box based upon a radio box selection

Hello everyone,

I was hoping someone could help me with this script.  I would like the start date and the report name to update based upon what radio button is selected:

shampton82_0-1678473280625.png

 

 

//rev 3-9-23
names default to here(1);

dtspec="J:\Public\Ti Process Control\Dashboard Files\JMP data for CC's\Limits\Master limits table rev 10-10-22.jmp";



//Get user name
dll = Load DLL( "mpr.dll" );

dll << DeclareFunction(

     "WNetGetUserA",

      Convention( STDCALL ),

      Alias ( "GetUserName" ),

      Arg( UInt8, "format", input ),

      Arg( AnsiString, "username", output ),

      Arg( UInt64, "length", update ),

      Returns( UInt32 )

);

username = "                            ";

unlen = length(username);

result = dll << GetUserName(0, username, unlen);

rbstate="wkly";


/* Create a modal user dialog */
nw1=New Window( "Select Date Range for out of spec",<<Modal,
				/* Arrange display boxes in two columns */
				hlistbox(
						panelbox("data length",
						Lineup Box( N Col( 2 ),
							rb = Radio Box( {"wkly", "mntly", "qtrly", "Custom"},rbstate=rb<<Get Selected;);
							
						)),
							panelbox("set up",
							Lineup Box( N Col( 2 ), Spacing( 10 ),
										/* Prompt for a report title */
										Text Box( "Report Title:" ),
										

										if(rbstate=="wkly",
											teb = Text Edit Box( "WKLY Report "||char(Abbrev Date(today())) );,
												weeksback=1;
											rbstate=="mntly",
											teb = Text Edit Box( "MNTLY Report "||char(Abbrev Date(today())) );,
												weeksback=4;
											rbstate=="qtrly",
											teb = Text Edit Box( "QTRTLY Report "||char(Abbrev Date(today())) );,
												weeksback=13;
											rbstate=="Custom",
											teb = Text Edit Box( "Cust. Report "||char(Abbrev Date(today())) );,
												weeksback=26;
										),
										/* Prompt for start and end dates */
										Text Box( "Start Date:" ),
										Text Box( "End Date:" ),
										/* Number Edit Box with a calendar pop-up */
										nebs = Number Edit Box(
													Today() - In Weeks( weeksback ),
													12,
													<<Set Format( Format( "m/d/y", 12 ) )
										),
										/* Number Edit Box with a calendar pop-up */
										nebe = Number Edit Box(
													(Today()-86400),
													23,
													<<Set Format( Format( "m/d/y", 12 ) )
										),
										cb=Check Box( "Make Project?" ),cb << Set( 1, 1 );,
										/* OK button captures the values */

							))
				,
					vlist box(
						panelbox("spec table",
						text = Text Edit Box( dtspec ),text << Set Wrap( 150 ),text << Get Wrap;
						)
				,
						Button Box( "OK",
									rtitle = teb << Get Text;
									sdate = nebs << Get;
									edate = nebe << Get;
									cbstate=cb<<get;
									fileloc=text<<Get Text();
						)
						)
				)
);


If( nw1["button"] == -1,
Throw( "Cancelled!" );
);

I was thinking I need to use append somehow but not quite sure how to get there.

 

Any help is greatly appreciated.

 

Thanks !

Steve

1 ACCEPTED SOLUTION

Accepted Solutions
shampton82
Level VII

Re: Help with updating a text edit box based upon a radio box selection

So solved my own problem!  Good old scripting index for the win.

 

I had to move the if statement into the radio box and then use the "set" commands to send updated info to the text edit boxes.  Hope this helps someone in the future.

 

							rb = Radio Box( {"wkly", "mntly", "qtrly", "Custom"},
							
											rbstate=rb<<Get Selected;
											if(rbstate=="wkly",
													teb<<set text( "WKLY Report "||char(Abbrev Date(today())) );
													nebs<<set(Today() - In Weeks( 1 ));
												);
											if(rbstate=="mntly",
													teb<<set text( "MNTLY Report "||char(Abbrev Date(today())) );
													nebs<<set(Today() - In Weeks( 4 ));
												);
											if(rbstate=="qtrly",
													teb<<set text( "QTRTLY Report "||char(Abbrev Date(today())) );
													nebs<<set(Today() - In Weeks( 13 ));
												);
											if(rbstate=="Custom",
													teb<<set text( "Cust. Report "||char(Abbrev Date(today())) );
													nebs<<set(.);
												);
													
											
											
								
							);

View solution in original post

1 REPLY 1
shampton82
Level VII

Re: Help with updating a text edit box based upon a radio box selection

So solved my own problem!  Good old scripting index for the win.

 

I had to move the if statement into the radio box and then use the "set" commands to send updated info to the text edit boxes.  Hope this helps someone in the future.

 

							rb = Radio Box( {"wkly", "mntly", "qtrly", "Custom"},
							
											rbstate=rb<<Get Selected;
											if(rbstate=="wkly",
													teb<<set text( "WKLY Report "||char(Abbrev Date(today())) );
													nebs<<set(Today() - In Weeks( 1 ));
												);
											if(rbstate=="mntly",
													teb<<set text( "MNTLY Report "||char(Abbrev Date(today())) );
													nebs<<set(Today() - In Weeks( 4 ));
												);
											if(rbstate=="qtrly",
													teb<<set text( "QTRTLY Report "||char(Abbrev Date(today())) );
													nebs<<set(Today() - In Weeks( 13 ));
												);
											if(rbstate=="Custom",
													teb<<set text( "Cust. Report "||char(Abbrev Date(today())) );
													nebs<<set(.);
												);
													
											
											
								
							);