Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

When to use end loop?

Featured Replies

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

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

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

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

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

Bloomin heck I didn't realise that cut and past where steps. I thought they were part of his field names!!

Tut tut - to you as well!

--sd

  • 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!

  • Author

How can I get rid of the copy and past?

Devin

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

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

  • 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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.