WingMaker Posted September 17, 2008 Posted September 17, 2008 Hi all I have a pretty good understanding on how filemaker works, I just cant get this script around my head. I have a script in which users fill out fields using the Show Custom dialog script. Initially the script ran as show custom dialog (title;please enter;field1) replace field contents (field1;current contents) This script ran fine up until recently where new exceptions are brought up. So far I came up with an IF nest for the exceptions but it does not seem to work. If(field1 = English) show custom dialog (title;please enter part number; field1) replace field contents (field1;"I cant figure out a calc that only replaces contents with only english in field 1" If(field1 = Spanish) show custom dialog (title;please enter part number; field1) "the same replace contents as the one above but now only for spanish" End If End If This goes on for several other languages, I just need help on getting it started. If you need more information let me know. cuz i can be kinda vague sometimes. thanks ricky
mr_vodka Posted September 17, 2008 Posted September 17, 2008 i see a few things wrong with this. First is field1 a global field? Second the script should be something along the lines of: show custom dialog (title;please enter;field1) If(field1 = "English") Set Field [ YourOtherField; "English" ] Else If(field1 = "Spanish") Set Field [ YourOtherField; "Spanish" ] End If etc etc etc... I am not following what exactly you are trying to do here. I am not sure if you are trying to set a value to many records of just the current one.
WingMaker Posted September 17, 2008 Author Posted September 17, 2008 thanks for the reply, Field1 is not a global field. there are more than one record. The records get import from another table, three fields get populated from this import (one of them is the language) After that the the dialog boxes show up allowing the rest of the fields to be fill out, there is different kit numbers for different languages here is the script If(Mailing::Language = "english") show custom dialog ["Kit Number?"; "Enter the Kit Number for English.";Mailing::KitNumber] Replace Field Contents [No dialog; Mailing::KitNumber; Mailing::Language = "english"](this calc doesnt work, i want it to replace the fields only with english) If(Mailing::Language = "spanish") show custom dialog ["Kit Number?"; "Enter the Kit Number for spanish.";Mailing::KitNumber] Replace Field Contents [No dialog; Mailing::KitNumber; Mailing::Language = "spanish"](this calc doesnt work, i want it to replace the fields only with spanish) etc... any help? ricky
Vaughan Posted September 18, 2008 Posted September 18, 2008 A couple of things: Usually after a custom dialog the script branches depending on which button was clicked. Show Custom Dialog [] If[ Get( LastMessageChoice ) = 1 ] Else If[ Get( LastMessageChoice ) = 2 ] Else End If The trick with custom dialogs is thus: when they are used for field entry, the data is only carried through when button 1 is clicked. You can still branch the script for the other buttons but whatever was entered into the dialog will not be inserted into the field. Secondly, it's common practice to use a global field to temporarily store the value from the custom dialog and then use it later in the script. Thirdly, the Replace script step modifies all records in the found set (which can be all records in the table) so be careful when and where it's used. Don't use it to change the current record, for instance; use the Set Field[] step. It's time you started telling us what you want to do. Guessing games aren't fun after a while.
David Jondreau Posted September 18, 2008 Posted September 18, 2008 I think you're actually making more work than necessary. It sounds like what you're trying to accomplish does not need user interaction (ie a custom dialog) at all, just a more refined script. Can you describe your actual task in real world terms? What are the other two fields that get populated on import?
WingMaker Posted September 19, 2008 Author Posted September 19, 2008 hi, import script is presented. the fields that get imported are: language, quantity, and country code. then dialog boxes pop up to have the rest of the fields get populate: this includes Name, Kit Number, Letter Number, Serial Number, and Customer Number. The data is being provided by the user; the fields Name, Serial Number, and Customer Number are all the same for the records being imported. Kit Number and Letter Number each have different values based on the different Language; e.g "English" Kit Number = 123-456, Letter Number = 654-321" "Spanish" Kit Number = 123-457, Letter Number = 654-320" etc, etc, there are 7 languages total. I need help on populating these two fields based on the language for that record. Also the multiple records could have the same language ergo will have the same Kit Number and Letter, thats the reason why I need the replace contents script, or something else? Help please? Ricky
David Jondreau Posted September 19, 2008 Posted September 19, 2008 You don't explain what physical objects you're actually trying to keep track of here. That would be helpful. But it sounds like what you need is a new table that contains a record for each Name/Serial Number/Customer combo. Each record would have fields for Kit Number and Letter Number in each language. That way all you need is the user to enter the Name/Serial/Customer once in a single dialog box, then all the rest of the fields can auto-populate, either via lookups or a Replace command.
WingMaker Posted September 30, 2008 Author Posted September 30, 2008 Hi, Sorry I havent posted in a while, but I still need help. Two fields get inputed from the user by the dialogs boxes. Top Kit Number and Letter Number. But there are exceptions: there is a Letter Language field. This field could have 7 different languages, Spanish, English, Japanese, etc Each language will get a different Top Kit Number and different Letter Number. There could be none, one or many records with the same language. If it is more than one, each record with "Spanish" gets the same Top Kit Number and Letter Number. ( This is where I was using the Replace Contents Script but it doesnt work) This is where it gets tricky, the records are being brought over already in a found set. For example if 10 records are presented: 3 have the letter language for Spanish, 5 for English, 2 for Japanese. (as you can see the other languages are not there, the script needs to know that only these three languages are present) Once that happens, the dialog boxes appear asking for the Kit Number and Letter for Spanish, then it should populate the three records for Spanish; same for the other languages. I have a huge If nest in my script, but it begins something like this set variable = [$Language; Value= Letter Language] If [$Language = "English"] show custom dialog= "Enter Kit Number" //replace field contents This is the same pattern for the other languages. Obviously this doesnt work. lol. I hope I explained it better thanks
David Jondreau Posted September 30, 2008 Posted September 30, 2008 Again, you haven't said what you're trying to accomplish in the real world. It makes it difficult to give suggestions when talking about the abstract and in terms of "Top Kit Number" when I don't know what that means. I would question why you have users entering information at all. It sounds like a properly constructed database could do it all.
Recommended Posts
This topic is 5899 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