7 Replies Latest reply on Dec 5, 2010 11:23 PM by Rune

    Auto assembly of line items or portal?

    Rune

      Title

      Auto assembly of line items or portal?

      Post

      Hi,

      I am really struggling with this and my eyes are bleeding from searching on Google for answers for what feels like an eternity, so I am going to have to ask you:

      On my main layout form [Orders] the user goes through some steps to determine which kind of solar system he wants to build. These steps consist of drop-down lists, which eventually help determine which items, and how many of these items, go into that system.

      The business distributes 6 solar system sizes, but there are quite a few variations in each size, such as whether tin or tile brackets are needed, qty of rails etc.

      Basically the above mentioned drop-downs determine exactly which system the customer needs. What I would like to do is to have a button at the bottom of the form which, when pressed, will automatically build the correct system assembly. 

      On the [Orders] layout I currently have a conditional value list in a portal to Line Items and this works perfectly in building these system manually. I am, however, finding it really difficult to script an automatic assembly for this portal. Am I doind this the wrong way, do I need to script the auto assembly to go through Line Items directly instead?

      Hope it makes sense to you lol

        • 1. Re: Auto assembly of line items or portal?
          philmodjunk

          I'm not sure I it does make sense on this side of the computer screen.

          Where are these "drop-downs determine exactly which system the customer needs" located? In the portal or outside it?

          I can think of multiple approaches here for setting this up. A script that runs through each drop down field, looks up the matching part number and determines the quantity needed, then enters it in the next row of the portal is one option. Other users have set up "kit" entries in their products database with a related "partlist" table that lists all the part numbers and quantities needed to assemble that kit. In those cases, you'd select a kit in your drop down and use a triggered script to copy the data from partlist into the portal.

          • 2. Re: Auto assembly of line items or portal?
            Rune

            The drop-downs are on the main [Orders] layout. I tried to post a picture but for some reason I can't..

            Anyway, I have narrowed down the the drop-downs on the main layout. Now they just ask you whether the system being ordered:

            needs tin or tile brackets

            needs a tilt kit (yes or no)

            and which size (out of 6 different sizes, ie. 1.5kW/2kW/3kW etc.)

            A script then writes the correct system code into a field.

            For example, a 1.5kW system with tin brackets gets the system code "1500", whereas the same system with tile brackets gets "1501".

            Both variations consist of the exact same parts and quantities, except from one having 12 tile brackets and the other having 12 tin brackets.

            The next size up, for example a 2kW system, is assigned the code "2000" if tin or "2001" if with tile. However, all parts in this system increase in quantity from the 1.5kW. Like 18 brackets instead of 12, 6 more rails etc etc etc.

            Sorry if it is confusing, I will try and put up a picture if you want?!

            • 3. Re: Auto assembly of line items or portal?
              Rune

              The "kit" entries you descibed above could probably be perfect for my "system codes"..

              How would I set this up though, would it be similar to the conditional value lists you helped me with in the other thread?

              • 4. Re: Auto assembly of line items or portal?
                philmodjunk

                This method allows customers to purchase individual parts or a complete solar system "kit".

                You should have a Products table where you list every part that can be used to construct one of your systems. You'd add Kit entries as additional Prdocut records in this table, but then add a new table, PartList with just three fields, KitID, PartID, Qty and relate them like this:

                Products::ProductID = PartList::KitID

                PartList::PartID = KitProducts::ProductID  

                This second relationship is optional, but you may find it useful, KitProducts is a second table occurrence of Products.

                On a Products layout, you can add a portal to PartList and specify the partID's and quantities of each product that makes up your kit.

                When you add an product to your line items portal, a triggered script would check to see if it is a kit. If it is, it uses Go To Related records to pull up the list of IDs and quantities and then loops through that list, using set variable and set field to move the data from the PartList table to the line item portal.

                • 5. Re: Auto assembly of line items or portal?
                  Rune

                  Ok, so I've now setup the PartList with the three fields and put it into the relationships:

                  Probably looks messy....

                  On my [Parts] form I have added the portal on the right:

                  Is this what you meant? So for each part (product) I choose a kit code in the drop-down and how many of this part goes into thathat kit? If this is correct I may need a little help with writing the script. I have had a go at it but I am sure it would take me a looong time to figure out lol.

                  Thanks for your help so far!

                  EDIT: Ooooh, light bulb moment! I think I had it back to front.. I have now, instead, gone into the "kit" products and setup the parts and quantities in that portal on the left that the kits consist of.. This makes more sense to me and I think that's what you meant..

                  Now I just need to figure out the script. Specifically I am thinking of how to copy the portal values. I am not really experienced with variables :(

                  • 6. Re: Auto assembly of line items or portal?
                    Rune

                    Wow I am getting nowhere lol. I can manage to drag across the very first "part" for that kit but then it all fails.

                    I am thinking I must be doing the Loop wrong? I have set the following script to trigger by "onobjectvalidate" if someone puts a kit code into the portal:

                    • 7. Re: Auto assembly of line items or portal?
                      Rune

                      I think I have worked it out now, thanks for all your help and patience ;)