cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Ashraff09
Level II

Select Where as a group

Hello,

 

I am struggling with selecting several group of  rows with categorize by data in row :Folder. 

My objective is to clean up the data table with full group of "0" or empty cells 

 

For example, i have a data table as such; 

WellDataFolder
A1020200107 011 3F
A2020200107 011 3F
A3020200107 011 3F
A4020200107 011 3F
A5020200107 011 3F
A6020200107 011 3F
A7020200107 011 3F
A8020200107 011 3F
A9020200107 011 3F
A10020200107 011 3F
A11020200107 011 3F
A12020200107 011 3F
A17544.86839320210104 002 1F
A27428.83216120210104 002 1F
A3020210104 002 1F
A48172.85821720210104 002 1F
A57498.46276620210104 002 1F
A68097.89205620210104 002 1F
A78293.36020320210104 002 1F
A87553.3721520210104 002 1F
A97247.30890520210104 002 1F
A107720.27269720210104 002 1F
A117583.01509920210104 002 1F
A128204.12678120210104 002 1F
A19338.3379520210104 007 1F
A29128.85826520210104 007 1F
A39451.36930920210104 007 1F
A49630.49726220210104 007 1F
A510168.697920210104 007 1F
A610661.4451620210104 007 1F
A79974.95618420210104 007 1F
A89563.32740420210104 007 1F
A99382.45918120210104 007 1F
A109495.758820210104 007 1F
A119501.2038820210104 007 1F
A1210190.3496520210104 007 1F
A19892.50617920210104 008 1F
A28803.62035520210104 008 1F
A39106.94708820210104 008 1F
A49620.51472220210104 008 1F
A510422.7753820210104 008 1F
A69931.95266120210104 008 1F
A710465.0354920210104 008 1F
A810313.0182820210104 008 1F
A99515.80516220210104 008 1F
A10 20210104 008 1F
A119638.3266720210104 008 1F
A129230.89317120210104 008 1F

 

How do select and delete off a group of data rows by :Folder, while maintaining the "0" or empty cells that have some values for other :Well in the :Folder 

 

After the clean up, the data table should look like this:

 

WellDataFolder 
A17544.86820210104 002 1F
A27428.83220210104 002 1F
A3020210104 002 1F
A48172.85820210104 002 1F
A57498.46320210104 002 1F
A68097.89220210104 002 1F
A78293.3620210104 002 1F
A87553.37220210104 002 1F
A97247.30920210104 002 1F
A107720.27320210104 002 1F
A117583.01520210104 002 1F
A128204.12720210104 002 1F
A19338.33820210104 007 1F
A29128.85820210104 007 1F
A39451.36920210104 007 1F
A49630.49720210104 007 1F
A510168.720210104 007 1F
A610661.4520210104 007 1F
A79974.95620210104 007 1F
A89563.32720210104 007 1F
A99382.45920210104 007 1F
A109495.75920210104 007 1F
A119501.20420210104 007 1F
A1210190.3520210104 007 1F
A19892.50620210104 008 1F
A28803.6220210104 008 1F
A39106.94720210104 008 1F
A49620.51520210104 008 1F
A510422.7820210104 008 1F
A69931.95320210104 008 1F
A710465.0420210104 008 1F
A810313.0220210104 008 1F
A99515.80520210104 008 1F
A10 20210104 008 1F
A119638.32720210104 008 1F
A129230.89320210104 008 1F

 

Regards

Ashraff 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Select Where as a group

Your code can be simplified.  There isn't a need to create the new formula column.

names default to here(1);
cctable = current data table();

cctable << select where(col mean(:data,:folder)==0);
cctable << delete rows;
Jim

View solution in original post

3 REPLIES 3
Ashraff09
Level II

Re: Select Where as a group

Hello,

I think i manage to solve this.. in not very smart way, but it works.
I create an average data column and select the rows that he average == 0
then delete off the rows.

cctable << New Column( "DataAverage",Numeric,Continous,Format( "Best", 9 ),
Formula( Col Mean(:Data, :Folder)));

cctable << Row Selection(Select where( :DataAverage == 0));
cctable << delete rows();
cctable << delete column(column("DataAverage"));


This serve the purpose,
but if anybody have a more robust way of scripting this, do let me know.

Regards
Ashraff

txnelson
Super User

Re: Select Where as a group

Your code can be simplified.  There isn't a need to create the new formula column.

names default to here(1);
cctable = current data table();

cctable << select where(col mean(:data,:folder)==0);
cctable << delete rows;
Jim
Ashraff09
Level II

Re: Select Where as a group

Thanks Jim,

 

I knew that there is a more elegant way of structuring the code as you demonstrated. 

Thank You! 

 

Regards

Ashraff