2 Replies Latest reply on Jan 24, 2017 4:39 PM by aliabbassipro

    I Have One Big Problem On Variable & Script

    aliabbassipro

      Hi , I Cant Solve My Problem Until Now With Variable And Script , I Have One To Many Relationship Right Now !

      I Have 3 Tables : 1)Artists 2)Songs 3) Role Song.

      So As We Know Every Artist Can Have Many Songs and Every Songs Can Have Many Artist.

      So We Have This Relationship

      spot.jpg

       

      Now I Have Portal and I Want When i Click To (Add New) Button I Have New Portal Row With The Songs Of That Artist

      I Attach My Project , If Anyone Can Help Please Do It For Me Then I Can Learn it

      Note : In The Scripts I Have Subject If Any one Want To Help Please Go And If I Have Mistake Edit it

      Note 2 : I Have Button Near (Featuring) My Script Run At This Button , I Want When I Push That Button Add Second Artist On The Same Song Like :

      Track Name : After You , Singer : Ali , Featuring : Jack

      Thanks For Your Helping

        • 1. Re: I Have One Big Problem On Variable & Script
          philmodjunk

          This post seems awfully familiar, but a search of the forum did not find previous posts by you on this subject...

           

          I will not do it for you. But I will provide instructions on how to do it for yourself--better to learn by doing.

           

          I see that the +  button on the Artist Form View layout takes the user to the Artist List View layout. There are actually many different ways to find and select an artist to add to your portal but I will work from what you have started. First, move that button into the portal row. Where it is located, there is no way to use it to select an artist for a specific song. You can only select the artist, not indicate to which song to link that artist. So move the button into the portal row.

           

          First, you need to capture the ID of the song where you clicked to add an artist. This value needs to be available to your script even when on a different layout. So set a global variable to the ID of this song, changing your current script to be:

           

          Set Variable [$$SongID ; value: Songs::ID ]

          Go To Layout ["Artists List View" (Artists) ]

          Show All Records

          //you might at this point add a sort records step to sort the artists into alphabetical order.

           

          Now, on your Artists List View Layout, but a button into the body of the layout to click to select an artist

          Set Variable [$additionalArtist ; value: Artists::ID ]

          #Now create a new record in Role_Song for this

          Go to layout ["Role_Song" (Role_Song) ]

          New Record/Request

          Set field [Role_Song::id_Artists ; $AdditionalArtist ]
          Set Field [Role_Song::id_Song ; $$SongID ]
          Go to Layout [ "Artists Form View" (Artists) ]

          Enter Find mode []

          Set Field [ Artists::ID ; $additionalArtist ]

          Perform Find

           

          Note that this second script returns you to the original layout but pulls up the record for the additional artist so that you can see the new entry in the Song portal.

           

          Note that if you added a field in Role_Song for identifying the Role, you can add a value to such a field that identifies each artist linked to a given song as Performer, composer, arranger, etc...

           

          There are many other ways to find/select an artist. you might find these two files useful examples of how you might select values from a list--including selecting from lists of songs and lists of artists:

           

          Adventures in FileMaking #1--conditional value lists

          Adventures in FileMaking #2--enhanced value selection

          • 2. Re: I Have One Big Problem On Variable & Script
            aliabbassipro

            hi

            can you send me the project?

            please because with that i can learn so easy