2 Replies Latest reply on Apr 13, 2010 8:47 AM by mrvodka

    possible to create records based on value lists?



      possible to create records based on value lists?


      I am using FMP 10. I have a database that uses some large value lists that the user can edit. This is useful as the values are not yet finalized so it makes it easy for the user to add to and change the lists.


      I have about 30 of these value lists and am looking for a way to easily print out all the values in all the value-lists.


      Right now I have to edit each value list, copy the contents and paste it into a word processor, then repeat for all the other value lists.


      Is there any way to automate a process where every line in the value list is turned into a record in a new table or something similar? This would make the process much simpler.

        • 1. Re: possible to create records based on value lists?

          You could create yourself a calculated field text that will call this function : 


          ValueListItems : Returns a list of the values in valuelist, separated by carriage returns.  syntax : ValueListItems(fileName;valuelistname)
          then you can directly print this field on a report or a script that will loop into it and will create each element as a record in a table, as you wish...
          • 2. Re: possible to create records based on value lists?

            Its up to you but if you simply want to print out the values in your value list then you may just be able to use a layout with a global text field on it that is sized pretty long. Set the global field to the values of the value list using ValueListItems( ) and then print. Set the global field for each value list that you have and then repeat.


            If you want to create individual records from each one then you can use a loop to create the records in a new table.


            Set Variable [ $vlitems; ValueListItems ( Get ( FileName ) ; "YourValueList" ) ]

            Go to Layout [ "NewTableLayout" ]


            Exit Loop If [ $k >= ValueCount ( $vlitems ) ]

            Set Variable [ $k; $k + 1 ]

            New Record

            Set Field [ NewTable; GetValue [ $vlitems; $k ]

            End Loop

            Commit Records