<?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: Possible to change a single value in a string col box() list? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605890#M80812</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;. &amp;nbsp;I like your idea as well. &amp;nbsp;Just goes to show there's more than one way to skin a cat.&lt;/P&gt;&lt;P&gt;-nikles&lt;/P&gt;</description>
    <pubDate>Mon, 27 Feb 2023 17:03:01 GMT</pubDate>
    <dc:creator>nikles</dc:creator>
    <dc:date>2023-02-27T17:03:01Z</dc:date>
    <item>
      <title>Possible to change a single value in a string col box() list?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605405#M80784</link>
      <description>&lt;P&gt;Hi. &amp;nbsp;I'm wondering if there's a way to update a single item in a string col box()? &amp;nbsp;For example, is there a command like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;scb = StringColBox("title", mylist);
scb &amp;lt;&amp;lt; Set Item(i,  "newvalue");    //is there a cmd like this?&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have a window with a string col box, and I would like my script to update a single value. &amp;nbsp;My current method:&lt;/P&gt;&lt;P&gt;1. Get the entire list from the string col box&lt;/P&gt;&lt;P&gt;2. Modify the list&lt;/P&gt;&lt;P&gt;3. Write the list back to the string col box.&lt;/P&gt;&lt;P&gt;This works, but can be slow for large lists. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The string col box() display object has both a "Set" and "Set Values" command, but both appear to set the entire list. &amp;nbsp;Perhaps there's another trick one can use to change individual items though?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JMP Pro 17.0.0&lt;/P&gt;&lt;P&gt;Mac OS Ventura 13.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:33:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605405#M80784</guid>
      <dc:creator>nikles</dc:creator>
      <dc:date>2023-06-08T16:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to change a single value in a string col box() list?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605467#M80789</link>
      <description>&lt;P&gt;There are Delete Row and Insert Row options available for the Table Box, which might be able to help you.&amp;nbsp; If there is more thatan one column in the table box, it can become complex, keeping track of all of the columns in the table box&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "test", 
	tb = Table Box( 
		String Col Box( "string col", {"a", "b", "c", "d"} ) 
	) 
);
Wait( 5 );
tb &amp;lt;&amp;lt; delete row( 2 );
tb &amp;lt;&amp;lt; insert row( 2, {"x"} );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Feb 2023 02:40:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605467#M80789</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-02-25T02:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to change a single value in a string col box() list?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605484#M80790</link>
      <description>&lt;P&gt;I don't think you can set single values in String Col Box (at least not easily).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on your application, using Data Table Box could be an option&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

Names Default To Here(1);
dt = New Table("BOX", 
	New Column("SCB_VALS", Character, Nominal, Values({"A","B","C"}))
	, private
);

nw = New Window("Example",
	window:dt = dt,
	dtb = Data Table Box(dt)
);
nw &amp;lt;&amp;lt; On Close(function({this},
	Close(this:dt, no save);
));

wait(1);
dt[1,1] = "D";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could also build string col box using Col Box and Text Boxes.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 07:32:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605484#M80790</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-02-25T07:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to change a single value in a string col box() list?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605521#M80793</link>
      <description>&lt;P&gt;Here is a complete example of changing single values&amp;nbsp; in a String Col Box() and in a Number Col Box()&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1677330831430.png" style="width: 530px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/50484i7D901F8731408C99/image-dimensions/530x724?v=v2" width="530" height="724" role="button" title="txnelson_0-1677330831430.png" alt="txnelson_0-1677330831430.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dtData = Open( "$SAMPLE_DATA/big class.jmp", private );
dt = New Table( "hidden", private, New Column( "theRow", set values( Index( 1, N Rows( dtData ) ) ) ) );
dt &amp;lt;&amp;lt; update( with( dtData ) );
Close( dtData, nosave );

numberList = As List( Column( dt, 1 ) &amp;lt;&amp;lt; get values );
For Each( {value, i}, numberList, numberList[i] = Char( value ) );

nw = New Window( "Example",
	H List Box(
		myTable = Table Box(
			c0 = Number Col Box( "", Column( dt, 1 ) &amp;lt;&amp;lt; get values ),
			c1 = String Col Box( Column( dt, 2 ) &amp;lt;&amp;lt; get name, Column( dt, 2 ) &amp;lt;&amp;lt; get values ),
			c2 = Number Col Box( Column( dt, 3 ) &amp;lt;&amp;lt; get name, Column( dt, 3 ) &amp;lt;&amp;lt; get values ),
			c3 = String Col Box( Column( dt, 4 ) &amp;lt;&amp;lt; get name, Column( dt, 4 ) &amp;lt;&amp;lt; get values ),
			c4 = Number Col Box( Column( dt, 5 ) &amp;lt;&amp;lt; get name, Column( dt, 5 ) &amp;lt;&amp;lt; get values ),
			c5 = Number Col Box( Column( dt, 6 ) &amp;lt;&amp;lt; get name, Column( dt, 6 ) &amp;lt;&amp;lt; get values )
		),
		Panel Box( "Change Values",
			H List Box(
				cb1 = Combo Box( {"Name", "Age", "Sex", "Height", "Weight"} ),
				cb2 = Combo Box( numberList ),
				teb = Text Edit Box( "", &amp;lt;&amp;lt;set width( 80 ) ),
				changeBox = Button Box( "Change Value",
					theColumn = cb1 &amp;lt;&amp;lt; get text;
					theRow = Num( cb2 &amp;lt;&amp;lt; get text );
					If( Contains( {"Name", "Sex"}, theColumn ),
						theValue = teb &amp;lt;&amp;lt; get text,
						theValue = Num( teb &amp;lt;&amp;lt; get text )
					);
					Column( dt, theColumn )[theRow] = theValue;
					newValues = dt[theRow, 0];
					myTable &amp;lt;&amp;lt; delete row( theRow );
					Eval(
						Parse(
							"myTable &amp;lt;&amp;lt; insert row(" || Char( theRow ) || ", " || Char( newValues ) || ");"
						)
					);
				)
			)
		)
	)
);
nw &amp;lt;&amp;lt; on close( Close( dt, nosave ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 13:14:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605521#M80793</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-02-25T13:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to change a single value in a string col box() list?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605889#M80811</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;.&amp;nbsp; That's cool. &amp;nbsp;I've never seen the Data Table Box() function before. &amp;nbsp;It appears that instead of writing data to display boxes, you just write it to a data table and the window updates automatically. &amp;nbsp;This opens a lot of doors for me. &amp;nbsp; &amp;nbsp;Excellent.&lt;/P&gt;&lt;P&gt;-nikles&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 16:58:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605889#M80811</guid>
      <dc:creator>nikles</dc:creator>
      <dc:date>2023-02-27T16:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to change a single value in a string col box() list?</title>
      <link>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605890#M80812</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;. &amp;nbsp;I like your idea as well. &amp;nbsp;Just goes to show there's more than one way to skin a cat.&lt;/P&gt;&lt;P&gt;-nikles&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 17:03:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Possible-to-change-a-single-value-in-a-string-col-box-list/m-p/605890#M80812</guid>
      <dc:creator>nikles</dc:creator>
      <dc:date>2023-02-27T17:03:01Z</dc:date>
    </item>
  </channel>
</rss>

