5 Replies Latest reply on Jan 6, 2011 9:25 AM by philmodjunk

    Tweeking a starter solution

    MStephens

      Title

      Tweeking a starter solution

      Post

      I am using FM 11.  Starter solution for PO.

      I made a new table, product.

      I want it to auto add from Line item

      I created relationship for product ID

      I would like to be able, as I insert info for a new item from a company, that it auto adds to MY table, Product.  I asked to add records via relationship, but it is not doing so.

      I would also like to have a checking account, of sorts, with this database.  I already have something I use in excel.

      This starter solution I redefined as a request for material as we are requesting a PO to SEND out to another company so that we can RECEIVE product.  When product comes in, and I send the PO with invoice down to the Business office, I subtract the cost from the budget in my excel worksheet.  it would be nice to have it auto do that once the request is made within the database.  

        • 1. Re: Tweeking a starter solution
          philmodjunk

          "Allow creation of records via this relationship" enables you the user to create a new record in the related table if you enter data in a blank row of a portal to that table. It also enables a scripted set field step to create a related record if on does not already exist. As you have discovered, it won't automatically add the records in a related table every time you create a new record in the first table.

          What do you mean by "auto add"?

          Do you want every record in line items copied to this table?

          Do you want the line item for any product that does not already have a record in products added?

          • 2. Re: Tweeking a starter solution
            MStephens

            Hello PhilModJunk,

            Yes to the last, I do want the line item for any product that does not already have a record in products to be added to the table product.  I do not want every instance added.

            • 3. Re: Tweeking a starter solution
              philmodjunk

              Assuming your relationship to products looks like this:

              LineItems::ItemID = Products::ItemID //I haven't opened the starter solution, so the actual field name may be different

              and "Allow creation..." is enabled for Products in this relationship;

              A single script step: Set Field [Products::ItemID ; LineItems::ItemID] will create the new related record if it does not already exist. Looked up Value field options in Products or additional set FIeld steps in this script can copy data from other fields to products as needed.

              You could then use an OnObjectSave script trigger set on your portal to run this script. (Test this to be sure. I think this trigger will run each time a line is edited and you either exit the portal or switch to the next portal row, if not, other triggers can be used.)

              • 4. Re: Tweeking a starter solution
                MStephens

                relationship is id to id

                allow creation is enabled

                after that, I am a tad lost kind sir.

                how do i 'activate' this script set?  to I write it and then attach to a button?

                What is a trigger?  I know a trigger will start something rolling, but how do 'I' set a trigger?

                You must LOVE your job 'eh?  giggling as you read newbie helps?  (smilin)

                • 5. Re: Tweeking a starter solution
                  philmodjunk

                  It's not even my job. I do this more or less "for free". Wink

                  If you have FileMaker 10 or 11. You have a feature called Script Triggers. Look this term up in FileMaker help as there's more there than I care to type in this post.

                  Write the script first. Then you can right click the portal in Layout Mode to pull up a menu where you can select a script trigger for the portal.