dromeo
29th May 2018, 00:24
Hello!
I'm trying to compare 2 tables, for missing records, and then filter the results to show on a custom report only the records that match, excluding the missing / deleted records. The problem is that the report has already a structured logic (it's the report that shows the Hours for the General Tasks and the Production Hours).
Now, the standard report takes the information from the bptmm100 table, but when some records are deleted from the General Tasks session, through the session, for some reason they don't get deleted from the bptmm100, but only from the bptmm111, resulting in showing on the report bad information for the users (hours that were already deleted). I want to filter that information.
On the details of the script I was thinking in something like this:
detail.9:
before.layout:
select bptmm111.*
from bptmm111
where bptmm111.emno = :bptmm100.emno |Employee Code
and bptmm111.year = :bptmm100.year |Year
and bptmm111.peri = :bptmm100.peri | Period
and bptmm111.type = bptmm.type.general |General Tasks
and bptmm111.hrea(8) = :bptmm100.hrea |Hours, Comparing the 8th number on the array
selectdo
if isspace(bptmm111.emno) then |when the hours are not found in the bptmm111, the query
|returns an empty string in the employee code, so this is how I
|filter the hours that I don't want to show on the report
lattr.print = false
endif
endselect
The problem with this code, is that for some records it works, and I'm able to NOT show the REAL missing hours, but for some reason, I don't know if because a recursive search is needed, considering also how the data it's sorted differently in both tables (bptmm111 & bptmm100) and the sequence numbers are different (bptmm100.seqn & bptmm111.seqn)...so for some reason in some cases it also filter (doesn't show) the hours that are in both tables, so it also filter the REAL hours that I need to show on the report.
Any advices???
Thank you very much,
Daniel Romeo
I'm trying to compare 2 tables, for missing records, and then filter the results to show on a custom report only the records that match, excluding the missing / deleted records. The problem is that the report has already a structured logic (it's the report that shows the Hours for the General Tasks and the Production Hours).
Now, the standard report takes the information from the bptmm100 table, but when some records are deleted from the General Tasks session, through the session, for some reason they don't get deleted from the bptmm100, but only from the bptmm111, resulting in showing on the report bad information for the users (hours that were already deleted). I want to filter that information.
On the details of the script I was thinking in something like this:
detail.9:
before.layout:
select bptmm111.*
from bptmm111
where bptmm111.emno = :bptmm100.emno |Employee Code
and bptmm111.year = :bptmm100.year |Year
and bptmm111.peri = :bptmm100.peri | Period
and bptmm111.type = bptmm.type.general |General Tasks
and bptmm111.hrea(8) = :bptmm100.hrea |Hours, Comparing the 8th number on the array
selectdo
if isspace(bptmm111.emno) then |when the hours are not found in the bptmm111, the query
|returns an empty string in the employee code, so this is how I
|filter the hours that I don't want to show on the report
lattr.print = false
endif
endselect
The problem with this code, is that for some records it works, and I'm able to NOT show the REAL missing hours, but for some reason, I don't know if because a recursive search is needed, considering also how the data it's sorted differently in both tables (bptmm111 & bptmm100) and the sequence numbers are different (bptmm100.seqn & bptmm111.seqn)...so for some reason in some cases it also filter (doesn't show) the hours that are in both tables, so it also filter the REAL hours that I need to show on the report.
Any advices???
Thank you very much,
Daniel Romeo