ashishjain
17th January 2011, 19:49
Hi..

I have a table with following fields...

1.Company [Part of index]
2.Program [Part of index]
3.Direction [Part of index]
4.Sequential Line Number [Part of index]
5.Table Field Number
6. Error Category - [This is an Enum Field & contains 4 enum values]
7.Error Field & Code

The session is multi occ. + View. Field 1,2,3 & 4 are view fields and 5,6,7 are multi occ. fields. Above field 1,2,3 & 4 is a part of index & referring some other table.

I need to select only those group of records (for index Company, Program, Direction) for which "Error Category = No Error".

Please find attached the screen shot of the session for more clarification.

Thanx.

mark_h
17th January 2011, 22:47
My first thought was:

Select company, program, direction
from table
where company>0
group by company, program, direction
selectdo
select a:error category
from table a
where a._index1 = {:table.company, :table.program, :table.direction}
and err category <> "no error"
as set with 1 rows
selectdo
| found an error for this company, program, direction skip printing
selectemtpy
rprt_send()
endselect
endselect

This little script would find the company, program, direction which did not contain any records which has an error. I assumed you did not want to know which complete record did not have an error. In my example the 108, timecart, direction in yes would not print since there was at one error category not "no error".