June 28, 200619 yr OK, I'm trying to right a script that needs to check several things. But I'm not sure where to put the end loop or at least that's the error I get. If[ Pattern count (warehouse Main::Plated for;"236")] exit script Here is where I get lost. I now need to check another field called Main::Plated_Location[4] It needs to check and see if has 629 or 840 if 629 do one thing if 840 do another. If[ Pattern count (warehouse Main::Plated_Location[4];"629")] Cut warehouse Main::Plated_Location[4] Past warehouse Main::Plated_Location_629 exit script If[ Pattern count (warehouse Main::Plated_Location[4];"840")] Cut warehouse Main::Plated_Location[4] Past warehouse Main::Plated_Location_840 exit script Edited June 28, 200619 yr by Guest
June 28, 200619 yr Hi you need neither an EXIT LOOP, neither an EXIT SCRIPT, but only an END IF So: If[ Pattern count (warehouse Main::Plated for;"236")] exit script else If[ Pattern count (warehouse Main::Plated_Location[4];"629")] Cut warehouse Main::Plated_Location[4] Past warehouse Main::Plated_Location_629 else If[ Pattern count (warehouse Main::Plated_Location[4];"840")] Cut warehouse Main::Plated_Location[4] Past warehouse Main::Plated_Location_840 End if
June 28, 200619 yr Hey there - What your script should look like is this: If[ Pattern count (warehouse Main::Plated for;"236")] exit script else If[ Pattern count (warehouse Main::Plated_Location[4];"629")] Set Field[ Warehouse Main::Plated_Location_629; Cut warehouse Main::Plated_Location[4] ] exit script else If[ Pattern count (warehouse Main::Plated_Location[4];"840")] Set Field[ Warehouse Main::Plated_Location_840; Cut warehouse Main::Plated_Location[4] ] exit script End If No need to copy and paste when you can use Set Field() I hope that helps Martha
June 28, 200619 yr Devin the else if might be the answer to your problem If[ Pattern count (warehouse Main::Plated for;"236")] exit script else if Pattern count (warehouse Main::Plated_Location[4];"629")] do whatever else if Pattern count (whatever 2) do whatever 2 endif you can keep going on with the else if's until you have done all your tests but this set of if's will end once one of them proves true. Then it will not test for any of the following. To do that you need a series if if statements If this do that end if if that do the other end if etc Phil
June 28, 200619 yr Get rid of the exit scripts, and use Else if and End If instead. Next issues are stop using cut/paste and repeating fields ...and Plated_Location_# is not particular healthy either, because you're using way too many fields in one table! --sd
June 28, 200619 yr Bloomin heck I didn't realise that cut and past where steps. I thought they were part of his field names!!
June 28, 200619 yr Author Søren Dyhr I'm not sure what your saying by plated_location_# is not healthy? The # will be the press name. each job can be plated on more then one press. I'm still learning and I'm glad that there may be a better way!
June 28, 200619 yr each job can be plated on more then one press Yes but it could be the same field in different records in a realted table....say you have 850 press'es would you then really start out and define 850 different fields with identical behaviour and context. How can I get rid of the copy and past? By not using them except in rare occations where your data should be used by another application, say a spreadsheet or a web browser ...but never ever with the inner mechanics of a filemaker solution! --sd
June 28, 200619 yr Use the Set Field script step instead. It has the advantage of not destroying the current contents of the clipboard (imagine your users wondering what happened to their data in the clipboard) and doesn't require the target field on the current layout (don't marry your script to a layout or a modification to a layout may disable your script).
June 29, 200619 yr Author What I'm trying to do is clean up the database! This script that I'm trying to write is a one time deal, I just need to go thru all the records and move stuff to their correct location. They out grew their db and the db was not well done from the get go. They were on V4. There are not that many presses, no more then 8. but I do see your point, but for this project it would be a huge pain to break them up. Right now they have 60,000+ records. I'm still not understaning how the setfield command can replace the cut from one filed and past to another field. an example would be great! Thanks Guys! Devin
June 29, 200619 yr I'm still not understaning how the setfield command can replace the cut from one filed and past to another field. You should think of two _Set_Fields_ Set Field [ yourFile::FieldB; yourFile::FieldA ] Set Field [ yourFile::FieldA; "" ] Does the same as you would expressed this way: Cut [ yourFile::FieldA ] [ Select ] Paste [ yourFile::FieldB ] [ Select ] --sd
Create an account or sign in to comment