Jump to content

CHECKING FIELD FOR ENTRY


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

Recommended Posts

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 7343 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
 Share

×
×
  • Create New...

Important Information

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