Subscribe Bookmark RSS Feed

Fill empty cells with last valid value

lburtone

Community Member

Joined:

Nov 27, 2016

Hello,

 

I have the following problem. My dataset is composed by a list of rows, each representing one item produced by a machine. Normal items are not measured, but from time to time some "measurement items" are produced and the propetries measured. The assumption is that all the parts not measured will have properties similar to the latest measurment. How can I fill the empty cells using this logic?

I attached an example, so that it is easier to understand, the table looks like this:

 

Time      Order                    Test Value        (Expected)
1            Measurement            2.5                     2.5
2            Production                 -                         2.5
3            Production                 -                         2.5
4            Measurement            2                         2
5            Production                 -                         2 
6            Production                 -                         2 
7            Production                 -                         2 
8            Measurement            3                        3
9            Production                 -                         3 
10          Production                 -                         3

 

 

 

2 REPLIES
ron_horne

Super User

Joined:

Jun 23, 2011

perhaps the following line of script can help:

 

Names Default To Here( 1 );
dt = Current Data Table();
For( i = 2, i <= N Rows( dt ), i++,
	If( Is Missing( :test value[i] ),
		:test value[i] = :test value[i - 1]
	)
);

 

best,

ron

 

Byron_JMP

Staff

Joined:

Apr 26, 2012