PiedPiper Posted March 23, 2005 Posted March 23, 2005 Searched on globals - can't find it. As I type stuff in a field on a list, I want it's UPDATE field, a date, to grab a global date which is in header. Auto-enter on this update field is set to calculated with the do not replace unchecked and calculation is just globaldate field. It doesn't put the date in each record as I type stuff in the field. Any time i change a field, i want this date (whatever is in the global) to change in the update field. i thought globals could be seen by all records. I don't want modification date because the date modified may not be today. that's why I'm using the global date. I'm missing something simple i suppose but now I've resorted to staring it down - for an hour - and it still won't answer me. ideas?
Søren Dyhr Posted March 23, 2005 Posted March 23, 2005 Ah I think I know what your problem is ...the field in the header is a global field, but in each record should another global field be an autoenter containing this: Evaluate ("g_theGrabbingValue"; [Afield;Bfield;Cfield]) ...with the "Replaces existing values" set. So you need two globals not just one! --sd
PiedPiper Posted March 24, 2005 Author Posted March 24, 2005 Thanks for helping . I don't understand tho I'm trying real hard. what is "g_theGrabbingValue" ? Is that the new global I need or my existing one? I kinda see how I must include the fields I want to test for changes as Afield;Bfield;Cfield but how is that going to make UPDATE change if the auto-enter is put on another global? Fields: Update - standard date field (auto-enter replace with :?) gUpdateDate - global date field Another global with : There are four fields that, if they change or were empty and now have text, Update should look at gUpdateDate. those fields are CallResults (text) ProgressNotes (text) SpokeWith (text) MeetingStatus (text popup with completed, rescheduled & cancelled these sheeets come in from traveling reps and secretary enters them. the gUpdateDate idea was so she could type the date the rep placed that days calls (in header, clever huh? love globals) and as she changed the customer info, the Update field would record last activity on the customer. i also liked the fact that it clears when she leaves for the day or she can change to the next reps call date for the next batch of sheets. she works on list view with only these fields showing (plus customer name and rep of course) and a few other fields. sometimes she also changes other fields but the update shouldn't change then because the rep didn't do the work, she did. hope that helps you help me. TIA Pete
comment Posted March 24, 2005 Posted March 24, 2005 Try: Update - standard date field, auto-enter replace with= Evaluate ( "gUpdateDate" ; [ CallResults ; ProgressNotes ; SpokeWith ; MeetingStatus ] )
PiedPiper Posted March 24, 2005 Author Posted March 24, 2005 Perfect. I had read about evaluate when Soren answered. And this seems to go against my understandings so i guess now's when to ask i hope. help says: Evaluate(TextField) returns 4 when TextField contains 2 + 2. Evaluate("textfield") returns 2 + 2 when textfield contains 2 + 2. Here's my confusion: 1) Evaluate is a text function but we are applying it to a date field. I see no text to date conversion happen. 2) ok. No conversion because you wrapped the global in quotes FORCING IT TO TEXT just by using the quotes? 3) so you used the second example which says, if i wrap it in quotes, just put what exists in the field in there - regardless of the data type - don't really evaluate it - just do exactly as I say. 4) if 3 is true, then why not just put the field name to begin with? Why evaluate at all? i seem to be in my own perpetual thinking loop here. does evaluate force the issue, kinda like a unstored calculaton? i keep reading help over and over and don't quite grok the concept. am i close? evaluate forces stuff and seems to allow breaking a lot of old rules. oh. thanks both of you. i hadn't really learned vs 6 much before changeing to 7. i feel a bit lost in it.
comment Posted March 24, 2005 Posted March 24, 2005 Wow, many questions... I'll try as best as I can: 1. Evaluate is NOT a text function; it's a logical function. 2. The global field name, wrapped in quotes is indeed text. It is the text of the FORMULA which Evaluate() will evaluate. It is the same as defining a calculation field: you get a window to input some text. Then the field will display the result of evaluating your (text) formula. 3. Therefore, Evaluate ("fieldname") is equivalent to putting a field name (without quotes) in a define calculation window. Since the name belongs to a date field, and the result is of type date, there is no conversion of data type. 4. Why not just put the field name to begin with? Why evaluate at all? Because your purpose is not (only) to evaluate, but to RE-EVALUATE. The optional fields in the Evaluate() function act as a trigger: when these fields are modified, the calculation will update its result. --- ADDENDUM --- Without Evaluate(), the auto-enter calculation will be performed ONCE, when the record is created (or, if the referenced field/s are empty - when they are first filled). Then it stays - unless a DIRECTLY referenced field is modified, and even then only the current record is updated. What you asked for is to update the result when ANOTHER field, one that does not influence the result of calculation, is modified. The Evaluate() function enables to refer to fields INDIRECTLY, and make them triggers for re-evaluation. Paradoxically, the "direct" reference is not: we are referring to the fieldname as text, so modifying the content of the field is NOT a trigger for re-evaluation. If you like, duplicate your Update field and change the auto-enter calc to: gUpdateDate + ( CallResults + ProgressNotes + SpokeWith + MeetingStatus ) * 0 Now modify the referenced fields and compare the response of the two result fields.
Søren Dyhr Posted March 24, 2005 Posted March 24, 2005 Just a quick comment as to why I put quotes around the field value that might graphicly residing in the header. If it is a datefield ...will typecasting turn it into the mathematical result. So if we take yesterdays date will it show a ? if you leave out the quotes. The reason is that it takes monthnumber and divides it with dayofmonth number and again divide it by the year.... and bearing in mind that all dates is represented by integers behind the scenes. Will it explain why! --sd
PiedPiper Posted March 24, 2005 Author Posted March 24, 2005 Please forgive taking your time. i kept thinking unclick do not replace would do same thing but i used your evaluate one Comment anyway. but secretary said it's broken. so i re-read this and saw your adendum and created a demo to try and figure it out. attached 1) when she creates a new record, both Updates insert that gUpdateDate. Not what we want. Only if sales call happens (something put in those special fields. 2) A wonky image of gUpdateDate appears partway in the first record line?? On her system and again now on mine. I can't click into it but it just is a ghost. Does it do that for you also? only when I change the date in the global. 3) Other than that, I see no difference between the update fields. They both seem to act the same. I had originally tried auto-enter replacement on Update. I tried If Call Results <> Call Results etc. that didnt work. I tried using timestamp modification compariosn. I now see i need to trigger. but changing anything in my sales fields - anything - DOES trigger change in auto-enter replace. Your auto-enter (update2) is what i had tried to do. it works also. So i still don't see difference between auto-enter and evaluate. Forgive my ignorance. if anything in refeerenced fields change they both change. this is difficult to understand, I guess. can you help me stop update from filling on new record? And can you give me example between Update and Update2 - i can't see difference between them. this is such an important issue to me understanding this. i feel like a great concept is in front of me and i can't see it clearly. thank you both for helping. Sales.zip
PiedPiper Posted March 24, 2005 Author Posted March 24, 2005 just found other issue she mentioned sorry when i tried using second calc instead. when she changes the global date, the record her cursor is in changes the date in update 2. if cursor isn't in a field it changes the last record - even if changes weren't made. also noted ... if you put field in quotes with evaluate be sure to type field name exactly because filemaker doesn't give you a field warning message like normal.
comment Posted March 24, 2005 Posted March 24, 2005 1. Perhaps the global field should be empty when a new record is created? It's a user interface thing. You might want to script the creation of new records - then you can clear the global first. IOW, the feature comes with a price. 2. No.
Recommended Posts
This topic is 7252 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