August 6, 200619 yr I am trying to write a script that would let me search for a particular phone number in 4 different fields (home phone, wk phone...). thanks
August 6, 200619 yr Again... had this been in related structure it wouldn't be a problem. You'll have to specify four different requests in this case. (Enter Find Mode, set work phone, new request, set home phone, new request etc. etc. perform find)
August 6, 200619 yr Author How can I change it to related structure. How do I set up a script to do the find.
August 6, 200619 yr To setup the related structure, you will need a primary key in your main table. Then create a secondary "numbers" table. In that table, create a "foreign" key field, a "Type" field and a "Number" field... all text. Next, relate your main table to your secondary table by primary key to foreign key -- (double click your newley formed relationship - and on the child side (your numbers table) turn on Allow Creation of records in this table via this relationship). Then go back to your main layout -- make sure its based on your Main Table TO... add a portal to the numbers table, add the Type and Number field, and voila - you have related structure. Or search... You'll have to create a layout with global fields to accomplish this... Create your layout - one field of which is the phone number field. Take the user to this layout to search, then, have them hit a search button which... takes the phone number, goes to the real layout, generates 4 find requests, one for each number type and then searches... e..g Go To Layout[Main Layout] Enter Find Mode[] Set Field[MainTable::WorkPhone ; globalNumber] New Record / Request[] Set Field[MainTable::HomePhone ; globalNumber] . . . . Perform Find[]
Create an account or sign in to comment