We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38666
    • 98 Posts
    I have a field in a custom (Migx) table that my client would also like to see as a calculated total. The data in each field consists of a comma separated string of values representing points earned over three years, for example "0,10,5" being the 'current year -2', 'current year - 1' and the 'current year'. They would like to see a calculated field showing the total for the three years. This would involve splitting the string and calculating the total of the three values.

    Can anyone suggest a quick and easy way of doing this to display the value in a Formtab or Column?

    This question has been answered by multiple community members. See the first response.

      Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
    • discuss.answer
      • 4172
      • 5,888 Posts
      its possible with a renderChunk - renderer in an additional column
      Use the MIGX - configurator to set the configs (formtabs and columns) for that MIGX-TV

      Then you can use an output-filter in the renderChunk - tpl or a snippet, which does the calculation
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 38666
        • 98 Posts
        Thanks Bruno, I was wondering about the renderer. I'll give it a try in the morning.
          Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
          • 38666
          • 98 Posts
          Quote from: Bruno17 at Nov 16, 2015, 03:34 PM
          its possible with a renderChunk - renderer in an additional column
          Use the MIGX - configurator to set the configs (formtabs and columns) for that MIGX-TV

          Then you can use an output-filter in the renderChunk - tpl or a snippet, which does the calculation

          Works great for columns but how do I get the totals in formtabs
            Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.
          • discuss.answer
            • 4172
            • 5,888 Posts
            you can try to use the description_is_code - option on another field
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 38666
              • 98 Posts

              Thanks again Bruno, as always you have made our lives a whole lot easier.

              When I put this out to our client I think I can predict what is coming next so I'll ask now:
              We have about 30 categories where our members may collect points over a three year period. Could formtab "Input Values" be used in a similar fashion to generate a running total of accumulated points and save the value to the database?
                Give a man the answer, and he’ll only have a temporary solution. Teach him the principles that led you to that answer, and he will be able to create his own solutions in the future.