5 Replies Latest reply: Sep 30, 2011 1:09 AM by Anand Chouhan RSS

    Chart

      Hi,

       

      Can someone please suggest what can be done to achieve this?I have a table that returns following.

       

      NameValue
      California100
      Sandiago50
      LA30
      Texas200
      Houston40
      Austin40


      Users wants to see this on the chart.

      Namevalue
      California180
      Texas280


      Sandiago and LA belongs to California,so the values of individaul cities should be added to the State value.And in the chart only State name would be visible (no city name).

       

      Thanks...

        • Re: Chart
          rohit gupta

          hey pooja

          i tried but not getting proper answer.if u get correct answerplease let me know.

          plz find the attachement .

          may it helps you

          thanks

          rohit

          • Chart

            Hi, try with this

             

            Map:

            MAPPING LOAD * INLINE [

                Name, State

                California, California

                Sandiago, California

                LA, California

                Texas, Texas

                Houston, Texas

                Austin, Texas

            ];

             

            Data1:

            LOAD applymap('Map', Name) as Name2, * INLINE [

                Name, Value

                California, 100

                Sandiago, 50

                LA, 30

                Texas, 200

                Houston, 40

                Austin, 40

            ];

             

             

            Data:

            Load Name2 as Name,

                sum(Value) as Value

            resident Data1

            group by Name2;

            drop table Data1;

              • Chart
                Sunil Chauhan

                you should first insure that how they should beelong to perticular state

                 

                if city's are link to state then it will easy to calculate.

                 

                 

                 

                on the basis of this table we can not achieve like that

              • Re: Chart
                Anand Chouhan

                Hi,

                 

                Sorry to response you late you have to maintain a second table which contains details of the State and cities see the script

                 

                Data1:

                load * inline

                [

                Name,              Value

                California,          100

                Sandiago,          50

                LA,                  30

                Texas,              200

                Houston,          40

                Austin,              40

                ];

                 

                Data2:

                load * inline

                [

                State, Name

                California, California

                California, Sandiago

                California, LA

                Texas, Texas

                Texas, Houston

                Texas, Austin

                ];

                 

                This will give you a correct result as you want just add details in second table and reload it.

                 

                See the attached sample also

                Let me know about this if not works.

                 

                HTH

                 

                Rgds

                Anand