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

Script to add information from a 2nd table


nfu217
 Share

Recommended Posts

Hello,

 

I have two tables, one called "Projects" and one called "Contacts". The Projects table has fields for members, which I would like to populate from the Contacts table. I would like to do this by allowing the user to go from a Project record to the Contacts table, search for the contact they would like to add as a member, and copy that name back into the Projects table under that specific project.

 

I am a novice so am not sure of the best script for this. I currently have a button which runs a script that takes one from Projects to Contacts and enters find mode, allowing the user to perform a find for that person, and then continue the script to copy their name back into the members field in the project table. If I find the correct person on the first find it is easy to continue the script and get that name copied back into my Projects table. However, it is highly likely that the user will have to perform more than one find to get the right person, and trying to perform a second find breaks the script. Can I set up a script so that the user can go from Projects to Contacts, perform as many finds as he/she needs to find the correct contact, and when they are ready copy that name back to the Projects table? Or does it need to be two separate scripts?

 

Thank you for your help!

Link to comment
Share on other sites

The Projects table has fields for members, which I would like to populate from the Contacts table. I would like to do this by allowing the user to go from a Project record to the Contacts table, search for the contact they would like to add as a member, and copy that name back into the Projects table under that specific project.

 

 

How about, instead, the user clicks on a field that drops down with a dropdown value list of Contacts, and picks from the value list. Then they don't have to be navigated to some other screen and nothing as cumbersome as copying is necessary.

 

File Menu ——> Manage ——> Value Lists. Create value list of all values of Contact::Contact Name.

 

Attach value list to the Members field in Projects. Or, if you wish your users to be able to populate the Members field with multiple contacts, attach value list to a temporary "storage tank" global text field and put an "Add" button next to it. User picks a contact (or another contact) then clicks "Add". The "Add" button sets the Members field to itself, a hard return after anything already in there if it's not empty to begin with, then whatever was picked:

 

 

Set Field [Projects::Members; Projects::Members & Left ("¶"; Length (Projects::Members)) & Projects::g.StorageTankGlobal]

Link to comment
Share on other sites

Thank you for your suggestions. I did not want to use a value list because the contacts table will end up being hundreds of people, much too cumbersome to look through in a drop-down list. Is there another straightforward way to do this jumping between the tables using a script?

Link to comment
Share on other sites

Break your script into TWO scripts.

 

a) First script open a New Window with a name, let's call it "Select Contact". Closes the Status area (show/hide status area) and locks it. goes to the appropriate layout. Enters Find Mode. Allow user abort set to OFF. Pauses indefinitely. User can do find, browse the resulting found set, re-enter find mode.... but cannot leave this layout and cannot close this window or bring the other window to the front.

 

 

On the layout (which can be a new layout created by duplicating the existing one) put a button which says "Pick this one" or "Select" or whatever... it performs the second script...

 

 

Set Variable [$SelectedContact; Contacts::Contact Name]

Close Window ["Select Contact"]

Set Field [Members::Contact Name; $SelectedContact]

 

When you assign Script#2 to the button, there's an option for what to do with any already-running script. You want it to HALT any such script. That kills Script #1 (which was in perpetual pause) in its tracks.

 

 

 

Notice that there is no Copy or Paste. Never use Copy or Paste unless you actually need the data to be on the operating system's clipboard for pasting outside of FileMaker. Use Set Field or Set Variable to move data around.

Link to comment
Share on other sites

Why not a port filter system. Search for name in Filter. if in contacts it shows in portal

Button inscide portal invokes script to set field , Portal row Persons Name.

 

Too bad limited users cant see photos. I have a kick @ss data entry system

using all portals to find / set / Create ... very cool.

Link to comment
Share on other sites

Thank you so much, for the most part this is working beautifully. Just 2 remaining questions:

 

1. I believe I followed the script instructions exactly, but I'm not finding that in the new window the user can browse the found set. Since I closed the status area the buttons to navigate between records in a found set also disappeared, and I can't see another option t do this.

 

2. Right now I just made a button in my existing "Contacts" table to do script #2. Were you suggesting that I actually make this in some kind of duplicate table, and that the original table will not have this button? I'm not familiar with duplicating tables so that description was harder to understand.

Link to comment
Share on other sites

Oh no, definitely NOT a duplicate TABLE. At the most, a duplicate LAYOUT. In case you don't want people clicking Script#2's button when they're doing ordinary run of the mill browsing or data entry in Contacts.

 

You may need to put buttons "Enter Find Mode" at the top of the layout to replace the built-in ones in the status area. The reson to hide the status area is to prevent user from navigating away from this layout.

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use