1 Reply Latest reply on Feb 5, 2010 3:32 PM by TSGal

    calculation help needed for google charting/append variable data based on found count

    drrehak

      Title

      calculation help needed for google charting/append variable data based on found count

      Post

      I'm using google charts to create a chart based on data in the foundset.  Using webviewer, I have a url such as:

       

      http://chart.apis.google.com/chart?
      cht=lc&chs=450x330&chd=t:7,18,11,26,22,11,14&
      chxr=1,0,30&chds=0,30&
      chco=4d89f9&
      chxt=x,y&chxl=0:|Mon|Tue|Wed|Thu|Fri|Sat|Sun&
      chls=3,1,0&
      chm=d,4d89f9,0,0,12,0|d,4d89f9,0,1,12,0|d,4d89f9,0,2,12,0|d,4d89f9,0,3,12,0|d,4d89f9,0,4,12,0|d,4d89f9,0,5,12,0|d,4d89f9,0,6,12,0&
      chg=0,6.67,5,5

       

      where I have substituted my data fields.  the problem is the chart point markers chm=.  I need to specify each marker counting up 0,1,2,3.... in the url above

      chm=d,4d89f9,0,0,12,0|d,4d89f9,0,1,12,0|d,4d89f9,0,2,12,0
      these are the the first 3 markers.  as you can see the 4th character in each marker point goes up +1 for each data point.  (wow this is hard to explain). 

      all the way up to my foundset count.  sometimes I'll have 3 in my foundset, sometimes I'll have 20.  How can I append a series of data to my url (based on the count of my foundset).   I am thinking of how a loop works in a script where you have a variable = n, add 1, loop, exit loop if n=foundset count.  How can I achieve that within a calculation (result is basically text...the url... which is then the webviewer).

       

      thanks in advance!!!




        • 1. Re: calculation help needed for google charting/append variable data based on found count
          TSGal

          drrehak:

           

          Thank you for your post.

           

          Change your URL to include concatenating a Calculation field.   The Calculation field will fill in the counting information.  If you have FileMaker Pro Advanced, you could create a Custom function to calculate the string.  If not, then you'll have to force it.  For example....

           

          Let ( end=Get (FoundCount);

            "d,4d89f9,0,0,12,0" & If (end > 0 ; "|d,4d89f9,0,1,12,0" ; "") & If (end > 1 ; "|d,4d89f9,0,2,12,0" ; "") & If (end > 2 ; "|d,4d89f9,0,3,12,0" ; "" ) & ....etc.

           )

           

          In essence, we check to see if the FoundCount is greater than certain values.  When it isn't, it concatenates null strings, thereby finishing the number of repetitions. 

           

          Switching to the URL, substitute the text string by using the first part of the text string up to chm=, concatenating this calculation field, and concatenating that with the ending ("&chg=0,6.67,5,5" )

           

          Let me know if you need clarification for any of the above steps.

           

          TSGal

          FileMaker, Inc.