Select the fields of a node using code I'm new to Drupal, and I have some problems.
I need to select some fields from a node (via code), and then process the data.



[Full-size image]

Basically, I want to show the total of column "value", grouped by "category", but as each field's content type is a table, I do not know how to do it.
To get the data from a field in an entity be it a node or something else is pretty straight forward.

It can usually be done doing something like this.

$data = $node-&gt;field_name['und'][0]['value']


But it depends on which field type you are using ect. A more convenient way is to use the entity module. With that installed you can do:

$node_wrapper = entity_metadata_wrapper('node', $node);
$data = $node_wrapper-&gt;field_name-&gt;value();


This giv give you the value, for reference fields like term reference, you will get the actual loaded term instead of the raw id which is pretty handy and allows chaining.