kenneth2k1 Posted September 14, 2001 Posted September 14, 2001 How many operators and characters does FM Pro 5 allow in one calculation? I know that GoldMine only allowed 255 characters. For example, can I go like this?: If [(Status(CurrentDate) >= (Letters P Date1 or Letters P Date1.1) + 4) and (Campaign1 or Campaign4 = "Auto") and (Letters1 or Letters1.1 = "Intro")] Im hoping this says "If today is greater than or equal to the date in field "Letters P Date1" or the date in field "Letters P Date1.1" plus four days; AND the fields "Campaign1" or "Campaign4" contain the word "Auto"; AND the fields "Letters1" or "Letters1.1" contain the words "Intro". If it doen't meet ALL these criteria, I want it to omit the record, but I haven't tried it yet. Will it work or won't it. As always, thanks for all your guys' insight!
Kurt Knippel Posted September 15, 2001 Posted September 15, 2001 Filemaker will allow 64k in a calculation, which is 64,000 characters.
kenneth2k1 Posted September 17, 2001 Author Posted September 17, 2001 Thanks for the reply, Kurt. How many operators, though. For example, is the aforementioned equation possible, or will it even work? Thanks for all your help. Ken
Kurt Knippel Posted September 17, 2001 Posted September 17, 2001 I am not sure what you are asking? You have up to 64,000 characters with which to define your calculation. It matters not how many operators you use. However you do have a bit of a misunderstanding of how boolean expressions will be evaluated. They are evaluated similiar to mathmatical equations. I am almost positive that you do not want this: If (Status(CurrentDate) >= (Letters P Date1 or Letters P Date1.1) + 4) and (Campaign1 or Campaign4 = "Auto") and (Letters1 or Letters1.1 = "Intro") You probably want this: If ( (Status(CurrentDate) >= Letters P Date1 + 4 or Status(CurrentDate) >= Letters P Date1.1 + 4) and (Campaign1 = "Auto or Campaign4 = "Auto") and (Letters1 = "Intro or Letters1.1 = "Intro") ) Or something to that effect...
Kurt Knippel Posted September 17, 2001 Posted September 17, 2001 It depends on the context. I generally like to specify an ELSE conditional, since what often happens is that you are looking for A or B and you really get C, so what happens then? Without specifying the ELSE conditional, usually nothing and this can cause problems.
kenneth2k1 Posted September 17, 2001 Author Posted September 17, 2001 I really appreciate your help, and I could use some more. I wrote a script that is similar, but I've simplified it from what it was. It looks like this: Go to Layout ["Certain Layout"] Loop If ["Campaign1= "Auto") and (Letters1= "Intro") and (IsEmpty(Letters2)) and (Status(CurrentDate) >= Letters P Date1)" Insert Text [select, "Letters2", "1st FollowUp"] Insert Current Date [select, "Letters P Date 2"] Go to Layout ["1st Follow Up Letter- Auto"] Page Setup [Restore, No dialog] Enter Preview Mode [ ] Print [ ] Else Omit Record End If Go to Record/Request/Page [Exit after last, Next] End Loop Go to Layout ["Certain Layout"] Now, when I activate this, it goes to the layout I specified and inserts the text and current date in the desired fields, but to only ONE record (the last in the set), not to all records in the found set. Then it will print the layout "1st Follow Up Letter- Auto" for ALL the records. So I don't think its looping right. I want it to print the 1st Follow Up Letter for those who have the word "Auto" in field Campaign1, and current date is greater than or equal to the date in field Letters P Date 1. If the record does not meet these criteria, the I wanted it to omit the record. Can anyone help to point me in the right direction?? What did I screw up this time??
bobsmith Posted September 17, 2001 Posted September 17, 2001 Not to step on CaptKurt's replys but You need to have the Go to Layout ["Certain Layout"] inside of the loop since the fields you are updating are probably on "Certain Layout" and not on the letter layout.
kenneth2k1 Posted September 17, 2001 Author Posted September 17, 2001 Thanks so much, bobsmith. I really appreciate it.
kenneth2k1 Posted September 18, 2001 Author Posted September 18, 2001 Ah, I see. Thanks for enlightening me. I'll get it one of these days. Are there any good books or classes that you know of in this area? I live in San Diego, too. By the way, I have another question: Does an If function have to have an Else, or will it just ignore the record if it doesnt meet the IF criteria??
kenneth2k1 Posted September 19, 2001 Author Posted September 19, 2001 Okay, my script is still not working. I simplified it even more until I can get to the point where it works. I will write the script, then give the symptoms, or what occurs, and hopefully someone will be able to diagnose my ailment: Loop If [ "(Campaign1 = "Auto") and (Letters1 = "Intro") and (IsEmpty(Letters2)) and (Status(CurrentDate) >= Letters P Date1)"] Go to Layout ["Campaign Tab Layout"] Insert Text [select, "Letters2", "1st FollowUp"] Insert Current Date [select, "Letters P Date 2" Else Omit Record End If End If Go to Record/Request/Page/ [Exit after last, Next] End Loop LiveOak once told me that the layout is unimportant when dealing with fields, so thats the only extraeous thing I can see...but it shouldnt affect the script, should it? I have a sample database of 5 people, 3 of which are set up to meet the criteria of this script (Field "Campaign1" has the word "Auto" in it, etc.). I set it to the first record in the group. When this script is executed, only ONE record (the first record, I might add) will have the desired effect. It will filter down to the three that meet the criteria, though. The other two that meet the criteria will go unaffected. Now, when I set it to the LAST record in the group and run the script, the LAST record will have the desired effect, and it will NOT filter the group down. WHATS THE DEAL?? IM GOING NUTS!! I realize that I have left out the Go to Record/Request/Page First out, but does that make the difference? The next objective is to put the print command in there and hope it will work. PLEASE HELP!!!!
kenneth2k1 Posted September 19, 2001 Author Posted September 19, 2001 Oh, disregard the second End If. Thanks. KV
Rigsby Posted September 19, 2001 Posted September 19, 2001 Ok! Your first problem here is a simple one, and just a thought process mistake – your go to next record request is in the wrong place: Let me try to explain… If you omit a record, then FM is automatically on the next record, then (in your script) immediately gets a command to go to the next record, which means the current record is not processed by the script. I hope you are following this. The next point is that I would simply use a SetField step, and use the Today command to insert the date, if you do this, you can perform this script without any kind of special layout, as the fields you’re changing don’t have to be on the layout. Then, don’t even think about printing until the script has processed all the records and omitted the ones you don’t want. Then use a sub-script to print the current found set after going to the right layout. It’s hard getting to grips with someone else’s scripts, but I think what you want should look something like this: --------------------------------------------- (Go to Layout ["Campaign Tab Layout"])------This is not really needed. Loop If [ "(Campaign1 = "Auto") and (Letters1 = "Intro") and (IsEmpty(Letters2)) and (Status(CurrentDate) >= Letters P Date1)"] SetField [select, "Letters2", "1st FollowUp"] SetField [select, "Letters P Date 2", Today Go to Record/Request/Page/ [Exit after last, Next] Else Omit Record End If End Loop Go to Layout (PrintLayout) Perform Script “Print all” ----------------------------------- Hope this helps, Rigsby
Rigsby Posted September 19, 2001 Posted September 19, 2001 PS. You really can use up to 64,000 characters including operators in FM! However, in a calculating field, FM will sometimes crash, causing a fatal error in Windows, if you get to around 260. I always try to keep field entries and calculations under 250 – but have never had problems in a script, other than them being very slow if they are too long. Always try to find ways of splitting scripts into sub-scripts. This will also save you a lot of typing work in the long run, as you can use a script several times from other scripts. Rigsby
kenneth2k1 Posted September 20, 2001 Author Posted September 20, 2001 Thanks, Rigsby. I do appreciate your help. Forgive my ignorance, but I need just a little bit more remedial help using the Set Field function. Vaughan once told me to use it, but the calculation aspect threw me off. Which functions in Specify Calculation do I use so that my end result in the script is [select, "Letters2", "1st FollowUp"]? Vaughan told me to look up SetField in the FM help, but it seemed of little help. So what I guess Im asking is how should the calculation be to make it look like [select, "Letters2", "1st FollowUp"]? Once I get past this, I think I will be well on my way, and I can stop pestering this forum with the same darned script (Then I can pester you all with something esle!!) Thanks again for all your help!!
Recommended Posts
This topic is 8470 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