Hi, I need help in the php code since I'm not that good in php. I've a content type: player_stats and in that I've fields:
field_runs_scored
field_balls_played
now the formula I want to implement is:
100 * field_runs_scored / field_balls_played
so basically in views I've one column that shows the values(integer) for Runs Scored and other for Balls Played now with the "custom field" I want to show the Strike Rate column and show the values using the above mention formula. please help...

here's another example:

Runs Scored--------Balls Played-------Strike Rate
------85---------------------70--------------121.42
------30---------------------45----------------66.66

please help me.......any php guru out there..........help!!!!!

Comments

littlemisssunshine’s picture

I've been working on a similar thing and found a solution, which I posted here: http://drupal.org/node/1210028

I'm not sure if it's the right way to get the information out of the table but once I worked out how to do it once the rest was fairly easy to work out.

drupaal’s picture

Thanks for the reply. I tried your solution and SUM the field, "field_runs_scored" and it did returned me a value but I think it's doing the sum of all the values of the field_runs_scored where I wanted to display is, player specific. 'm using filters with exposed option so when I select a specific player I saw that player specific data. I hope I clarify enough but I did post details on your post as well with a link of the page I'm working on. Do you know how can I achieve this?

Thanks.