AnsweredAssumed Answered

Omitting records based on the value of a summary field in a subsummary part

Question asked by nutcracker on Feb 3, 2010
Latest reply on Feb 4, 2010 by philmodjunk

Title

Omitting records based on the value of a summary field in a subsummary part

Post

[FMPro10, MacOSX 10.5]

 

I'm wanting to remove records from a found set based on the value of a summary field INSIDE a sub-summary part after sorting. 

 

I'm have a script that looks like this:

 

script

 

That generates a inventory report like this:

 

inventory report 

 

The records are sorted by the line_item item_id so each item (BABY PAUA, AFFIRMATION EARRINGS) is grouped and the summary fields calculated from this grouping. 

 

The stock column shows the number of items the customer has in stock (sum_of_quantity_in_stock). It's the ordered items quantity - the sold items quantity, like this:

 

calcs 

 

sidenote: line_items is used for both order and invoice line_items, hence the need for quantity_sold and quantity_ordered to check the IsEmpty of invoice_id (true if the line_item is an invoice_line_item instance).

 

 In the inventory report above you can see that the AFFIRMATION EARRINGS stock count is 0. I don't want this line to appear in the report. Only when the stock (sum_of_quantity_in_stock) in the subsummary part is > 0 should the sub-summary part be included.

 

Any ideas on how to do this?

 

Thanks,

Mike 

 

Outcomes