Isaac Knoflicek Posted January 6, 2016 Posted January 6, 2016 I'm using a modified version of the Invoices Starter Solution form FM13 and I've added a boolean field to the Invoice Data table which indicates if it has been ordered or not. What I'd like to do is add a boolean calculated field in the Invoices table which looks at all related records, all the items on the invoice, and if they've all been ordered it's 1. If I create the calculated field in invoices and set it to If(InvoiceData::Ordered=1,1,"") it works as long as there's only 1 item. If there are two or more items it just moves in lock step with the first item and ignores the rest. Any way to do this without a script? Thanks, Isaac
comment Posted January 6, 2016 Posted January 6, 2016 A calculation that references a related field gets the data from the first related record only. In order to consider all related records, you need to use one of the Aggregate functions. Try something like: Sum ( InvoiceData::Ordered ) = Count ( InvoiceData::OrderID ) Personally, I would prefer to make Ordered a Date field, and count it instead of summing it. 1
Isaac Knoflicek Posted January 6, 2016 Author Posted January 6, 2016 That's brilliant, that should work. As far as your preferred method, how would you count a date field? I do have an ordered timestamp field which just puts in the time when the ordered checkbox was checked. Thanks for your help! Isaac
comment Posted January 6, 2016 Posted January 6, 2016 (edited) 48 minutes ago, Isaac Knoflicek said: how would you count a date field? Just like that: Count ( Related::Datefield ) returns the number of related records where Datefield is not empty. 48 minutes ago, Isaac Knoflicek said: I do have an ordered timestamp field which just puts in the time when the ordered checkbox was checked. I don't think you need two fields for this. A button that populates/clears the timestamp field should be quite sufficient. And you can use conditional formatting to display a tick mark when the timestamp field is not empty. Edited January 6, 2016 by comment 1
Recommended Posts
This topic is 3300 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now