April 11, 200916 yr 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
April 11, 200916 yr 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, 200916 yr by Guest Added explanation about displaying words instead of 1 in Job Status
April 13, 200916 yr Author 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, 200916 yr by Guest
April 13, 200916 yr 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. :(
April 13, 200916 yr unless you work for the dept. of redundancy dept. or any bureaucratic government office. :
Create an account or sign in to comment