lilwolfpro Posted September 6, 2005 Posted September 6, 2005 I have a field that via a script, pastes a value into a field on my main layout. When using the "If" function, Filemaker will not read the value. EX If ((Grade="A"); "1"; "0"). The field contents are equal to "A", yet the formula still returns "0". Any idea's how to fix this? I have made sure the calculation results match the output. It seems to think the pasted contents are empty or something...Thanks-Julie
SlimJim Posted September 6, 2005 Posted September 6, 2005 You will probably need to Commit the record after the pasting.
Ender Posted September 6, 2005 Posted September 6, 2005 FYI, the If() function is redundant. Grade = "A" produces the same result.
lilwolfpro Posted September 6, 2005 Author Posted September 6, 2005 Yes I know, it is an example, the rest reads... If ((Grade="A"; 5; If (Grade="B"; 4; If ((Grade="C"; 3...etc. I have tried the commit record and it isn't working. I have looked at the way the info is stored and haven't been able to make the formula work : It should be easy, can't figure out what I am doing wrong.
stanley Posted September 6, 2005 Posted September 6, 2005 I don't think the Commit is the issue - you're not getting a positive result from your If() statement. Check your syntax, check what's actually in the field. I notice that the first posting has a space in the If() - Grade = " A". You should really be using a Case() statement rather than nested If()s. -Stanley
LaRetta Posted September 6, 2005 Posted September 6, 2005 that via a script, pastes a value ... and ... It seems to think the pasted contents are empty Well the contents SHOULD be empty until you put something in! What was there before? The Grade? Your example does not specify which field you are setting and which you are deriving your results from. Is the IF a script-step or part of the calculation? You can't use a calculation in a paste step and if your calculation provided is an If() calculation, the syntax is incorrect anyway. You also can't paste into a field you are testing for a value because, of course it would then say the value was no longer a grade because the paste has already happened, thus producing 0. Illogical. Please provide your script and exact calculation and FIELD NAMES so we can provide accurate assistance. LaRetta
lilwolfpro Posted September 6, 2005 Author Posted September 6, 2005 Okay see if this helps. I initially ran a script that goes back into another database and copies data from a certain date. So, it goes back and copies the grade, then in my main data base, pastes the letter into the grade field. On main database, main layout where grade was pasted, I have field is supposed to be a calculation field that gives me points for an A,B,C,D grade EX. Case ( GRADE = "A" ; 4 ; GRADE = "B" ;3 ; GRADE = "C" ;2 ; GRADE = "D" ;1 ; GRADE = "F" ;0 ) The Grade field is the one that results were pasted into via an earlier script. I think you are right, it sees the field as empty instead of evaluating the pasted value.
LaRetta Posted September 6, 2005 Posted September 6, 2005 (edited) Yes that helps, thanks. But I'm still unsure of your structure or how your script works. It would depend upon what fires the script, ie, if User does then you can (possibly) use script parameter to pass the value. I wouldn't use copy/paste. But you must figure how you will grab the grade if the tables are unrelated. Are they unrelated and that's why you're not using Set Field[]? You can't mix copy/paste with calculations. You could set a global text field then evaluate that field to set your new field. It doesn't matter WHERE this global resides. Something like: ... go to other table and find your grade field value Set Field [ globalField ; thisField ] ... go to main layout Go To Layout [ Main ] Set Field [ newField ; If(not IsEmpty(globalField) ; Position("FDCBA" ; globalField ; 1 ; 1 ) - 1) ] If your other script is already in place (which sets the Grade) and is already in the Main table, then you can just use the Set Field[] line by itself. BTW, this calc does what Case() does but more efficiently. It just assigns a number to the grades to their order listed. UPDATE: I can't help but wonder why you don't just use a calculation for this new field. If you are setting a Grade field in your Main table, then create a calculation out of that Set Field[]. Then you'll never have to set it again! I feel like I'm working blind into your solution. Oh that's so true too! LaRetta Edited September 6, 2005 by Guest
lilwolfpro Posted September 7, 2005 Author Posted September 7, 2005 Thanks for all your help. I think you are way more knowledgeable than I am. I'm not familiar with the SetField command. I ran the first script on over 2000 records so I didn't want to re-run the script if not necessary. Each record in the main database is set up with an inequitable date relationship with the stat table(where the grades are stored) so no values from the other records are included after the date of the record. So since I did not know how to get the grade out of the portal, I wrote a script to go find the grade in the first stat record that predates the main database record date, cut that grade and pasted it in the main database. Now I want evaluate those fields and convert them to numbers. However since filemaker pro will not see the pasted results (they show up on my screen but apparently not valid for calculation), I can't figure out a work around.
LaRetta Posted September 7, 2005 Posted September 7, 2005 (edited) The logic of your process is still escaping me. Can you post a file? You should become familiar with the Set Field [] script-step; it is probably the most valuable tool in FM. It would help to see your structure. If you can't post your real file (empty clone is fine), then create a demo file with just the pertinent tables. We need to see the thinking behind what you are trying to accomplish. I can tell you this ... there are easier ways of handling your process. Regardless of the complexity of a solution, I have never had to resort to such techniques. I suggest taking the time to hone your process here and now. And if you take the time to really GET IT, you can use that knowledge in many other situations. Now is the opportune time to learn something quite valuable - while you are in the coal face of a specific problem. In fact, taking the time to create a demo file is the best advice I can give. Because, when you are attempting something within the complexity of a full solution, your vision gets muddied and the solution, even if it works, can remain unclear. We'll help you through this one; if you wish. I won't be available again for another 9 hours but there are many on here who can help you also. If not, I will help you tonight with it. If copying the grade over is a one-time process and now you simply need an Auto-Enter (Replace) calculation, the calc I gave will certainly work. But I have too many missing pieces to suggest the best solution for you. If that portal first row contains the grade you need and it is the first related record in that relationship, it is simple: Set Field [ newNumberField ; If(not IsEmpty(portalRelationship::Grade) ; Position("FDCBA" ; portalRelationship::Grade ; 1 ; 1 ) - 1) ]] LaRetta Edited September 7, 2005 by Guest
lilwolfpro Posted September 7, 2005 Author Posted September 7, 2005 Okay, I am going to attach a demo version of the file. The fields in orange are the ones I am trying to compare. I was initially trying to change them to numbers to evaluate, but let's see if you can figure this out to work without that extra step. What I want to do is have the field "Dog 1 Grade Jump" to result in "SAME" if the field "grade" is equal to the field "Dog 1 LRG". If the field "Grade" reflects an "A" and "Dog 1 LRG" is a "B", I want the result to be "DOWN" in field Dog 1 Grade Jump. If the field "Grade" reflects an "B" and "Dog 1 LRG" is a "A", I want the result to be "UP". If the field "Grade" reflects an "C" and "Dog 1 LRG" is a "A" or "B", I want the result to be "UP". This will of course continue for all grades. Dog 1 LRG is the field I did the cut and paste script, it is however equal to the 1st portal row, field PP_Grade, if that helps. Keep in mind there are 7 other portals in the original file for dogs 2-8. Thank you so much for taking the time to help me expand my knowledge of Filemaker Pro. Julie dogzip.ZIP
Recommended Posts
This topic is 7084 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