Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

  • Newbies
Posted

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!

Posted

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

  • Newbies
Posted

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!!!

Posted

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

  • Newbies
Posted

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!

This topic is 6726 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
×
×
  • Create New...

Important Information

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