Report Record Filter not working??

FishermanFisherman Member Posts: 456
Hey all - got something I can't quite figure out here....

I've created a report in which I'm doing some odd grouping/summing (I need to group by a field in one table, but add up the values in another).

Whenever I compiled and ran the report - I kept getting a "Divide by zero" error, and the debugger would land on a line where I was dividing by "Production Order"."Actual Time Used".

When I looked at the locals browser in the debugger (Code Coverage), the selected record had a status of "Simulated"... but...

The weird thing is, I set the table view for the Production Order table as follows -

Key - "Finished Date" (I created the key)
Order - "Ascending"
Table Filter - "Status=FILTER(Finished)"

This data item is indented one level (the top level table is Item).

Anyone have any ideas why I'm getting "Simulated" records in my table results when I've applied a filter?

Comments

  • DenSterDenSter Member Posts: 8,307
    Either you are looking in the debugger at a variable other that your dataitem, or the field filter is reset or otherwise modified in code somewhere.
  • FishermanFisherman Member Posts: 456
    I've got some screenshots so you can see what I'm talking about. The debugger shows a record with a status of "Simulated" under the exploded "Production Order" data item (record).... but I don't see where this forum allows an upload, so here are some links...

    Debugger
    Filter


    The only thing I can think is that the filter field is not a member of the key...?
  • SavatageSavatage Member Posts: 7,142
    So basically what you're saying is since you're only looking at Finished Production orders that the "production order"."actual time used" should never be zero. therefore the error "division by zero" shouldn't appear.

    am I correct in this assumption?

    I think I had a similar situation a long long time ago - going from memory - I wanted to divide the item.qty by the item."sales Unit of measure"

    even tho I just wanted the results, if I placed those fields in the report - it would work and if I removed them I received that error.

    So I add the the two fields to that section and just made them not visible.

    So perhaps your sections is not "pulling in" the value you're looking for.

    This was a while ago so it's hard to remember .
  • FishermanFisherman Member Posts: 456
    It is the assumption - I'm still working on the report, and I'm going to put in a check for zero in the denominator.

    Actually - when this first started happening - I considered doing that, but when I saw the debugger - I decided it wasn't the problem.

    Can I make an entire section invisible? I haven't looked into that...

    I'll give what you're suggesting a try. It sounds feasible (given what I've seen of the reports so far :)).
  • DenSterDenSter Member Posts: 8,307
    I always try to put a zero check in divisions. Sometimes I forget them though :oops:

    Your filter seems to look fine. I think that somewhere in the code of your report it gets reset, or maybe there is a function call that accepts the poduction order as a parameter by reference and the fitler gets reset in that function.
  • FishermanFisherman Member Posts: 456
    Well - I haven't written anything to change the filter - and I don't see anything that would do so.

    I'm still working with this - hopefully I'll find the problem today.
  • FishermanFisherman Member Posts: 456
    I'm starting to wonder if I should flip the relationship - since I want to filter on the production order status and order by the date...

    I still need to group by the product group code from the item table though.


    GAAAAHHHH! I wish I could just write this in SQL and have a translator. I could compile this report in under an hour.


    EDIT -

    OK scratch that idea. I tried flipping the relationship, but it wouldn't group by product group code correctly - I'm assuming that it's because the item was in the "inner" loop of the production order. It seems that indenting one item under another almost creates a default grouping...
  • SavatageSavatage Member Posts: 7,142
    This is why I love crystral reports so much. I can do this in two minutes.
  • FishermanFisherman Member Posts: 456
    Yeah ... :sigh: ... if only I liked Crystal :). I typically just use ASP.Net for reporting.
  • FishermanFisherman Member Posts: 456
    interesting -

    insert a few strategically placed message boxes and you get an idea.

    I figured out the order of execution of the data item triggers, and how it handles nested data items...

    It also seems as though the report writer uses the filter expressions on a row-by-row basis. It is still iterating all records, but it's only keeping those records that match my criteria on each level - most inefficient if you ask me.

    Maybe I can get some magic happening now that I see that ](*,)
Sign In or Register to comment.