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.

Add new

Featured Replies

Hi

I have delibrately taken off add new company from the startup layout on my database so people need to look before adding a company. Is there anyway that after a search reveals no returns that I can offer an option box to add new company, i.e run a script???

Or is there a better way?

Thanks

Simon

Simon,

Write a find script, such as

Set Error Capture [On]

Enter Find Mode []

(Then perform your find for the company)

If ["Status(CurrentError) = 401"]

Show Message [ Company Not here. Would you like to create company?]

(Or you could use Show Custom Dialog if you are using FM 6)

If ["Status(CurrentMessageChoice) = 1"]

NewRecord/Request

Else

ShowAllRecords

Exit Script

End If

End If

Hope this helps

Dean

I do something similar with book titles. If your companies have a unique ID that will be manually entered by the user (as opposed to an auto-serial field), this will work. For books, they all have ISBN numbers, so the unique ID is set ahead of data entry. If you don't, then you should use a field for a new company that will be unique to the company, like street address or company name. This could be a problem if the data entry isn't exact. Here are two variations on both, for example:

Acme Co.

Acme Company

123 Main St.

123 Main Street

These will both fail the attempt to locate an earlier record for this company. But, assuming the data is exact, and calling the company name field CoName for the purpose of this example, you could set up a self-join relationship based on CoName and a global user entry field I'll call g_CoName. Have the user run a script that will not make a new record (yet) but place them in the g_CoName field and pause. They fill in the company name and hit the enter button or click Continue.

Then you have a test for a previous record based on the self-join between the global and CoName

If (IsValid(Self-Join::CoName)

Show Message ("Company already exists.")

**Do whatever else you need**

Exit Script

Else

New Record/Request

**Data entry stuff*

End If

If you need to direct the user to the previous record at the point a match is made, under the Show Message you could put a Go To Related Record (Show, "Self-Join"). This will leave the user on the older record that was about to be duplicated as it exits the script.

Note that this test happens before a new record is created, via the global field. This way, if there is a match, you don't have an extraneous new record that needs deleting.

Steve Brown

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.