3 Replies Latest reply on Aug 2, 2012 5:41 AM by philmodjunk

    Dynamic Text Header problem

    NilsMortenAlexandersen

      Title

      Dynamic Text Header problem

      Post

       Hello Forum

      I am fairly new to Filemaker, so if my question seems silly, please forgive me ;-)

      I want to make a Dynamic text header, that shows all my Sub Categories for a spesific record
      So far ... I have managed to come up with this ....

      <<Sub Kategori>> <<Sub Kategori[2]>> <<Sub Kategori[3]>>

      This gives me a text string with spaces between the names ...

      Example1 Example 2 Example 3
      I really want someting like Example 1, Example 2, Example 3
      If Sub Category 2 wan not entered i want something like Example 1, Example 3

      Questions ..

      How do I put an ", " sign at the end of the names (except the last one), if there are more than one Sub Category entry ?How do I get a continuous text stream (without double spaces) if  i.e. Sub Category 1 and 3 (not 2) are entered ?

      Thanks in advance

      Nils

        • 1. Re: Dynamic Text Header problem
          philmodjunk

          You are using a repeating field. Usually, there are better options for structuring your data that do not require using repeating fields.

          But working with what you currently have, define a calculation field as:

          Substitute ( List ( Sub Kategori ) ; ¶ ; ", " )

          And then put this caculation field on your layout in place of the merge text. List will drop out any blank repetitions and substitute puts a comma and space in place of the returns that list uses to separate the values extracted from the repeating field.

          • 2. Re: Dynamic Text Header problem
            NilsMortenAlexandersen

             Thanks a lot. That really made a difference.

            With regards to your comment about using repeting fields.

            What structiring method would you use ?

             

            Thanks a bunch

            Nils

            • 3. Re: Dynamic Text Header problem
              philmodjunk

              98% of the time, you can replace a repeating field with a related table and use a portal, or series of portals to display and work with the data in the related table. This resolves a number of potential problems that complicate your solution when you use a repeating field.

              1. Repeating fields come with a built in upper limit. If you fail to allow for enough repetitions, you have to update the field's definition and any layouts where it is used. A related table has no upper limits and if more records are needed, adding them is a data entry task not a database developer task. Often, there is no need to modify your layout designs to accomodate the increase.
              2. Many reporting tasks are difficult to impossible to do when the data is stored in repetitions of a repeating field. Say the repetitions store the items purchased on an invoice. If you want to create a sales report spanning multiple invoices that sums up or counts the sales of individual items so that you have a total for each items sold, you will find that either you must export the data into a different table with one record for each repetition--and if you have to do that, might as well use a table with that structure in the first place.
              3. Trying to set up relationships with pairs of repeating fields such that entering a value in repetition 1 of field 1 looks up a value in repetition 1 of field 2 can't be done--you'd have to script it. With a related table, it's quite simple to do with a single relationship between tables.