9 Replies Latest reply on Oct 28, 2013 11:24 AM by philmodjunk

    Chart data from a Value List



      Chart data from a Value List


           I am trying to chart data from a value list but am having no luck displaying the data. I need help to make sure the tables and relationships are right and for this to work.

           Vehicles::_pkVehicleID to Oil Samples::_fkVehicleID

           In the Oil Sample table I have fields such as IronContent and ChromiumContent and it is with these values I want the value list to be based on. I have a global field, gFindContent in the Oil Sample table and I have written a script to get a found count as follows (there is where my problem is, as it doesn't find the data from the gFindContent drop down list of IronContent and ChromiumContent).

           Set Variable [$Veh; Value:Oil Samples::_fkVehicleID]

           Set Error Capture [On]

           Enter Find Mode[ ]

           Set Field [ Oil Samples::_fkVehicleID, Oil Samples::gFindContent]

           Perform Find

        • 1. Re: Chart data from a Value List

               are you trying to find all Oil Sample records for a particular vehicle?

               is gFindContent formatted with a value list that enters Vehicle ID's when you select a vehicle?

          • 2. Re: Chart data from a Value List

                 Hi Phil, sorry for very late reply. To be clearer, as an example, I am trying to display the results of the Iron content of every Oil Sample record for a particular vehicle. Same goes for Chromium, Nickel etc etc. What I have done is the following:

                 On a layout I have a dropdown menu with a value list of vehicle ID's. With a script, when a vehicle is selected, all the Oil Samples of that particular vehicle are in the found count. So far no problems here.

                 What I then want to do, is have another dropdown menu, where I can select say Iron, and in the chart it will display the IronContent for each Oil Sample for that vehicle. I have written a script for this (attached), but I know it is wrong and I know where it is wrong but I think I need to change my relationships for it to work. 

                 The Set Field needs to be set to something general that covers all the metals instead of just WearMetals::Iron, however I don't know how I can do this. All of the metals fields are under the Oil Sample table. Do I need to create a new table just for these fields and have a relationship to Oil Samples?

                 Thanks a lot.

            • 3. Re: Chart data from a Value List

                   How is, for example, the "iron content" recorded? Is this a value in a specific field for iron content or is it recorded differently than that?

              • 4. Re: Chart data from a Value List

                     "iron content" is a field ( called WearMetals | Iron ) in the Oil Samples table. The value of the iron content for a certain oil sample is just entered into that field on the layout.

                • 5. Re: Chart data from a Value List

                            "iron content" is a field

                       Then performing a find makes no sense as this will find records, not fields within the record.

                       Option 1:

                       Create a a set of charts, each one based on a different "wear metals" field. Place each chart in a different panel of a tab control. You can then select a chart for a specific metal by clicking it's tab.

                       Option 2:

                       Create a single chart that charts a calculation that uses the Case Function to return values from any of the "wear metals" fields based on a value in a selection field.

                       Case ( Table::gSelectedMetal = "Iron" ; Table::WearMetals | Iron ;
                                   Table::gselectedMetal = "Aluminum" ; Table::called WearMetals | Aluminum
                                    //and so forth...

                       You can then set up the global gSelectedMetal field with a value list for selecting a metal to see it charted.

                       Option 3:

                       Use a chart style such as a line chart and specify a different y-series for each such WearMetals field. This will chart all the metals on a single chart.

                  • 6. Re: Chart data from a Value List

                         I have Option 3 already set up and working, but I am wanting to do exactly what you described in Option 2. Sorry but how do I set the chart up so that it "charts a calculation"? I wasn't aware you could do that.

                    • 7. Re: Chart data from a Value List

                           The same place where you select a field as the data source for a y or x data series also has an option for selecting a calculation--which will open up the same specify calculation dialog that you have used in other contexts.

                      • 8. Re: Chart data from a Value List

                             Thanks Phil! Works wonderfully! One more question, would I be able to display the average iron value on the same chart that is displaying the individual oil sample results for iron?

                        • 9. Re: Chart data from a Value List

                               IF you want a horizontal line marking the average, I believe that you can define a second Y series and reference a  summary field set up to compute the average to get that value. That will require adding a different summary field for each such field and then setting up another case function for this y-series similar to the first example.