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.

Create a new record from a find

Featured Replies

I was wondering if there is a way to create a new record if the find does not have a result.

Example:

I search on first and last name but nothing comes back so it takes my find criteria and sends me to the page where I could edit the rest of the record with the first and last name already filled in.

Am I on the right track?

Easier than you think.

No records found is error 401, and the format file specified by the -error tag is returned. I'll assume it's called "error.htm".

In error.htm, put a [FMP-If: CurrentError.eq.401]. Inside the IF, put the form to create the new record with all the appropriate CDML tags.

If the error.htm file has more than one [FMP-If] -- highly likely -- ensure that they are nested something like this:

[FMP-If: CurrentError.eq.401]

form to create new record

[FMP-Else]

[FMP-If: CurrentError.eq.401]

stuff for XXX error

[FMP-Else]

general "an error has occurred" message

[/FMP-If]

[/FMP-If]

Nesting them this way, you can trap for as many error codes as you need and provide specific responses. I've trapped for 101 (record is missing), 401 (no records match request), 504 (failed "unique" field validation), 509 (failed "not empty" field validation) on the same error file, but always remember to have an "else" with a generic error message for the odd occasion that something actually goes wrong.

  • Author

How do I get the first and last name to be placed in the fields of the new record page.

I guess what I am trying to do now is to create a new record and bring them to the edit page. Can this not be done? I hope I'm being clear. Let me know if you need more of an explanation.

KT

  • Author

This is what I have figured out so far:

I set the input fields as tokens and then the format file does a redirect to this link:

http://xxx.xxx.xxx.xxx/FMPro?-DB=scoe_participant.fp5&-Format=scoe/duplicatecheck.html&-Max=all&first=[FMP-CurrentToken:7, URL]&last=[FMP-CurrentToken:8, URL]&-Token.0=[FMP-CurrentRecID]&-Token.1=[FMP-CurrentToken:1, URL]&-Token.2=[FMP-CurrentToken:2, URL]&-Token.7=[FMP-CurrentToken:7, URL]&-Token.8=[FMP-CurrentToken:8, URL]&-Token.9=[FMP-CurrentToken:9, URL]&-Find

It seems to go through this page fine. When it gets to the next page it goes through this check:

[FMP-If: CurrentError.eq.401]

<meta http-equiv="refresh" content="0;URL=/scoe/register.html">

[/FMP-If]

If there is a find it will display the page. If there is not a find I'm still getting the 401 error when it should be going to the redirect page . . . correct?

Any Solutions?

Thank you

Kent

quote:

Originally posted by Turansky:

[FMP-If: CurrentError.eq.401]

<meta http-equiv="refresh" content="0;URL=/scoe/register.html">

[/FMP-If]


See if the following works instead:

[FMP-If: CurrentError.eq.401]

[FMP-Header]

HTTP/1.0 302 FOUND

Location: /scoe/register.html

[/FMP-Header]

[/FMP-If]

Note: you can use a FileMaker call after Location: to redirect to another -Format file. This can be handy for editing multiple records over the web, if the user doesn't mind having the page refresh over and over and over... smile.gif

  • Author

I still get "No Records Found" Not sure what I'm doing wrong.

Kent

I missed one detail in your link: include an -Error= tag to call the page that handles errors.

In your case, the -Error page would be the same as your -Format page, since your -Format page is handling the error (if any).

  • Author

That was the trick . . . although now I have other problems but I will work on those for awhile so I can gather my thoughts.

Thanks for the help!

Kent

BTW, META is HTML HEAD tag and cannot be used within the page.

Using an extension of Vaughn's solution I would do this:

[FMP-If: CurrentError.eq.401]

[FMP-InlineAction: -db={Currentdatabase}, -lay={Currentlayout}, firstname="{Currenttoken:1}", lastname="{Currenttoken:2}", -new]

[FMP-Include: edit.html]

[/FMP-InlineAction]

[FMP-Else]

[FMP-If: CurrentError.eq.0]

[FMP-Include: edit.html]

[FMP-Else]

general "an error has occurred" message

[/FMP-If]

[/FMP-If]

The "firstname" and "lastname" would need to be assigned as tokens in the original page.

All the best.

Garry

[ February 07, 2002, 05:42 PM: Message edited by: Garry Claridge ]

  • 4 months later...
  • Author

Hello all,

In Netscape 4.7 on a Mac if a CurrentError 401 is found as a result of a find I get a syntax error that pops up and the person cannot complete the process. Has anyone run into this and have you found any workaround?

Thank you

Kent

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.