Rob 7 Collins Posted March 3, 2005 Share Posted March 3, 2005 Ok, this post has a decent ammount of background before I get to my question. I wish I could find a more terse way to put this, but ... I've got a fairly complicated dataBase (for me at least). In it I must keep track of people such as program directors, primary contacts, consumers, etc. Each person has similar information, but not always the same -- So I've a schema that limits data replication, something like: [telephoneNumbers]+[telephoneNumbers]+[addresses]+[basicPersonsInformation]=>[programDirector] or: [telephoneNumbers]+[addresses]+[basicPersonsInformation]=>[comsumer] All telephone numbers are in the telephone numbers table. To use one as a FAX number I create a number field "FAX.primk", in the person-type table, that is related to the primary key for the telephone numbers table. Home/work addresses work the same way; but data that isn't uniform across all people-types in the database (like website, for example) reside in the person-type table. The distinction between directors and consumers is useful in more than just the ability to fine tune the unique data. Sometimes the same person is in many tables, each only needing particular details or even contradictory ones. I've got a layout for editing the program director records, with portals to data from each relation (as defined in the FAX.primk ... etc). Not all the information in a portalled record is available for editing from the portal in the person-type layout. When a user wants to add or edit the data, things can get a little complex... I need a script to automate the flow of adding and editing data. What I've done is made a "add/edit" button for each portal. It guides the user through populating/editing data in a portal in this one record. I run into a problem in both the editing and populating branch, where I'm not sure how to handle multiple records if they are searched for (in the editing branch it is implied, because it pauses in browse mode but if the user changes mode, the script's continue button is lost). Here's one such script: #If this record is new go to the basic Person page and start a find request, #otherwise go to this basic Person entry for editing. If [ IsEmpty( CatalogContact::Person.primk ) ] Show Custom Dialog [ Title: "Add a new Catalog Contact"; Message: "You are adding a new catalog contact, or fixing an existing one that is missing an assocaited basicPerson entry. This entry contains valuable information like their name, gender, primary languge, and date of birth. <newline> Press Okay and start by checking if the correct person entry is already in the database. You will be taken to the Persons page, in Find mode. After you have entered your search terms, press the Continue button on the Status Area. <newline> Press Cancel to abort this action and return to the Catalog Contact page"; Buttons: "OK", "Cancel" ] If [ Get (LastMessageChoice) = 2 ] Exit Script End If Go to Layout [ "Person Entry Page" (UtilityTable.Person) ] Enter Find Mode [ ] [Pause] # Without a direct way to see the count of found results, # this cludge will have to do: Set Error Capture [On] Go to Record/Request/Page [First] If[ If ( Get ( LastError ) = 0; 0; 1 ) ] #--if there is an error, no first record, enter here: Set Error Capture [Off] Enter Browse Mode Show All Records Show Custom Dialog [ Title: "Add a new Person Entry"; MEssage: "I did not find a matching person entry. <newline> If you would like to add an entry, in the following screen add your information, then press the Continue button in the Status area. <newline><newline> Would you like to add a catalog contact?"; Buttons: "Yes", "No (cancel)" ] If [ Get ( LastMessageChoice ) = 2 ] Go to Layout [ original layout ] Exit Script End If # User has searched for a suitable person entry, found none, and now will # add a person entry New Record/Request Pause/Resume Script [ Indefinitely ] Copy [utilityTable.Person::primk ] Go to Layout [ oringial layout ] Paste [CatalogContact::Person.primk ] [select] Commit Records/Requests [ No dialog ] Else # There is at least one found person entry Set Error Capture [ Off ] Enter Browse Mode Copy [ Utility Table.Person::primk ] [select] Go to Layout [ oringinal layout ] Paste [ CatalogContact::Person.primk ] [select] Commit Records/Requests [ No dialog ] End If Else # The user has clciked the button while the portal was populated, so they # want to edit the person's entry Go to Field [ CatalogContact::Person.primk ] Copy [ ] [select] Go to Layout [ "Person Entry Page" (UtlityTable.Person) ] Enter Find Mode [ ] Paste [ UtilityTable.Person::primk ] [select] Perform Find [ ] Show Custom Dialog [ Title: "Person Entry Ready for Editing"; Message: "You should now be able to edit theperson entry. When you are finished, click the Continue button on the status bar"; Buttons: "Ok" ] Enter Browse Mode Pause/Resume Script [ Indefinitely ] Commit Records/Requests [ No dialog ] Go to Layout [ original layout ] End If Link to comment Share on other sites More sharing options...
This topic is 6597 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
Already have an account? Sign in here.Sign In Now