1 Reply Latest reply on Aug 24, 2013 11:00 AM by philmodjunk

    Set Field Script step

    janslort

      Title

      Set Field Script step

      Post

           Hi All:

           I'm using FM11 Pro Advanced on a PC running windows 7. I had,what I thought was a simple script to place a comment in a repeating field, butI can't get it to work.   I create a new invoice and have a script which is triggered when a new customer's name is entered.  The first entry on the new invoice will be a line item called "Take the Tour".  It's on a products list that I use as a pick list. I want to enter it on the invoice first.  If the new customer buys stuff he gets the tour free, so I have a choice to enter a diferrent "product" called "Free Tour" to replace the product  "Take the Tour" . That script doesn't work either.

           I select my layout, and identify the field I want to enter my item into as follows:  Set Field[TourBilling::LineItemProduct[6]; "Take the Tour", nothing happens.  I checked the field name and know it's right.  I even tried a self Join on the invoice number in this file and added the  "go to related record" step, no results.

           I have used the Set Field script step hundreds of times before, but this "Ain't" working.

           Any Idea what could be wrong?

            

           Jan

        • 1. Re: Set Field Script step
          philmodjunk

               The syntax looks correct for placing the text "Take the Tour" into the sixth repetition of LineItemProduct. Without seeing the entire script and not knowing the basic design of your layout table, relationship etc, I can only point out general issues that might be a factor:

               LineItemProduct might be the wrong field type such as a calculation a field that is not defined to have at least 6 repetitions, or perhaps is a number field.

               The table occurrence name: "TourBilling" might not be the correct table occurrence reference for the context in which your script executes. You mentioned "self joins" and Go to Related Records, neither of which should be needed to modify a repeating field that is currently visible on your layout unless "TourBilling" is not the occurrence selected in Layout Setup | Show Records from.

               And using repeating fields for line items is not the best design option for an invoicing system. A related table of line items with a portal to that table located on your invoices layout is much more flexible and easier to work with.