<?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: Column Custom Formula in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281596#M54510</link>
    <description>&lt;P&gt;Here are the columns to generate what you are asking for.&amp;nbsp; I took your interpolation formula as is, and implemented it.&amp;nbsp; You may need to changes some things up.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to Here(1);

// Create the sample data table
dt=New Table( "Example",
	Add Rows( 24 ),
	New Column( "ID",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[0.000002, 0.0000002, 0.00000002, 0.000000002, 0.0000000002,
			0.000000000002, 0.000003, 0.0000003, 0.00000003, 0.000000003,
			0.0000000003, 0.000000000003, 0.000004, 0.0000004, 0.00000004,
			0.000000004, 0.0000000004, 0.000000000004, 0.000005, 0.0000005,
			0.00000005, 0.000000005, 0.0000000005, 0.000000000005]
		)
	),
	New Column( "VG",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[3, 2.8, 2.6, 2.4, 2.2, 2, 3, 2.8, 2.6, 2.4, 2.2, 2, 3, 2.8, 2.6, 2.4,
			2.2, 2, 3, 2.8, 2.6, 2.4, 2.2, 2]
		)
	),
	New Column( "Mod",
		Character( 16 ),
		"Nominal",
		Set Values(
			{"1A", "1A", "1A", "1A", "1A", "1A", "1B", "1B", "1B", "1B", "1B", "1B",
			"1A", "1A", "1A", "1A", "1A", "1A", "1B", "1B", "1B", "1B", "1B", "1B"}
		)
	),
	New Column( "Device",
		Character( 16 ),
		"Nominal",
		Set Values(
			{"X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1",
			"Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1"}
		)
	)
);

// Find the index
dt &amp;lt;&amp;lt; New Column("Row", formula(
theMin = Col Minimum( Abs( 0.000001 - :ID ), :Mod, :Device );
theValue = .;
If( Abs( 0.000001 - :ID[Row()] ) == theMin,
	show(.000001 - :ID[Row()]);
	theValue = Row()
);));

dt&amp;lt;&amp;lt;New Column("Interpolation Row", formula(
theRow = Col Max( :Row, :Mod, :Device );
iRow = .;
If( Row() == theRow,
	If( .000001 - :ID[theRow] &amp;gt; 0,
		iRow = theRow - 1,
		.000001 - :ID[theRow] &amp;lt; 0,
		iRow = theRow +1,
		iRow = theRow
	);
);
));
iRow;

// Set the Vth
dt&amp;lt;&amp;lt;New Column("Vth", formula(
theRow = :VG[Col Max( :Row, :Mod, :Device )]));

dt&amp;lt;&amp;lt;New Column("Exact Vth", formula(
	theRow = Col Max( :Row, :Mod, :Device );
	a=matrix(:VG[:Row[theRow]]) || matrix(:VG[:Interpolation Row[theRow]]);
	b=matrix(log10(:ID[:Row[theRow]])) || matrix(log10(:ID[:Interpolation Row[theRow]]));
	theValue=interpolate(.0000001, a, b);
	theValue;
));

