13 Replies Latest reply on Apr 15, 2011 1:26 PM by philmodjunk

    Help needed with portal

    mgxdigital

      Title

      Help needed with portal

      Post

      Hello All,

      I have a table/layout called Samples. This is composed of a customer, samples order number, etc..

      On this layout, i'd like to have a portal that shows all of our products from our product table.

      I can get Filemaker this far, but where i'm stuck is that i'd like the portal to update for each record.

      I have checkbox field in products and i'd like to be able to check the products that i want samples of for each sample request record.

      Right now, my portal is the exact same for each record and i'm not sure how to make it to where each sample request record has it's own product portal.

      Please help! Thank you so much!

        • 1. Re: Help needed with portal
          philmodjunk

          A Multivalue key can be used to show your selected products. You'll need one field for showing all products and another for showing just the selected products.

          When you click a button in the portal row, it can add the portal record's primary key to the list. Clicking it a second time can remove it and the button can look and act like a check box to show you which are selected.

          If you selected records with serial numbers 1234, 654, 980 for your portal, the text field would show:

          1234
          654
          980

          A relationship such as:

          SampleTable::ProductListField = SelectedProducts::ProductID

          will provide the needed portal.

          A script to add/remove an item from this field:

          If [ IsEmpty ( FilterValues ( Sample::ProductListField ; ProductPortal::ProductID ) ) // not in list]
              Set Field [ Sample::ProductListField ; List ( Sample::ProductListField ; ProductPortal::ProductID ) ]
          Else
              Set Field [ Sample::ProductListField ; Substitute ( ¶ & Sample::ProductListField & ¶ ; ¶ & ProductPortal::ProductID & ¶ ; ¶ ) ]
              Set Field [ Sample::ProductListField ; Middle ( Sample::ProductListField ; 2 ; Length ( Sample::ProductListField ) - 2 ) ]
          End If

          A calculation field with this calculation can be put in the portal where you select values:

          not  IsEmpty ( FilterValues ( AllProducts::ProductListField ; ProductID ) )

          And if you format this field as a checkbox with 1 as it's sole custom value, you can resize the field to hide the one and set it up as the button to run the above script. Clicking the check box will check it and the product will be added to the Selected Product portal.

          • 2. Re: Help needed with portal
            mgxdigital

            Cool, will this result in the entire porodcut list on the portal for each sample request record?

            That's what i'm wanting. I want them to create the sample request and have the entire list of porducts to pick from.

            They can check each item and then send the samples.

            Then when a new sample request record is made, the portal of the products is specific to that sample request record and it will show no products checked yet..

            • 3. Re: Help needed with portal
              philmodjunk

              You can have two portals: One that lists all products and one that only lists the selected products.

              Here's a demo file where I made sure the script I posted worked correctly:  http://www.4shared.com/file/47D2cLni/CheckboxWScrollBar.html

              • 4. Re: Help needed with portal
                mgxdigital

                Works great!

                Is there any way to when i create a new record, the checkboxes in the all products portal are all empty?

                • 5. Re: Help needed with portal
                  mgxdigital

                  For some reason on on my layout, the checkbox does the right things, but does not turn "x" checked when i click on it...

                  Why would this be happening?

                  • 6. Re: Help needed with portal
                    philmodjunk

                    Darn, didn't check this with a second record. The X operator is matching back to the original sample record and that's why the boxes are still showing as checked.

                    Make the List field a global field, but include scripts that copy the list from the gobal field to and from the list field local to your sample record.

                    On record load can perform a script to copy the local field's list to the global. The selection script can then be modified to update the global field every time the local field is updated. (or vice versa)

                    I've updated the original demo file with these changes and reuploaded it with the same down load link.

                    • 7. Re: Help needed with portal
                      mgxdigital

                      You're a genious! Works perfectly!

                      • 8. Re: Help needed with portal
                        mgxdigital

                        Phil,

                        What would be my steps to add a qty box to the products?

                        When i do it, it keeps the same item qty in all the same request records.

                        I know i'll have to do something similar to the checkbox, i'm just now sure what.

                        • 9. Re: Help needed with portal
                          philmodjunk

                          In what table are you defining Qty?

                          What does this Qty represent here?

                          I may have painted us into a corner here. Instead of this "cute trick" we may have to toss it and instead use a Join table that matches products to samples just like a line item table matches products to an invoice.

                          • 10. Re: Help needed with portal
                            mgxdigital

                            Our products are sheets of paper.

                            So qty would refer to the number of sheets of paper we would send in the sample.

                            I hope we can make it work because what you have done for me so far works great!

                            • 11. Re: Help needed with portal
                              philmodjunk

                              Sorry, but now you have a second item of data for each selected product unique to the sample. Treat each sample to product as though each sampoe is an invoice with a line items table in a portal for your selected products. You can then define a Qty field in the SampleLineItems table for recording the quantity.

                              See Comment's Invoices Demo if you are unfamiliar with this approach. Just rename "invoices" as "samples" and the basic set up should work for you: 

                              http://fmforums.com/forum/showpost.php?post/309136/

                              There are ways that you can still use a portal of products for selecting them if you really want.

                              http://www.4shared.com/file/plr_jbkk/EnhancedValueSelection.html

                              This last demo shows 4 different approaches to selecting items for an invoice without having to scroll through a massive list of items in the product ID field. Two of them use a portal so this might give you some ideas.

                              • 12. Re: Help needed with portal
                                mgxdigital

                                I'm not able to get the sample line item portal to populate with all of the products.

                                Wouldn't adding the new line item table and relating it to the samples and products work? I thought so, but it's not working for me.

                                • 13. Re: Help needed with portal
                                  philmodjunk

                                  That's what I am describing:

                                  Samples---<SampleLineItems>----Products

                                  Enable "Allow creation..." for SampleLineItems on the Sample to SampleLineItems relationship

                                  Take a look at the EnhancedValueSelectionDemo file. It has scripts that create a new record in the LineItems table when the user clicks a row in the portal to products.