<?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: How to replace empty rows until next entry (and continue)? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269237#M52419</link>
    <description>&lt;P&gt;These are some JSL notes that will help you if you're scripting the solution&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//better version of Fill in Missing Cells, by Brady Brady

Names Default To Here( 1 );
dt = Current Data Table();

dtcollist = dt &amp;lt;&amp;lt; get column names;

dlg = Dialog( "Select Column", vlist( selection = List Box( dtcollist ), button( "OK" ) ) );
Remove From( dlg, 2 );
Eval List( dlg );

dtMat = (dt &amp;lt;&amp;lt; Get All Columns As Matrix);

For( i = 1, i &amp;lt;= N Items( selection ), i++,
colNum = Contains( dtColList, Name Expr( selection[i] ) );
vMat = dtMat[0, colNum];
mis = Loc( Is Missing( vMat ) );
If( N Row( mis ),
col = column(selection[i]);
If( mis[1] == 1,
col[1] = col[(Loc( vMat ))[1]]
);

For( j = if(mis[1]==1, 2, 1), j &amp;lt;= N Row( mis ), j++,
col[mis[j]] = col[mis[j] - 1]
);
);
);
///////////////////////////// short tweak for scripting

dtcollist=dtnr&amp;lt;&amp;lt;Get Column Names;
dtMat = (dtnr &amp;lt;&amp;lt; Get All Columns As Matrix);
selection={}; insert into (selection, column(1));  insert into (selection, column(2));//these columns get acted on

For( i = 1, i &amp;lt;= N Items( selection ), i++,
colNum = Contains( dtColList, Name Expr( selection[i] ) );
vMat = dtMat[0, colNum];
mis = Loc( Is Missing( vMat ) );
If( N Row( mis ),
col = selection[i];
If( mis[1] == 1,
col[1] = col[(Loc( vMat ))[1]]
);

For( j = if(mis[1]==1, 2, 1), j &amp;lt;= N Row( mis ), j++,
col[mis[j]] = col[mis[j] - 1]
);
);
);





///////////////////////////// old version

