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

CHECKING FIELD FOR ENTRY

Featured Replies

Thanks for taking the time to read this post. I am making another script that enters "certain text" into either field1 or field2, after a certain layout prints. However, field1 may already have text in it. The text already there could be anything. So, I would like the script to first check if field1 has text. If no text is found in field1, then enter "certain text". If there is text already, go to field2 and enter "certain text." If field2 already has text in it, then I would like the script to omit these records, give a message that records have been omitted,then show these omitted records on a layout of choice.

As always, all your guys' help is appreciated!

And your question is? (This is like Jeopardy, we like your responses in the form of a question!) wink.gif" border="0.

-bd

Kenneth, you've actually written down the algorithm perfectly!

Taking on from the Print step...

code:


Print []

If[isEmpty(field1)]

Set Field [field1, "certain text"]

Else

If[isEmpty(field2)]

Set Field [field2, "certain text"]

Else

Omit records*

Show Omitted records*

Show Message [Records have been omitted.]

Go to Layout [of choice]

End If

End If


* Now the "Omit Records/Show Omitted" steps of the script will need to be worked on a bit. It's posible that they're not necessary, depending on which records are in the current found set at the time the script performs. For instance, if the current found set is the records that might need to be omitted, then do, nothing. I'd guess that if you are printing the records then that would be the case.

Of course your phrase "omit these records" might not be meant in the FMP-literal sense, maybe more like "keep the separate and show them separately."

See, you've done the hard part already -- worked out the algorithm!

  • Author

Perfect! Thats just what I needed. The actual code to put it all together. Thanks alot for taking the time to work that out.

ken

  • Author

Vaughan:

Ok, I tried to make the script like the way you wrote it out, but I had trouble on this part:

Set Field [field1, "certain text"].

When I go to the Set Field function, the brackets come in, but I cannot make it specify [field1, "certain text"]. When I go to Specify..., and try to write it out in the calcuation it tells me "there are too many separators."

I have FM Pro 5, and I was wondering what the actual procedure is to make the script look like: "Set Field [field1, "certain text"]"

Thanks for all your help!!! Really

This is an RTFM question: read the help on using the Set Field function. It's painfully easy.

  • Author

Hope its not painful (haha). Thanks for staying in contact.

Ken

P.S. Prayers for those killed in Manhattan and the Pentagon

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.