![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've got a database of musicians, with a bunch of info about them, including their instruments. I want to list them by instrument. |
|
How could I tack on to a layout that lists the musicians alphabetically by name, a list by instrument? The list by instrument would look something like: TRUMPET: Louis Armstrong, Miles Davis; PIANO: Bill Evans, Oscar Peterson; VOICE: Louis Armstrong, Ella Fitzgerald...etc. |
#3
| |||
| |||
|
|
If there's never more than one instrument per musician, a field "instrument" in the musicians table will do. If there's more than one intrument, try a seperate instruments table and a join table where one record is one instrument played by one musician. |
#4
| |||
| |||
|
|
If there's never more than one instrument per musician, a field "instrument" in the musicians table will do. If there's more than one intrument, try a seperate instruments table and a join table where one record is one instrument played by one musician. Thanks a lot for this course of action. Is there any way to automate this? There's hundreds of musicians, and their instruments (there are often multiple instruments per musician) are listed in an "instruments" field, separated by commas when they play more than one instrument. I'm also not too clear on how the "join table" should work. I created a separate "Instruments" table. I manually entered each instrument. Now, I create a "join table" - but how do I populate this? Do I need to create relationships? Thanks again. |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
8) Go to the MusiciansInstruments layout. Be sure you "show all" records. Then click into the InstrumnentID field and choose "Replace Field Contents..." from the Records menu. - Click "replace with calculated result" - Choose "Instruments" from the drop-down menu - Double-click the ::ID field so that the formula reads simply "Instruments::ID" (without quotes). - Click OK and then Replace |
#7
| |||
| |||
|
|
Thanks so much to both Bills for the extremely detailed how-tos. I couldn't get this step 8 to work: 8) Go to the MusiciansInstruments layout. Be sure you "show all" records. Then click into the InstrumnentID field and choose "Replace Field Contents..." from the Records menu. - Click "replace with calculated result" - Choose "Instruments" from the drop-down menu - Double-click the ::ID field so that the formula reads simply "Instruments::ID" (without quotes). - Click OK and then Replace I've gone over everything a few times and when I click Replace, nothing happens (meaning, the InstrumentID fields remain empty). Thanks again - because of your help, I'm beginning to understand this "relationship" stuff... |
#8
| |||
| |||
|
|
One more thing to do in the relationships graph is to make it so that you can automatically add and remove items from the join table when working with Musicians. - Double-click the equals (=) sign that labels the line between Musicians::ID and MusiciansInstruments::MusicianID. - Under the MusiciansInstruments side of the dialog, click the two check boxes "Allow creation of records in this table via this relationship" AND "Delete related records in this table when a record is deleted in the other table." - Click OK |
#9
| |||
| |||
|
|
How can I expand on this so that I can enter new musicians with new instruments (and potentially add new instruments to old musicians, if they learn them)? I think I'm stuck on how to allow the portal to accept edits. |
|
Thanks! It works perfectly now. |
#10
| |||
| |||
|
|
How can I expand on this so that I can enter new musicians with new instruments (and potentially add new instruments to old musicians, if they learn them)? I think I'm stuck on how to allow the portal to accept edits. Answer: Value lists. The portal we created in the previous topic shows a "blank" record at the end of the instrument list, but you can't really enter anything into it... clicking into the blank space does nothing. This is because the field I had you add to the portal belongs to the Instruments table. What you really want to do is add new records in the join table, MusiciansInstruments. But none of the fields from MusiciansInstruments appears in the portal. So, here's how to set up the portal and create a value list that will enable you to easily add instruments: 1) Go to the Musicians layout, the one with the portal. 2) Double-click the ::Instrument field in the portal. The Field/Control Setup dialog appears. 3) Change which field appears. On the right-hand side, drop down the menu that says "Display data from Instruments" and change it to say MusiciansInstruments. Select the ::InstrumentID field. Don't click OK yet. But just consider for a minute about what we've done. Before, you saw the instruments for that musician in the portal. It was pulling the names of those instruments from the Instruments table. The information wasn't stored in Musicians; that just has musician names and ID numbers. And it wasn't stored in MusiciansInstruments; that just has two ID numbers. It was through the power of relationships and the existence of the join table MusiciansInstruments that FileMaker was able to "tunnel through" and grab the right instrument name. Now, we've changed it to InstrumentID in the MusiciansInstruments table. That enables us to "click into" the field for the purposes of adding or changing someone's instrument (as listed in the join table). But remember, MusiciansInstruments only stores numbers. Do you remember whether "xylophone" is instrument number 13, or was it 31? That's what the left side of the box, and value lists, are about. 4) On the left side, choose "Pop-up Menu" from the Display-as drop-down list. Some new options appear. The most important one is "Display values from:" and it currently shows "<unknown>." Drop down that menu and you see the only other option is "Define Value Lists...." Choose that, and the Define Value Lists dialog appears. Click "New..." here. 5) Now we see the Edit Value List dialog. At the top, give it the name "Instrument List." In the original versions of FileMaker, you would be typing all your possible instruments into the "use custom values" section, but the new versions of FileMaker are much more intelligent. Select the "Use values from field:" radio button. The "Specify Fields for..." box pops up. 6) This is the "heart" of setting up your value list properly. Now remember (a dozen dialog boxes ago) that you are trying to make it easier for people to enter the proper NUMBER for InstrumentID into the join table, MusiciansInstruments. We can't put "xylophone" into that field. We have to enter 31 (or is it 13?). This field specifies how we will make that super-easy. - On the left side, with the heading "Use values from first field," choose Instruments from the drop-down list of tables. - The list of fields in Instruments appears. Click "ID" (remember, we need to store the NUMBER of the instrument in the join table. If we stopped here, you'd get a popup menu with not-so-helpful items like 1,2,3,4,...13,14...31,32. - As soon as you do this, the heading on the right side, "Also display values from second field," becomes enabled. SELECT this check box. - FileMaker gives you another list of fields from Instruments. In THIS list, choose Instrument (the field that has the actual name of the instrument). - As soon as you click "Instrument" on the right, the check box option "Show values only from second field" becomes enabled. SELECT this check box. Now, what you've done is instructed FileMaker to consider the Instruments table as the source of a popup menu that will show all the possible Instrument names in your system, but "under the hood" it will actually put the ID number of the instrument that is picked. 7) Close all four levels of dialogs by clicking OK until you're back at the layout, then switch to Browse mode. You'll see that there is a "blank" popup menu at the end of every portal in the system. By clicking this menu, you will see all the instruments. As you choose an instrument, another blank row is added. We've got a couple more things to do before we're finished. Go back to layout mode. First, let's make it easy to get rid of all those instruments you added when you were playing around with your new popup menu. - Shorten the width of the ::InstrumentID field about half an inch. - Type the word "Delete" in the space you created and make the text tastefully small and maybe in red ink. (You could also drop in your favorite little icon for deleting things.) - Right-Click on the text (or icon) and choose "Button Setup..." - In the Button Setup dialog that appears, scroll down to the "Records" section, select "Delete Portal Row" and click OK. Second, let's hide the distracting 3D border around the popup menu. Click on the ::InstrumentID field and set the pen width to None. Return to Browse mode and enjoy your new, fully-normalized relational database with whizzy user interface features! Oh, a couple notes/comments. * Some of those other Control Style options look really cool, but the popup menu is the only one that will show the instrument name both while it's "normal" and while it's "popped up." Edit boxes and drop-down lists will revert to the stored ID number after you select an item. * You might be tempted to use the check box formatting, but that won't fill out the join table properly. The check boxes actually work a lot like your original system did, putting multiple values into one field.... not multiple values into multiple records. * If you want to add a wholly new instrument, do NOT use the option "Include 'Other...' item to allow entry of other values" no matter how tempting it appears. This will NOT properly create a record in the join table, and you (or your users) would doubtless put in the name of the instrument when the field actually requires/uses an ID number. Instead, go to the "Instruments" layout and add one there. "zimbabwhat" <zimbabwhat (AT) gmail (DOT) com> wrote in message news:2006103018190316807-zimbabwhat (AT) gmailcom (DOT) .. Thanks! It works perfectly now. |
![]() |
| Thread Tools | |
| Display Modes | |
| |