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.

Value for new record?

Featured Replies

  • Newbies

Hi guys,

I'm trying to do something rather simple (...I thought at least)....

I want to display a dialog so the user can enter a name for a "customer". If a record for this "customer" exists I want to display and edit this record, otherwise I want to create a new record with this name filled in.

Here is my script:

Enter Find Mode [ ]

Show Custom Dialog [ Message: "Please enter name:"; Buttons: “OK”, “Cancel”; Input #1: Customer::Name, "Name:"]

If [ Get (LastMessageChoice) = 1 ]

  Set Error Capture [ On ]

  Perform Find [ ]

  If [ Get ( LastError) > 0 ]

    New Record/Request

    Set Field [ Customer::Name ]

  End If

End If

The problem is that FM will create a new record if nothing was found (which is good) - but the name is not getting filled in :-(

Any ideas?

Thanks!

Hi

create a text global field (G_name) and display that in your custom dialogue box

Then enter find mode

Then set field customer name to G_name

Perform find

If no find

New record

Set field customer name; G_name

That should do it

Phil

  • Author
  • Newbies

Hi Phil,

....global field?

Sounds like a smart idea :-)

I will try to get it working and post back once i've got it working (...or not ;-))

Thanks!!!

I do on the other hand consider the use of globals exaggerated, although it might have it's place here? I have the habit of being critical to the methods of crafty developers as well as newbees, and have therefore toyed with how to avoid a global in this case.

Take a look at the above scripting, it's a paused recursive script, which running thru's provides the records with ID's. There are two issues in this

1) In multiuser environment might two users create records almost simultainiously ...if an ordinary autoenter was in use would the ID's very quickly get very very large and put a strain on the indexes to send as packages over the network ...so I have chosen a "stuff the holes in the cheese"

approach.

2) If a record is deleted is there a lower record ID available, why not use it?

And why is it that I find globals needs to get stigmatised?? They're stored on the local machine, so all dealings with ohter fields will cause chatter over the network ...the good question is then if my WEIRD way of substantial scripting the matter, really makes cut's in this chatter or just makes it occure in another way?

I'm not at present in an environment where I can measure it, but I know that I would use this tool to monitor it:

http://www.entropy.ch/software/macosx/welcome.html#tcpflow

I do this because "questioning things" is the engineers/developers most urgent behaviour/qualification of them all, in order to get into a topic - although it might prove to be a cul de sac, might something be learned from it anyway!

--sd

test.jpg

  • Author
  • Newbies

Hi Phil,

...and as expected I seem to have problems like a typical FileMaker beginner:

How do I display a variable in an Input Field in a custom dialog? I can only manage to display a field from the database :)-(

Or did I misunderstand your solution and you suggested the creation of a global field in the database???

Thanks!

~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi Søren,

I'm from a Java/C++ background and hence usually very opposed to the usage of globals as well.

It's just: For what I need and the environment where it will be used I'm perfectly fine with a global. I'm just looking for the easiest solution!

Thanks for your input anyway, greatly appreciated!

Yes you will have to create the global before you can display it

Phil

  • Author
  • Newbies

Thanks Phil, I got it working now :)-)

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.