Anders Thorssell Posted July 9, 2007 Posted July 9, 2007 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?
Søren Dyhr Posted July 9, 2007 Posted July 9, 2007 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
Anders Thorssell Posted July 9, 2007 Author Posted July 9, 2007 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
comment Posted July 9, 2007 Posted July 9, 2007 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" ;
Anders Thorssell Posted July 9, 2007 Author Posted July 9, 2007 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!)
comment Posted July 10, 2007 Posted July 10, 2007 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" ; )
Anders Thorssell Posted July 10, 2007 Author Posted July 10, 2007 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
comment Posted July 10, 2007 Posted July 10, 2007 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.
Anders Thorssell Posted July 10, 2007 Author Posted July 10, 2007 (edited) 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, 2007 by Guest
Recommended Posts
This topic is 6407 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