shango Posted April 11, 2009 Posted April 11, 2009 I have a one to many relationship where I need to calculate the value of a field in the parent based upon the value of a field in the children. It's basically just a true of false value. The parent is set to true by default. If all the children have a false value, then the parent is false. My apologies if the explanation is poor. I've attached a sample which makes things clear. I appreciate any pointers. conditions.fp7.zip
LaRetta Posted April 11, 2009 Posted April 11, 2009 (edited) Theory is ... count the Tasks::TaskStatus. This will only count the field if it contains a value (done). I am assuming that Done or blank are the only possible values (by looking at your value list). And then count the number of child records. If the count is the same, all child records are done or boolean 1, otherwise JobStatus should be false or 0. So your Job Status should be a calculation (number). It will automatically be unstored. And the calculation would be: Count ( tasks::kf_jobs ) = Count ( tasks::task_status ) When you wish to display this Job Status, select Format > Number and set it to boolean with only a value in the yes side. If the results need to be longer than 7 characters, you can use conditional formatting (place the words on the layout) and conditional format to turn the text same color as background if boolean 0 (false). Edited April 11, 2009 by Guest Added explanation about displaying words instead of 1 in Job Status
shango Posted April 13, 2009 Author Posted April 13, 2009 (edited) Thank you for the pointer. That worked like a charm. The theory part seems so obvious and I should be thinking that way. But I'm learning. This is what worked for me in the job status calc field. I don't know if this is the most efficient way, but it worked. if (Count ( tasks::kf_jobs ) = Count ( tasks::task_status ); int ( 1 ) ) Edited April 13, 2009 by Guest
Fitch Posted April 13, 2009 Posted April 13, 2009 Your formula is essentially the same as LaRetta's, but FYI, the first part "count(this) = count(that)" will evaluate to "1" if it's true. That's her formula -- and that's all you need. Your formula essentially says "If 1, then 1," which doesn't add any improvement, unless you work for the dept. of redundancy dept. :(
mr_vodka Posted April 13, 2009 Posted April 13, 2009 unless you work for the dept. of redundancy dept. or any bureaucratic government office. :
shango Posted April 13, 2009 Author Posted April 13, 2009 Lol! Thanks, I didn't realize that was automatic.
Recommended Posts
This topic is 6072 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