// Clean up
dt:Vth &amp;lt;&amp;lt; delete formula;
dt:Exact Vth &amp;lt;&amp;lt; delete formula;
//dt&amp;lt;&amp;lt; delete columns("Row");
//dt&amp;lt;&amp;lt; delete columns("Interpolation Row");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Jul 2020 19:57:28 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-07-23T19:57:28Z</dc:date>
    <item>
      <title>Column Custom Formula</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281266#M54468</link>
      <description>&lt;P&gt;I would like to add a new column 'Vth' in my table with the following calculation:-&lt;/P&gt;&lt;P&gt;First I need to find the index i of column 'Id' where the 'Id' is nearest to 1e-6; and then Vth = Vg(i). It should be grouped by Mod and Device columns as well. That is, each unique combination of Mod and Device will have one Vth value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Id&lt;/TD&gt;&lt;TD&gt;Vg&lt;/TD&gt;&lt;TD&gt;Mod&lt;/TD&gt;&lt;TD&gt;Device&lt;/TD&gt;&lt;TD&gt;Vth&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.00E-06&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1A&lt;/TD&gt;&lt;TD&gt;X1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.00E-07&lt;/TD&gt;&lt;TD&gt;2.8&lt;/TD&gt;&lt;TD&gt;1A&lt;/TD&gt;&lt;TD&gt;X1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.00E-08&lt;/TD&gt;&lt;TD&gt;2.6&lt;/TD&gt;&lt;TD&gt;1A&lt;/TD&gt;&lt;TD&gt;X1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.00E-09&lt;/TD&gt;&lt;TD&gt;2.4&lt;/TD&gt;&lt;TD&gt;1A&lt;/TD&gt;&lt;TD&gt;X1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.00E-10&lt;/TD&gt;&lt;TD&gt;2.2&lt;/TD&gt;&lt;TD&gt;1A&lt;/TD&gt;&lt;TD&gt;X1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2.00E-12&lt;/T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;TD&gt;5.00E-07&lt;/TD&gt;&lt;TD&gt;2.8&lt;/TD&gt;&lt;TD&gt;1B&lt;/TD&gt;&lt;TD&gt;Y1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5.00E-08&lt;/TD&gt;&lt;TD&gt;2.6&lt;/TD&gt;&lt;TD&gt;1B&lt;/TD&gt;&lt;TD&gt;Y1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5.00E-09&lt;/TD&gt;&lt;TD&gt;2.4&lt;/TD&gt;&lt;TD&gt;1B&lt;/TD&gt;&lt;TD&gt;Y1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5.00E-10&lt;/TD&gt;&lt;TD&gt;2.2&lt;/TD&gt;&lt;TD&gt;1B&lt;/TD&gt;&lt;TD&gt;Y1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5.00E-12&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1B&lt;/TD&gt;&lt;TD&gt;Y1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:16:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281266#M54468</guid>
      <dc:creator>pankajsync</dc:creator>
      <dc:date>2023-06-10T23:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Column Custom Formula</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281293#M54473</link>
      <description>&lt;P&gt;Here is a little script that create 2 new columns that gives you the results you asked for.&amp;nbsp; The image below has had the interim column deleted since it is only a working column.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vth.PNG" style="width: 514px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/25671i2C2771C85A0AE297/image-dimensions/514x340?v=v2" width="514" height="340" role="button" title="vth.PNG" alt="vth.PNG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to Here(1);

// Create the sample data table
dt=New Table( "Example",
	Add Rows( 24 ),
	New Column( "ID",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[0.000002, 0.0000002, 0.00000002, 0.000000002, 0.0000000002,
			0.000000000002, 0.000003, 0.0000003, 0.00000003, 0.000000003,
			0.0000000003, 0.000000000003, 0.000004, 0.0000004, 0.00000004,
			0.000000004, 0.0000000004, 0.000000000004, 0.000005, 0.0000005,
			0.00000005, 0.000000005, 0.0000000005, 0.000000000005]
		)
	),
	New Column( "VG",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[3, 2.8, 2.6, 2.4, 2.2, 2, 3, 2.8, 2.6, 2.4, 2.2, 2, 3, 2.8, 2.6, 2.4,
			2.2, 2, 3, 2.8, 2.6, 2.4, 2.2, 2]
		)
	),
	New Column( "Mod",
		Character( 16 ),
		"Nominal",
		Set Values(
			{"1A", "1A", "1A", "1A", "1A", "1A", "1B", "1B", "1B", "1B", "1B", "1B",
			"1A", "1A", "1A", "1A", "1A", "1A", "1B", "1B", "1B", "1B", "1B", "1B"}
		)
	),
	New Column( "Device",
		Character( 16 ),
		"Nominal",
		Set Values(
			{"X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1",
			"Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1"}
		)
	)
);

// Find the index
dt &amp;lt;&amp;lt; New Column("Row", formula(
theMin = Col Minimum( Abs( 0.000001 - :ID ), :Mod, :Device );
theValue = .;
If( Abs( 0.000001 - :ID[Row()] ) == theMin,
	theValue = Row()
);));

// Set the Vth
dt&amp;lt;&amp;lt;New Column("Vth", formula(
theRow = :VG[Col Max( :Row, :Mod, :Device )]));

