12 Replies Latest reply on Jul 24, 2013 12:06 PM by hanstrager

    Add records through a Portal

    hanstrager

      Title

      Add records through a Portal

      Post

            

           Im trying to make my own small invoice system by trying to adopt the ideas from the built in invoice solution in FIlemaker to my needs.

           What I’m trying to implement is the function where you add an invoice (in my case called WIP) from the customer table, which then shows up in a portal. Ideally I would like to carry over the customer name into my invoice (WIP::company). but now im a bit stuck.

           My portal is showing related records from WIP, and is filtering the portal records with the following: customer::Customer Name = WIP::company

           The button on my customer layout has the following script attached:

            

      Set Variable [ $Customer_ID; Value:customer::XCustomer_FK ]
      Go to Related Record [ From table: “WIP”; Using layout: “WIP” (WIP) ]

      [ Show only related records ]
      Set Variable [ $scriptrigger; Value:"Off" ] New Record/Request
                          Commit Records/Requests 

           But sofar the only thing that is happening is that I’m only adding new customer records and not any WIP records, and nothing is showing up in my portal. Does anyone know what I’m doing wrong,,?

      Screen_Shot_2013-07-09_at_23.27.56.png

        • 1. Re: Add records through a Portal
          philmodjunk

               You might want to research those script steps in FIleMaker Help or some training materials.

               Try it this way:

          Set Variable[ $Customer_ID; Value:customer::XCustomer_FK ]
          Go To Layout[ : “WIP”(WIP) ]
          New Record/Request
          Set Field [ WIP::XCustomer_FK ; $Customer_ID ]
          Go To Layout [Original Layout ]

          • 2. Re: Add records through a Portal
            hanstrager

                 I have really tried a lot to make this work, and it seems easy enough, but mine is just not working.

                 Using the above script you suggested, takes me to the WIP layout and adds a record in the WIP, but I can't get that record to  to show up in the portal on in the customer table... so on the customer table you're only alowed to see the WIP records belonging to the customer...

            • 3. Re: Add records through a Portal
              philmodjunk

                   Then either your script or the portal's set up/relationship is not correct. You can post an exact listing of your script here for others to check and you can check to see what match fields and/or portal filter you've set up for your portal to make sure that the customer ID value that the script enters into each new record is what is being used as the match field and that it's not being excluded by a portal filter..

                   To post a script to the forum:

                     
              1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
              2.      
              3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
              4.      
              5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
              • 4. Re: Add records through a Portal
                hanstrager

                     Really appreciate the help in here, since im not the most experienced in filemaker.

                     So far i got my relationship set up as attched screen shot.

                     and my script is looking like this:

                Set Variable [ $Customer_ID; Value:customer::XCustomer_FK ] 

                Go to Layout [ “WIP” (WIP) ]
                New Record/Request
                                    Set Field
                [ WIP::XCustomer_FK; $Customer_ID ]

                Go to Layout [ “WIP” (WIP) ]

                                     

                                    My problem is the WIP record relating to the customer dosen't show up in the portal added onto the customer table. In portal setup the portal is set showing related records from WIP and filter portals with the folowing calculation: customer::Customer Name = WIP::company.

                      

                • 5. Re: Add records through a Portal
                  philmodjunk

                       Your script has a problem. The two go to layout script steps should not be identical.

                       What layout are you "on" when you perform this script? Which of the Tutorial: What are Table Occurrences? boxes shown in your screen shot is selected in Layout Setup | Show Records From for that layout?

                  • 6. Re: Add records through a Portal
                    hanstrager

                         The script it run when hitting a button on the in the customer table - where the portal also is placed where the infor from WIP should show up.

                         "Layout Setup | Show Records From for that layout?" - do you mean portal setup..? The table thats selected in my portal setup is WIP.

                    • 7. Re: Add records through a Portal
                      philmodjunk

                           I mean layout setup for the layout where you placed the portal. From your answer, it appears that it specifies an occurrence of your Customer table. But what exact text to do you see in that drop down? If it specifes the right table, wrong Tutorial: What are Table Occurrences?, it could explain why this isn't working.

                           If so, then the second go to layout step is not returning you to the original layout from where you originally performed this script.

                      • 8. Re: Add records through a Portal
                        hanstrager

                             On the layout where the portal is placed are showing records from "customer" is that wrong..?

                        • 9. Re: Add records through a Portal
                          philmodjunk

                               Then, from what I see in your screen shot of table occurrences and relationships, your script should look like this:

                          Set Variable[ $Customer_ID; Value:customer::XCustomer_ID

                          Go to Layout[ “WIP” (WIP) ]
                          New Record/Request
                               Set Field
                          [ WIP::XCustomer_FK; $Customer_ID ]

                          Go to Layout[ “Customer” (Customer) ]----> or you can use: Go to Layout [ Original Layout ]

                          • 10. Re: Add records through a Portal
                            hanstrager

                                 got it - it works...

                                 Is there a quick way in the script that can be added so Customer::Client = WIP::Company. So basicly the client name on the customer layout will automatically be on the WIP layout...?

                            • 11. Re: Add records through a Portal
                              philmodjunk

                                   Simply use the field tool to add the name field from the customer table to your WIP layout.

                              • 12. Re: Add records through a Portal
                                hanstrager

                                     Sorry was not thining, works.. thank you so much