<?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: Recode a value in a column with a formula instead of a static value in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Recode-a-value-in-a-column-with-a-formula-instead-of-a-static/m-p/906389#M106482</link>
    <description>&lt;P&gt;To recode entries in a column and save the result to the same column, one can select &lt;FONT face="courier new,courier"&gt;In Place&lt;/FONT&gt;&amp;nbsp;from the drop down menu:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1759868337446.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/84537iBC4D9EFB4483CD85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1759868337446.png" alt="hogi_0-1759868337446.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In the JSL code the target column will match the input column.&lt;BR /&gt;&lt;BR /&gt;Hm, Why does the code not work?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a) &lt;FONT face="courier new,courier"&gt;Short Date()&lt;/FONT&gt; converts the date to a String - but the column is numeric.&lt;/P&gt;
&lt;P&gt;b) even after removing &lt;FONT face="courier new,courier"&gt;short date()&lt;/FONT&gt; it doesn't work. Because&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Map value()&lt;/FONT&gt; doesn't allow expressions? maybe:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1759868519259.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/84538i8A3D7FD678FFDA17/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1759868519259.png" alt="hogi_1-1759868519259.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So let's try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Transfers = New Table( "transfers",
	Add Rows( 1 ),
	Compress File When Saved( 1 ),
	New Column( "OrderDate",
		Format( "y/m/d"),
		Set Values( [-126144000] )
	)
);

Transfers &amp;lt;&amp;lt; Begin Data Update;
Eval (Eval Expr(Transfers &amp;lt;&amp;lt; Recode Column(
	Transfers:OrderDate,
	{Map Value( _rcOrig, {-126144000, Expr(today())}, Unmatched( _rcNow ) )},
	Update Properties( 1 ),
	Target Column( :OrderDate )
)));
Transfers &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Oct 2025 20:24:47 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2025-10-07T20:24:47Z</dc:date>
    <item>
      <title>Recode a value in a column with a formula instead of a static value</title>
      <link>https://community.jmp.com/t5/Discussions/Recode-a-value-in-a-column-with-a-formula-instead-of-a-static/m-p/581190#M78808</link>
      <description>&lt;P&gt;The original value that is in the table that I want to recode will always be 01/01/1900.&amp;nbsp; I want to recode that to today's date.&amp;nbsp; This only returns a blank, and not today's date.&amp;nbsp; Any idea what I need to change?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Transfers &amp;lt;&amp;lt; Begin Data Update;
Transfers &amp;lt;&amp;lt; Recode Column(
	Transfers:OrderDate,
	{Map Value( _rcOrig, {-126144000, short date(today())}, Unmatched( _rcNow ) )},
	Update Properties( 1 ),
	Target Column( :OrderDate )
);
Transfers &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:04:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Recode-a-value-in-a-column-with-a-formula-instead-of-a-static/m-p/581190#M78808</guid>
      <dc:creator>Phil_Nash</dc:creator>
      <dc:date>2023-06-09T16:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Recode a value in a column with a formula instead of a static value</title>
      <link>https://community.jmp.com/t5/Discussions/Recode-a-value-in-a-column-with-a-formula-instead-of-a-static/m-p/581205#M78811</link>
      <description>&lt;P&gt;I am not sure that the source column and the destination column can be the same data column. Here is the example from the scripting index:&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 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
col = New Column( :age );
col &amp;lt;&amp;lt; Data Type( "Character" );
dt &amp;lt;&amp;lt; Recode Column(
	:age,
	{If(
		_rcNow &amp;gt;= 17, "Older",
		_rcNow &amp;gt;= 15, "Middle",
		"Younger"
	)},
	Target Column( col )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Dec 2022 20:22:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Recode-a-value-in-a-column-with-a-formula-instead-of-a-static/m-p/581205#M78811</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-12-13T20:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Recode a value in a column with a formula instead of a static value</title>
      <link>https://community.jmp.com/t5/Discussions/Recode-a-value-in-a-column-with-a-formula-instead-of-a-static/m-p/906389#M106482</link>
      <description>&lt;P&gt;To recode entries in a column and save the result to the same column, one can select &lt;FONT face="courier new,courier"&gt;In Place&lt;/FONT&gt;&amp;nbsp;from the drop down menu:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1759868337446.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/84537iBC4D9EFB4483CD85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1759868337446.png" alt="hogi_0-1759868337446.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In the JSL code the target column will match the input column.&lt;BR /&gt;&lt;BR /&gt;Hm, Why does the code not work?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a) &lt;FONT face="courier new,courier"&gt;Short Date()&lt;/FONT&gt; converts the date to a String - but the column is numeric.&lt;/P&gt;
&lt;P&gt;b) even after removing &lt;FONT face="courier new,courier"&gt;short date()&lt;/FONT&gt; it doesn't work. Because&amp;nbsp;&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Map value()&lt;/FONT&gt; doesn't allow expressions? maybe:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1759868519259.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/84538i8A3D7FD678FFDA17/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1759868519259.png" alt="hogi_1-1759868519259.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So let's try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Transfers = New Table( "transfers",
	Add Rows( 1 ),
	Compress File When Saved( 1 ),
	New Column( "OrderDate",
		Format( "y/m/d"),
		Set Values( [-126144000] )
	)
);

Transfers &amp;lt;&amp;lt; Begin Data Update;
Eval (Eval Expr(Transfers &amp;lt;&amp;lt; Recode Column(
	Transfers:OrderDate,
	{Map Value( _rcOrig, {-126144000, Expr(today())}, Unmatched( _rcNow ) )},
	Update Properties( 1 ),
	Target Column( :OrderDate )
)));
Transfers &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2025 20:24:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Recode-a-value-in-a-column-with-a-formula-instead-of-a-static/m-p/906389#M106482</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-10-07T20:24:47Z</dc:date>
    </item>
  </channel>
</rss>

