<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to limit the user entry to 7 digits in NumberEditBox? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750810#M93216</link>
    <description>&lt;P&gt;You can start in this direction.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

last = eon = 0;

New Window( "Only Seven",
	Outline Box( "Enter EON",
		Line Up Box( N Col( 2 ),
			Text Box( "System EON:" ),
			neb = Number Edit Box( eon,
				&amp;lt;&amp;lt; Set Integer Only( 1 ),
				&amp;lt;&amp;lt; Set Minimum( 0 ),
				&amp;lt;&amp;lt; Set Tip( "Enter an integer number with no more than 7 digits")
				&amp;lt;&amp;lt; Set Number Changed(
					Function( { self, number },
						If( Length( Char( number ) ) &amp;gt; 7,
							self &amp;lt;&amp;lt; Set( last ),
							last = number
						);
					);
				)
			)
		)
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 30 Apr 2024 17:57:55 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2024-04-30T17:57:55Z</dc:date>
    <item>
      <title>How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750800#M93214</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ECN = 0,

Text Box( "System ECN:" ),

S1 = Number Edit Box(ECN, &amp;lt;&amp;lt;Set Property( "MaxLength", 7)),

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The user shouldn't be able to enter more than 7 digits. For example: 1234567... the user shouldn't be able to enter 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How did achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 17:32:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750800#M93214</guid>
      <dc:creator>PunitPanjwani</dc:creator>
      <dc:date>2024-04-30T17:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750810#M93216</link>
      <description>&lt;P&gt;You can start in this direction.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

last = eon = 0;

New Window( "Only Seven",
	Outline Box( "Enter EON",
		Line Up Box( N Col( 2 ),
			Text Box( "System EON:" ),
			neb = Number Edit Box( eon,
				&amp;lt;&amp;lt; Set Integer Only( 1 ),
				&amp;lt;&amp;lt; Set Minimum( 0 ),
				&amp;lt;&amp;lt; Set Tip( "Enter an integer number with no more than 7 digits")
				&amp;lt;&amp;lt; Set Number Changed(
					Function( { self, number },
						If( Length( Char( number ) ) &amp;gt; 7,
							self &amp;lt;&amp;lt; Set( last ),
							last = number
						);
					);
				)
			)
		)
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Apr 2024 17:57:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750810#M93216</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2024-04-30T17:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750830#M93220</link>
      <description>&lt;P&gt;Thanks Mark!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I modified the code as shown below, but still no success. Do you think its a big in JMP software?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

last = eon = 0;

New Window( "Only Seven",
    Outline Box( "Enter EON",
        Line Up Box( N Col( 2 ),
            Text Box( "System EON:" ),
            neb = Number Edit Box( eon,
                &amp;lt;&amp;lt; Set Integer Only( 1 ),
                &amp;lt;&amp;lt; Set Minimum( 0 ),
                &amp;lt;&amp;lt; Set Tip( "Enter an integer number with no more than 7 digits")
                &amp;lt;&amp;lt; Set Number Changed(
                    Function( { self, number },
                        If( Length( Char( number ) ) &amp;gt; 7,
                            self &amp;lt;&amp;lt; Set( last ),
                            last = number
                        );
                    );
                ),
                &amp;lt;&amp;lt; Set Max Length(7) // Limit the number of digits to 7
            )
        )
    )
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Apr 2024 20:20:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750830#M93220</guid>
      <dc:creator>PunitPanjwani</dc:creator>
      <dc:date>2024-04-30T20:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750987#M93236</link>
      <description>&lt;P&gt;Where did you find this message:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&amp;lt;&amp;lt; Set Max Length(7) // Limit the number of digits to 7&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I do not see it in the protocol for a Number Edit Box.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 13:42:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750987#M93236</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2024-05-01T13:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750994#M93239</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/55640"&gt;@PunitPanjwani&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a modified&amp;nbsp;&lt;SPAN&gt;version of the example of set number changed() and get number changed() in the Scripting Index. I think this gets you pretty close to your target:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example",
	numBox = Number Edit Box(
		.,
		10,
		&amp;lt;&amp;lt; set number changed(
			Function( { thisBox, value }, /* put my value into my sibling's display */
				if( length( char( value ) ) &amp;gt; 7,
					// &amp;gt; 7 digits
					thisBox &amp;lt;&amp;lt; set( . );
					( thisBox &amp;lt;&amp;lt; sib ) &amp;lt;&amp;lt; settext( "Too many digits" ),
				
					// &amp;lt;= 7 digits
					( thisBox &amp;lt;&amp;lt; sib ) &amp;lt;&amp;lt; settext( char( value ) )
				)
			)
		)
	),
	Text Box( "" )/* here's the sibling box, waiting to show a message */
);
numBox &amp;lt;&amp;lt; get number changed()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 13:52:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/750994#M93239</guid>
      <dc:creator>scott_allen</dc:creator>
      <dc:date>2024-05-01T13:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/751006#M93241</link>
      <description>&lt;P&gt;This version requires the user to commit the changes to the number.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

last = eon = 0;

New Window( "Only Seven",
	Outline Box( "Enter EON",
		Line Up Box( N Col( 2 ),
			Text Box( "System EON:" ),
			neb = Number Edit Box( eon,
				&amp;lt;&amp;lt; Set Integer Only( 1 ),
				&amp;lt;&amp;lt; Set Minimum( 0 ),
				&amp;lt;&amp;lt; Set Tip( "Enter an integer number with no more than 7 digits"),
				&amp;lt;&amp;lt; Set Function(	// called when user commits data entry
					Function( { self },
						new = self &amp;lt;&amp;lt; Get;
						If( Length( Char( new ) ) &amp;gt; 7,
							self &amp;lt;&amp;lt; Set( last ),
							last = new
						);
					);
				)
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 May 2024 13:59:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/751006#M93241</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2024-05-01T13:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/751080#M93244</link>
      <description>&lt;P&gt;There are different ways of doing this and it depends on how you wish your UI to behave:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If user inserts too many numbers, thrown an error message&lt;/LI&gt;
&lt;LI&gt;If user inserts too many numbers, set the value to maximum allowed number&lt;/LI&gt;
&lt;LI&gt;If user inserts too many numbers, set the value to empty value (missing value)&lt;/LI&gt;
&lt;LI&gt;If user inserts too many numbers, set the value to last "valid" value&lt;/LI&gt;
&lt;LI&gt;...&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Then you have to decide when the value should be updated: on commit or on each number change?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below are few options, these can be combined as needed&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Example",
	Lineup Box(N Col(2),
	
		Text Box("Set to max value on COMMIT:"),
		Number Edit Box(
			.
			, 10
			, &amp;lt;&amp;lt; Set Maximum(9999999)
			, &amp;lt;&amp;lt; Set Exclude Maximum(0)
			, &amp;lt;&amp;lt; Set Integer Only(1)
		),
		
		Text Box("Set to last COMMITTED value on COMMIT:"),
		cb = Context Box(
			box:last_val = .;
			Number Edit Box(
				.
				, 10
				, &amp;lt;&amp;lt; Set Function(function({this},
					If((this &amp;lt;&amp;lt; get) &amp;gt;= 10000000,
						this &amp;lt;&amp;lt; set(box:last_val)
					,
						box:last_val = this &amp;lt;&amp;lt; get;
					)
				))
			)
		),
		
		Text Box("Throw on COMMIT"),
		cb = Context Box(
			box:last_val = .;
			Number Edit Box(
				.
				, 10
				, &amp;lt;&amp;lt; Set Function(function({this},
					If((this &amp;lt;&amp;lt; get) &amp;gt;= 10000000,
						this &amp;lt;&amp;lt; set(box:last_val);
						Throw("No values longer than 7 digits allowed");
					,	
						box:last_val = this &amp;lt;&amp;lt; get;
					)
				))
			)
		),
		
		Text Box("Set to last changed value on change and break focus:"),
		cb = Context Box(
			box:last_val = .;
			Number Edit Box(
				.
				, 10
				, &amp;lt;&amp;lt; Set Number Changed(function({this, val},
					If((val) &amp;gt;= 10000000,
						this &amp;lt;&amp;lt; set(box:last_val);
						box:mb &amp;lt;&amp;lt; Set Focus(1); // to break focus from number edit box
					,
						box:last_val = val;
					)
				))
			),
			Unlineup Box(box:mb = Mouse Box());
		)
	)
);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 16:14:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/751080#M93244</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-01T16:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/753516#M93526</link>
      <description>&lt;P&gt;Thank you, Mark!&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 20:33:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/753516#M93526</guid>
      <dc:creator>PunitPanjwani</dc:creator>
      <dc:date>2024-05-10T20:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to limit the user entry to 7 digits in NumberEditBox?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/753517#M93527</link>
      <description>&lt;P&gt;Thank you, Jarmo!&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 20:34:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-limit-the-user-entry-to-7-digits-in-NumberEditBox/m-p/753517#M93527</guid>
      <dc:creator>PunitPanjwani</dc:creator>
      <dc:date>2024-05-10T20:34:05Z</dc:date>
    </item>
  </channel>
</rss>

