<?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 define for loop with incremental date in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-define-for-loop-with-incremental-date/m-p/534482#M75708</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to adjust total inspection quantity per day based on the "Single Count?" column. Created a new inspection quantity column&amp;nbsp;Inspected_TTL_New. If the input in this column is "F", Inspected_TTL should be same as Inspected_TTL_New. But if it is "T", Inspected_TTL_New column should be the Inspected_TTL quantity&amp;nbsp;for "F" on the same day.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is how far I got:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;inspected_ttl_temp = 0;
For Each Row(
	If( :SINGLE COUNT? == "F",
		:Inspected_TTL_New = :Inspected_TTL;
		inspected_ttl_temp = :Inspected_TTL;
	,

	);
	If( :SINGLE COUNT? == "T",
		:Inspected_TTL_New = inspected_ttl_temp,

	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PanelEdgesPony7_0-1660689478742.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44816i1CC04AD196604C36/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PanelEdgesPony7_0-1660689478742.png" alt="PanelEdgesPony7_0-1660689478742.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This is what I'm trying to do:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PanelEdgesPony7_1-1660689558233.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44817i64EA767792799DA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PanelEdgesPony7_1-1660689558233.png" alt="PanelEdgesPony7_1-1660689558233.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to create a for loop below with incremental dates to capture the inspection quantity per each day but couldn't get it to work :\&lt;/img&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nspected_ttl_temp = 0;
startdate = "2022-08-01";
For( i = "2022-08-01", i &amp;lt;= Max( :DATE ), i++,
	For Each Row(
		If( :SINGLE COUNT? == "F",
			:Inspected_TTL_New = :Inspected_TTL;
			inspected_ttl_temp = :Inspected_TTL;
		,

		);
		If( :SINGLE COUNT? == "T",
			:Inspected_TTL_New = inspected_ttl_temp,

		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help!!&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:53:11 GMT</pubDate>
    <dc:creator>PanelEdgesPony7</dc:creator>
    <dc:date>2023-06-10T23:53:11Z</dc:date>
    <item>
      <title>How to define for loop with incremental date</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-define-for-loop-with-incremental-date/m-p/534482#M75708</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to adjust total inspection quantity per day based on the "Single Count?" column. Created a new inspection quantity column&amp;nbsp;Inspected_TTL_New. If the input in this column is "F", Inspected_TTL should be same as Inspected_TTL_New. But if it is "T", Inspected_TTL_New column should be the Inspected_TTL quantity&amp;nbsp;for "F" on the same day.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is how far I got:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;inspected_ttl_temp = 0;
For Each Row(
	If( :SINGLE COUNT? == "F",
		:Inspected_TTL_New = :Inspected_TTL;
		inspected_ttl_temp = :Inspected_TTL;
	,

	);
	If( :SINGLE COUNT? == "T",
		:Inspected_TTL_New = inspected_ttl_temp,

	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PanelEdgesPony7_0-1660689478742.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44816i1CC04AD196604C36/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PanelEdgesPony7_0-1660689478742.png" alt="PanelEdgesPony7_0-1660689478742.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This is what I'm trying to do:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PanelEdgesPony7_1-1660689558233.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44817i64EA767792799DA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PanelEdgesPony7_1-1660689558233.png" alt="PanelEdgesPony7_1-1660689558233.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried to create a for loop below with incremental dates to capture the inspection quantity per each day but couldn't get it to work :\&lt;/img&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nspected_ttl_temp = 0;
startdate = "2022-08-01";
For( i = "2022-08-01", i &amp;lt;= Max( :DATE ), i++,
	For Each Row(
		If( :SINGLE COUNT? == "F",
			:Inspected_TTL_New = :Inspected_TTL;
			inspected_ttl_temp = :Inspected_TTL;
		,

		);
		If( :SINGLE COUNT? == "T",
			:Inspected_TTL_New = inspected_ttl_temp,

		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help!!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:53:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-define-for-loop-with-incremental-date/m-p/534482#M75708</guid>
      <dc:creator>PanelEdgesPony7</dc:creator>
      <dc:date>2023-06-10T23:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to define for loop with incremental date</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-define-for-loop-with-incremental-date/m-p/534508#M75709</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;My understanding is you want to get the "Inspect_TTL "about "Single Count" F.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a easy way to do that just need transpose your data table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "jmp example data table" ) &amp;lt;&amp;lt; Transpose(
	columns( :Inspected_TTL ),
	By( :DATE ),
	Label( :Name( "SINGLE COUNT?" ) ),
	Output Table( "Transpose of jmp example data table" )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then you will get a new table like this. And the column F is the data.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="frank_wang_1-1660694727548.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44819i2516367C1711AA2B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="frank_wang_1-1660694727548.png" alt="frank_wang_1-1660694727548.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then Join the dt_tran to original dt.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table( "jmp example data table" ) &amp;lt;&amp;lt; Join(
	With( Data Table( "Transpose of jmp example data table" ) ),
	Select( :Name( "SINGLE COUNT?" ), :DATE, :Inspected_TTL, :Inspected_TTL_New ),
	SelectWith( :F ),
	By Matching Columns( :DATE = :DATE ),
	Drop multiples( 0, 0 ),
	Include Nonmatches( 0, 0 ),
	Preserve main table order( 1 )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;final dt like this one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="frank_wang_2-1660695559165.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/44820i772C04DDEC0070B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="frank_wang_2-1660695559165.png" alt="frank_wang_2-1660695559165.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Have a good day!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 00:20:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-define-for-loop-with-incremental-date/m-p/534508#M75709</guid>
      <dc:creator>frank_wang</dc:creator>
      <dc:date>2022-08-17T00:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to define for loop with incremental date</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-define-for-loop-with-incremental-date/m-p/534921#M75738</link>
      <description>&lt;P&gt;Thank you!! This is working perfectly&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 01:03:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-define-for-loop-with-incremental-date/m-p/534921#M75738</guid>
      <dc:creator>PanelEdgesPony7</dc:creator>
      <dc:date>2022-08-18T01:03:27Z</dc:date>
    </item>
  </channel>
</rss>

