Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Relationships Issue


Onesimus

Recommended Posts

I need help with a relationships problem (No – not a personal relationships problem!)

 

I have been given 2 databases for a charity I am a volunteer of. The first is called “Clients” (details of people visited by the charity) and “Visits” (Details of assistance given to clients).

 

In the “Clients” database, the “Find A Client” and “Add New Client” buttons work OK. It is the “Go To Visits” button that is not working correctly. When clicked, we would like the following to happen:

 

1.The file “Visits” is opened.

2. A new record is created

3. The first name and surname of the client selected in the “Clients” file is inserted in the First Name and Surname fields of the “Visits” file.

 

Unfortunately, it is not doing this. I have tried the following script:

 

Open File [“Visits”]

New Record / Request

Set Field[Visits::Fullname;Clients::Fullname]

 

(In the Clients file, Fullname is a calculation field = to FirstName & Surname)

 

I would appreciate any assistance with this problem!

Link to comment
Share on other sites

I changed your relation that records in Visits file create automaticaly if you fill portal. Now what you want to do if you press "Go to Visits" button?

Link to comment
Share on other sites

Thanks aaa

What I want to do when the "Go To Visits" btn is pressed is as I stated in my first post - Go to "Visits", create a new record, & insert the first and surname of the person you found in the "Clients" file.

 

Hope this helps!

 

Onesimus

Link to comment
Share on other sites

Thanks aaa! You were right - it does work!

 

One query - every time you press the "Go To Visits" btn, it creates a new window. If you have a lot of clients to enter, you will get a lot of windows. Is there any way of only having one window only?

 

I went to the "New Records" script in the Visits file and saw that the first line of code was New Window []. I deleted this line - but found when i clicked the "Go To Visits" on the Clients file, nothing happened. Am I right in saying that this line (New Window []) is important for the operation of the script?

 

Again, many thanks from Australia (where it is a cool 17 degrees today - but at least we are getting some rain!)

 

Onesimus

Link to comment
Share on other sites

I would caution you against using a name (or any derivation of a name,) as the relational key. Doing so will cause you problems down the road. Names frequently change, leaving orphaned child records in those related tables.

 

It is much better to use the parent table's auto entered serial number for the relational key to it's children. Using a relationship like this, it may be unnecessary to keep a copy of the Name in the Visit table anyway, as you can refer to the current name in the Client table if needed.

 

Also, it is unnecessary to explicitly create new windows when navigating to an external file. Just use the Select Window[] step to select the file's window, and the Adjust Window[Hide] step to hide the previous window. Using New Window[] may spawn duplicate windows, making it confusing to navigate. Using Close File[] may trigger closing scripts unnessarily.

Link to comment
Share on other sites

Ender - can I ask a favour? Can I give you the files and could you introduce the changes you mentioned in your post? I started off by using a code number to link the Clients with Visits but got bogged down with coding a 1 to many situation (1 client - many visist). I also could not correctly code the New Window/Hide Window steps.

 

I am a learner and the help you and aaa have given so far has been invaluable.

 

Onesimus

Link to comment
Share on other sites

Attached is the fixed Visit creation scripts.

 

But you might instead consider just allowing creation of Visits through the Visit portal in Client (you'd just need to hit the Allow creation of related records checkbox on the Visit side of the Client-Visit relationship.)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use