2 Replies Latest reply on Feb 26, 2015 2:02 PM by keywords

    If, Then, Case Script for Newbie


      i'm a scripting newbie, so i'm unsure of how to do the following:


      i have a value list in drop-down menu format that users will have to choose a particular item.

      for example, if my value list is "A, B, C, D".

      and the corresponding prices for each of those items are "$2.00, $5.00, $8.00, $10.00".


      what script can i use that will automatically show the price of the item (in the layout) depending on the user's selection from the value list?

      for example, if the user selects "D", then the corresponding price of $10.00 would show up.

      do i have to setup two value lists (items and item prices)?

      once i know which script to use, how would i insert this script so the database would use it?

      using FM12.v5, OSx 10.9.5.

        • 1. Re: If, Then, Case Script for Newbie

          Your dropdown can handle this task without any scripts.   The dropdown can display two values A $2.00, B $5.00 and so on, then when selected use the value from the second field only which would be the amount.

          Defining a value list for data entry

          • 2. Re: If, Then, Case Script for Newbie

            This is not really a scripting task, so much as a question of database structure.

            It sounds to me that you ought to have the items and their prices stored in a table, say Products. Then the value list can be set to display the Item Name. I assume that when a user makes a selection this will be in another table, say Purchases, with a relationship between the two based on the productID—which will be the primary field on which the value list is set. Once an item is selected from the list Name and Price fields can be auto-entered by calculation or lookup—you would need to do this so that the name and price are preserved in the purchase record as at the time of purchase.