Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6721 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

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 by Guest
Posted

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

Posted

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

Posted

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

Posted

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

Posted

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!

Posted

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

Posted

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).

Posted

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

Posted

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

This topic is 6721 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.