<?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 How to multiply all elements in a list in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-multiply-all-elements-in-a-list/m-p/667633#M85583</link>
    <description>&lt;P&gt;I am trying to figure out how to multiply the unreliability of all the sub-components per year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mquyen_1-1691799397165.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/55715i70646878A605103F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mquyen_1-1691799397165.png" alt="mquyen_1-1691799397165.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I was thinking of creating an array for each year and use "Product" function to multiply all of the element within the array. But I feel like it will be loop within loops. Is there any suggestion to achieve this task?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Sat, 12 Aug 2023 00:21:34 GMT</pubDate>
    <dc:creator>mquyen</dc:creator>
    <dc:date>2023-08-12T00:21:34Z</dc:date>
    <item>
      <title>How to multiply all elements in a list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-multiply-all-elements-in-a-list/m-p/667633#M85583</link>
      <description>&lt;P&gt;I am trying to figure out how to multiply the unreliability of all the sub-components per year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mquyen_1-1691799397165.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/55715i70646878A605103F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mquyen_1-1691799397165.png" alt="mquyen_1-1691799397165.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I was thinking of creating an array for each year and use "Product" function to multiply all of the element within the array. But I feel like it will be loop within loops. Is there any suggestion to achieve this task?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2023 00:21:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-multiply-all-elements-in-a-list/m-p/667633#M85583</guid>
      <dc:creator>mquyen</dc:creator>
      <dc:date>2023-08-12T00:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to multiply all elements in a list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-multiply-all-elements-in-a-list/m-p/667647#M85584</link>
      <description>&lt;P&gt;Try using this formula&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1,
	x = :Useful Life Unreliability Rollup per Subcomponent type
);
If( Lag( :year ) != :year,
	x = :Useful Life Unreliability Rollup per Subcomponent type,
	x = :Useful Life Unreliability Rollup per Subcomponent type * x
);
x;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Aug 2023 03:01:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-multiply-all-elements-in-a-list/m-p/667647#M85584</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-08-12T03:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to multiply all elements in a list</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-multiply-all-elements-in-a-list/m-p/667712#M85593</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/47591"&gt;@mquyen&lt;/a&gt; ,&lt;BR /&gt;the question you are asking should have been very simple to answer if only the tables&amp;gt;&amp;gt; summary platform or the Analyse &amp;gt;&amp;gt; tabulate procedure would have "Product" as an option.&lt;/P&gt;
&lt;P&gt;meanwhile the way i would do it is as follows:&lt;BR /&gt;first split the table by year and group by subcomponent. then product is available as an option in formula for a new column.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );&lt;BR /&gt;dt1 = New Table( "original",&lt;BR /&gt;Add Rows( 16 ),&lt;BR /&gt;New Column( "Sub-Component",&lt;BR /&gt;Character,&lt;BR /&gt;"Nominal",&lt;BR /&gt;Set Values( {"a1", "a1", "a1", "a2", "a2", "a2", "a3", "a3", "a3", "a4", "a4", "a4", "dc1", "dc1", "dc1", "dc2"} )&lt;BR /&gt;),&lt;BR /&gt;New Column( "Year", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1] ) ),&lt;BR /&gt;New Column( "unreliability", Numeric, "Continuous", Format( "Best", 12 ), Formula( Random Normal() ^ 2 ) )&lt;BR /&gt;);&lt;BR /&gt;dt2 = dt1 &amp;lt;&amp;lt; Split(&lt;BR /&gt;Split By( :Year ),&lt;BR /&gt;Split( :unreliability ),&lt;BR /&gt;Group( :"Sub-Component"n ),&lt;BR /&gt;Output Table( "splilt_table.jmp" ),&lt;BR /&gt;Sort by Column Property&lt;BR /&gt;);&lt;BR /&gt;// New formula column: 1*2*3&lt;BR /&gt;dt2 &amp;lt;&amp;lt; New Formula Column( Operation( Category( "Combine" ), "Product" ), Columns( :"1"n, :"2"n, :"3"n ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if you run this once, next time you can do the same on your data either by script or by clicking from menus. both should be reasonably easy. &lt;BR /&gt;please let us know if it works for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2023 23:06:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-multiply-all-elements-in-a-list/m-p/667712#M85593</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2023-08-13T23:06:18Z</dc:date>
    </item>
  </channel>
</rss>

