1 Reply Latest reply on Oct 31, 2014 7:26 AM by mknightnps

    Neophyte Questions, Clearing dependent fields, help with portals

    mknightnps

      Title

      Neophyte Questions, Clearing dependent fields, help with portals

      Post

      I'm a neopyhte filemaker developer and I'm starting to get into some more advanced (at least to me) techniques. I've reached the point where I am exceeding what the manuals/training resources available explain. I'm getting hung up and have driven myself to near madness trying to resolve these problems without help. I apologize for the length of the post. If this is an inappropriate place to submit this and/or if there are other forums or places out there where I might get help please feel free to suggest them. Screenshots are attached for visual explanation.

      Inquiry: I have a "customer contact" table and layout where:

             
      • each contact is assigned to one customer
      •      
      • each contact is assigned to many projects (see below for info on projects)      
                    
        • each project is assigned to one product. Each product is only related to one customer. Each product can be modified many times thus it can have many associated projects.
        •           
        • each project can have many customer contacts
        •      
             
      •      
      • Problem: I want a portal that shows the projects that the customercontact is assigned to. I understand how to make this work when each project can only have one customer contact but not many.
      Inquiry: I have a projects table and layout where:
             
      • each project can have one customer assigned to it
      •      
      •      
                    
        • each customer has a customer service rep assigned to it
        •           
        • each customer has a sales rep assigned to it
        •           
        • each project has a product assigned (only products that belong to that customer)
        •           
        • each customer has many contacts           
                           
          • one or many of those contacts can be assigned to the project (solved with a join table "customer contacts assigned")
          •                
          • Problem: A user is able to assign the same contact multiple times through a portal. How do I prevent that?
          •           
                    
        •           
        • each project has a product assigned (only products that belong to that customer)
        •      
             
      •      
      • Problem: If a user changes the customer on a project I want to generate a warning dialog that tells them that if they change the customer the rest of the fields associated with the project will be emptied. On the surface this seemed simple. I was able to sort-of make it work but I had to use a non-global variable, and I couldn't get it to ignore a blank record and work. I have no idea where to even start on reseting the portal records.      
                    
        • On the customer field (a "pup up menu") I initially attached scripts:           
                           
          • OnObjectEnter:
                           Set Variable [ $$customerslected; Value:Project::IDf_Customer ] 
          •           
                    
        •           
        • OnObjectValidate:            

          If [ IsEmpty ( $$customerselected ) = 1 ]

          Exit Script [ ]
          Else If [ $$customerselected ≠ Project::IDf_Customer ]

          Show Custom Dialog [ Title: "WARNING"; Message: "Changing the customer will empty all of the fields"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]

          If [ Get ( LastMessageChoice ) = 1 ]
          Set Field [ Project::Name_Project; "" ]

          Else
                    Revert Record/Request

          End If End If

          Set Variable [ $$customerselected; Value:"" ] 

                    
        •      
             

      Untitled-1.png