July 9, 200718 yr I'm trying to give a field a certain status if a field in a related table is not empty. I've tried this calculation but nothing happens. If ( not IsEmpty(Order::Objekt_nummer); Status; "Start") I've also (unsuccessfully) tried putting the calculation in the related table. What am I doing wrong here?
July 9, 200718 yr It's not clear, is it if the related tables holds any records, or that the present have related records. For the first would you need an extra cartesian relationship, the second would a IsValid( be pretty fast to establist a record and in particular if you let it examine if a foreignKey exists. --sd
July 9, 200718 yr Author When there's a record created in the related table, that record has a field that gets a serial number - it is that field that I want my calculation to check out, and if there is a number, set the Status field in the present table to "Start". How do I "examine if a foreignKey exists" within this calculation?! regards Anders
July 9, 200718 yr A calculation field calculates a result - it does not set another field. You should probably make your Status field itself a calculation = If ( IsEmpty ( Order::Objekt_nummer ) ; "Start" ;
July 9, 200718 yr Author OK, that worked! But maybe what I'm trying to do is totally wrong. I want the end user to be able to manually change the Status field when necessary - and a calculated field will not allow you to do that, right?! Maybe a script that can Set a field is better?! In that case, how do I trigger a script that will set the Status field to "Start"?! (I'm sorry if I come across as confused, but at the moment that's probably because I am!)
July 10, 200718 yr I am confused as well. It would be easier if you explained what is the purpose here. A calculation referencing a related field must be unstored, so no - it cannot be overwritten by the user. However, you could set up an unstored calculation field, and another field for user override, so the calculation would be something like: Case ( not IsEmpty ( Overridefield ) ; Overridefield ; IsEmpty ( Order::Objekt_nummer ) ; "Start" ; )
July 10, 200718 yr Author I apologize if I've been unclear. The purpose with the Status field is to show the user if there's been an order made (that's in the related table) on a project. When a project's declared finished, they want to change the status to "post production" or "finished". regards Anders
July 10, 200718 yr I think I would still make Status a calculation field. Let them "declare the project finished" by filling a DateFinished field. Then just add this condition - and any other conditions that affect the status of the project - to the Case() function.
July 10, 200718 yr Author I've added a second condition to my Case calculation, but it's just the first one that will work. Even if it's just the second condition that is valid, nothing happens . Case ( not IsEmpty ( Order::Objekt_nummer ) ; "Start" ; Case ( not IsEmpty ( Offert:_Offert_ID ) ; "N/A"; "")) Same thing if I reverse the order of the two conditions - I thought that Case will override any condition that has another (valid) one in front of it, so to speak... Update: it _does_ work! The calculation I was working on wasn't displayed in any layout! The Status field I was looking at was an older calculation that just contained one condition. : Thank you Søren and comment for all the input! regards Anders Edited July 10, 200718 yr by Guest
Create an account or sign in to comment