AnsweredAssumed Answered

How to find matching fields and then go to first record in layout?

Question asked by cgallardo on Feb 18, 2012
Latest reply on Feb 27, 2012 by Mike_Mitchell

Hi all,

I am very new to Filemaker.I have only been using FM10 for a few hours every week since the start of the year and have very basic knowledge of databases so I am sorry if I use the wrong jargon.

I think my database tables and relationships are ok as when testing via the table views everything works as expected. Just having a bit of trouble setting up the user interfaces and some of the scripts.

 

This is (part of) my project:

MENU LAYOUT

Has a drop down box with the names of shops and another box with a calendar to select shipping dates.

There are also 2 buttons, Cancel and OK

 

This layout is attached (sorry if it is the wrong definition) to a Table (that is not related to anything, just a standalone table) called TempVariables. I didn't want to use a custom dialog box as I thought this way I get more control on formatting and scripting.

On Layout load, a simple script is run to silently request a new record creation.

 

Once the data is entered and the user clicks OK, the following script runs:

  1. Data is copied to global variables ($$ShopName and $$ShipDate). This is working
  2. A delete record request without dialog is done(to keep the TempVariable table 'clean').This is also working.
  3. Goto LAYOUT 2 - Display Purchase Order (attached to Orders Table). It is displaying the layout, but...
  4. ... and this is where I'm getting stuck. I am trying to use the global variables to find and display the first record that has matching fields for the Shop Name and Ship Date as defined in the Menu layout. If it does not find the record then it should silently create a new record. If it does find a record, the user can then edit the order (provided the ship date occurrs in the future, but that is a challenge I hope I can tackle this one on my own once I get there). I am able to get it to create a new record and preset the fields using the global variables, I just can't get it to go straigth to an existing one.

 

I had also created a calculated field in the Orders Table called ShopName-ShipDate, this as you may have guessed is a text field that concatanates the ShopName and ShipDate. I had done this hoping that I could use that field as some sort of an Index to make it easier to go to the desired record.

 

Thanks for you help.

Outcomes