/*
Names Default to Here(1);
dt = Current Data Table();
rows = N Row( dt );

dtcollist=dt&amp;lt;&amp;lt;get column names;

dlg = Dialog("Select Column",
vlist(
selection=listBox(dtcollist),
button("OK")));
Remove From( dlg, 2 );
Eval List( dlg );

columns=nitems(selection);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 May 2020 19:27:35 GMT</pubDate>
    <dc:creator>Byron_JMP</dc:creator>
    <dc:date>2020-05-27T19:27:35Z</dc:date>
    <item>
      <title>How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269171#M52404</link>
      <description>&lt;P&gt;Dear JMP community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(W10, 64-bit, JMP 15.0 Pro)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have a large data table that is imported from an excel file and I need to have empty rows of a column filled with the entries of the previous list. I am trying to write JSL to go from a column as on the left to the one on the right, as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snap1.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/24193i95C04FF425F293FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snap1.png" alt="Snap1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I'm thinking it should be pretty easy to code, but the issue I'm having is correctly stopping at the end of the previous product and starting with the new product. I must not be looping through correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Any suggestions/help is welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 17:09:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269171#M52404</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2020-05-27T17:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269178#M52406</link>
      <description>&lt;P&gt;Hi, here is a simple formula to should to the trick&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is Missing( :Column 1 ),
	Lag( :Column 2, 1 ),
	:Column 1
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 17:29:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269178#M52406</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2020-05-27T17:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269185#M52408</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11634"&gt;@Thierry_S&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Your formula probably would work, but I couldn't get it to work ideally with the particular table I have. One problem I found is that sometimes I have several rows one after the other where the Product changes, and the lag wouldn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I did come up with this code, which works perfectly. It's not very elegant, but it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Thanks for your help!,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;RowReplace = dt &amp;lt;&amp;lt; Get Rows Where( :Product != "" );
RowEnd = RowReplace;
Remove From( RowEnd, RowEnd[1] );
Insert Into( RowEnd, N Rows( dt ) );
		
		
For( l = 1, l &amp;lt;= N Items( RowReplace ), l++,
	For( irow = 2, irow &amp;lt;= RowEnd[l], irow++,
		If( Is Missing( :Product[irow] ) == 1,
			:Product[irow] = :Product[RowReplace[l]], 
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 May 2020 18:10:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269185#M52408</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2020-05-27T18:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269225#M52415</link>
      <description>&lt;P&gt;You have a script that will do the job, but there is an interactive solution as well. Select the column that needs the replacement so that all rows are selected. Right-click in the data grid of that column and choose Fill &amp;gt; Replace Missing with Previous Value.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 946px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/24197iEF89C73F107E68B8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 19:03:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269225#M52415</guid>
      <dc:creator>Dan_Obermiller</dc:creator>
      <dc:date>2020-05-27T19:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269233#M52417</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3194"&gt;@Dan_Obermiller&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Thanks for the heads up on that. I have seen the Fill to End, to row, or fill pattern, but not that before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Do you know the JSL code that does that? The reason I ask is I want this all in JSL code because I'm reading in several files to build a large data table and need to automate the process so the end user just runs the script and out comes their table with no missing values for the product. If it's quicker and more elegant than my solution, I'd like to modify the code and insert it into my script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 19:09:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269233#M52417</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2020-05-27T19:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269235#M52418</link>
      <description>&lt;P&gt;there is a really fantastic add-in, a must-have called &lt;A href="https://community.jmp.com/t5/JMP-Add-Ins/Data-Table-Tools-Add-in/ta-p/28582" target="_self"&gt;data table tools&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;there is an interpolation tool in there that does this, and so much more. Plus its much faster than the formulas on big tables.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2020-05-27 at 3.10.51 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/24199i6BCE057347771FED/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-05-27 at 3.10.51 PM.png" alt="Screen Shot 2020-05-27 at 3.10.51 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 19:13:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269235#M52418</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2020-05-27T19:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269237#M52419</link>
      <description>&lt;P&gt;These are some JSL notes that will help you if you're scripting the solution&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//better version of Fill in Missing Cells, by Brady Brady

Names Default To Here( 1 );
dt = Current Data Table();

dtcollist = dt &amp;lt;&amp;lt; get column names;

dlg = Dialog( "Select Column", vlist( selection = List Box( dtcollist ), button( "OK" ) ) );
Remove From( dlg, 2 );
Eval List( dlg );

dtMat = (dt &amp;lt;&amp;lt; Get All Columns As Matrix);

For( i = 1, i &amp;lt;= N Items( selection ), i++,
colNum = Contains( dtColList, Name Expr( selection[i] ) );
vMat = dtMat[0, colNum];
mis = Loc( Is Missing( vMat ) );
If( N Row( mis ),
col = column(selection[i]);
If( mis[1] == 1,
col[1] = col[(Loc( vMat ))[1]]
);

For( j = if(mis[1]==1, 2, 1), j &amp;lt;= N Row( mis ), j++,
col[mis[j]] = col[mis[j] - 1]
);
);
);
///////////////////////////// short tweak for scripting

dtcollist=dtnr&amp;lt;&amp;lt;Get Column Names;
dtMat = (dtnr &amp;lt;&amp;lt; Get All Columns As Matrix);
selection={}; insert into (selection, column(1));  insert into (selection, column(2));//these columns get acted on

For( i = 1, i &amp;lt;= N Items( selection ), i++,
colNum = Contains( dtColList, Name Expr( selection[i] ) );
vMat = dtMat[0, colNum];
mis = Loc( Is Missing( vMat ) );
If( N Row( mis ),
col = selection[i];
If( mis[1] == 1,
col[1] = col[(Loc( vMat ))[1]]
);

For( j = if(mis[1]==1, 2, 1), j &amp;lt;= N Row( mis ), j++,
col[mis[j]] = col[mis[j] - 1]
);
);
);





///////////////////////////// old version

/*
Names Default to Here(1);
dt = Current Data Table();
rows = N Row( dt );

dtcollist=dt&amp;lt;&amp;lt;get column names;

dlg = Dialog("Select Column",
vlist(
selection=listBox(dtcollist),
button("OK")));
Remove From( dlg, 2 );
Eval List( dlg );

columns=nitems(selection);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 May 2020 19:27:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269237#M52419</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2020-05-27T19:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269241#M52420</link>
      <description>&lt;P&gt;I don't know the JSL code behind the interactive solution. That should be fine since you have multiple options there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do know that the interactive solution, like some of the scripts, can be applied to multiple columns simultaneously. Just select all of the columns and right-click, choose the Fill option.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 19:34:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269241#M52420</guid>
      <dc:creator>Dan_Obermiller</dc:creator>
      <dc:date>2020-05-27T19:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269250#M52422</link>
      <description>&lt;P&gt;I can't find the JSL function or message that performs the same operation. I don't think it exists. There is a Main Menu() function but this command is associated with the selected column, not the main JMP menu.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 20:06:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269250#M52422</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-05-27T20:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269431#M52454</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4386"&gt;@Byron_JMP&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Thanks for the scripting tweak code in your previous post. This one is better than my solution because it checks to see if the first entry in the column is missing, and if so, it replaces it with the next existing entry, which I have found happens in a couple imports I bring in. I am not experienced with some of the scripting solutions there, such as how you use the vec and matrix information to search up certain things. Anyway, I applied it to my specific problem, and it fixed it without a hiccup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 18:36:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269431#M52454</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2020-05-28T18:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace empty rows until next entry (and continue)?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269544#M52481</link>
      <description>&lt;P&gt;A couple of the JMP systems engineers were going round and round on this problem and this was the best solution. This final version by&amp;nbsp;@Brady Brady is heads a tails faster and more robust than the simple formula we started with. I've been using it for years and found it to work well in a number of situations. &amp;nbsp;Glad it worked for you!&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 11:28:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-replace-empty-rows-until-next-entry-and-continue/m-p/269544#M52481</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2020-05-29T11:28:10Z</dc:date>
    </item>
  </channel>
</rss>