// Clean up
dt:Vth &amp;lt;&amp;lt; delete formula;
dt&amp;lt;&amp;lt; delete columns("Row");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jul 2020 02:44:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281293#M54473</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-07-23T02:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Column Custom Formula</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281443#M54505</link>
      <description>&lt;P&gt;Thanks Jim. It works. How can I modify this to find the Vth&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;which corresponds to exactly 1e-6 of ID by interpolation. I.e. finding an index before and after 1e-6 of ID and then interpolate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;index=nearest to 1e-6 (greater than 1e-6)&lt;/P&gt;&lt;P&gt;Interpolate( x, [VG(index) VG(index-1)&amp;nbsp; ], [log10(ID(index))&amp;nbsp; log10(ID(index-1))] );&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 17:00:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281443#M54505</guid>
      <dc:creator>pankajsync</dc:creator>
      <dc:date>2020-07-23T17:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Column Custom Formula</title>
      <link>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281596#M54510</link>
      <description>&lt;P&gt;Here are the columns to generate what you are asking for.&amp;nbsp; I took your interpolation formula as is, and implemented it.&amp;nbsp; You may need to changes some things up.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to Here(1);

// Create the sample data table
dt=New Table( "Example",
	Add Rows( 24 ),
	New Column( "ID",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[0.000002, 0.0000002, 0.00000002, 0.000000002, 0.0000000002,
			0.000000000002, 0.000003, 0.0000003, 0.00000003, 0.000000003,
			0.0000000003, 0.000000000003, 0.000004, 0.0000004, 0.00000004,
			0.000000004, 0.0000000004, 0.000000000004, 0.000005, 0.0000005,
			0.00000005, 0.000000005, 0.0000000005, 0.000000000005]
		)
	),
	New Column( "VG",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[3, 2.8, 2.6, 2.4, 2.2, 2, 3, 2.8, 2.6, 2.4, 2.2, 2, 3, 2.8, 2.6, 2.4,
			2.2, 2, 3, 2.8, 2.6, 2.4, 2.2, 2]
		)
	),
	New Column( "Mod",
		Character( 16 ),
		"Nominal",
		Set Values(
			{"1A", "1A", "1A", "1A", "1A", "1A", "1B", "1B", "1B", "1B", "1B", "1B",
			"1A", "1A", "1A", "1A", "1A", "1A", "1B", "1B", "1B", "1B", "1B", "1B"}
		)
	),
	New Column( "Device",
		Character( 16 ),
		"Nominal",
		Set Values(
			{"X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1",
			"Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1"}
		)
	)
);

// Find the index
dt &amp;lt;&amp;lt; New Column("Row", formula(
theMin = Col Minimum( Abs( 0.000001 - :ID ), :Mod, :Device );
theValue = .;
If( Abs( 0.000001 - :ID[Row()] ) == theMin,
	show(.000001 - :ID[Row()]);
	theValue = Row()
);));

dt&amp;lt;&amp;lt;New Column("Interpolation Row", formula(
theRow = Col Max( :Row, :Mod, :Device );
iRow = .;
If( Row() == theRow,
	If( .000001 - :ID[theRow] &amp;gt; 0,
		iRow = theRow - 1,
		.000001 - :ID[theRow] &amp;lt; 0,
		iRow = theRow +1,
		iRow = theRow
	);
);
));
iRow;

// Set the Vth
dt&amp;lt;&amp;lt;New Column("Vth", formula(
theRow = :VG[Col Max( :Row, :Mod, :Device )]));

dt&amp;lt;&amp;lt;New Column("Exact Vth", formula(
	theRow = Col Max( :Row, :Mod, :Device );
	a=matrix(:VG[:Row[theRow]]) || matrix(:VG[:Interpolation Row[theRow]]);
	b=matrix(log10(:ID[:Row[theRow]])) || matrix(log10(:ID[:Interpolation Row[theRow]]));
	theValue=interpolate(.0000001, a, b);
	theValue;
));

// Clean up
dt:Vth &amp;lt;&amp;lt; delete formula;
dt:Exact Vth &amp;lt;&amp;lt; delete formula;
//dt&amp;lt;&amp;lt; delete columns("Row");
//dt&amp;lt;&amp;lt; delete columns("Interpolation Row");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jul 2020 19:57:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Column-Custom-Formula/m-p/281596#M54510</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-07-23T19:57:28Z</dc:date>
    </item>
  </channel>
</rss>

