Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Is it possible to use this module with views_php field?
For calculating the cash (revenue - expenses) I need to change the value of a decimal field from positive to negative only WHEN the field_type is "expense"
$move_type = $data->field_field_type[0]['raw']['value'];
$move_cash = $data->field_field_paycash[0]['raw']['value'];
if ($move_type === '1' ) { $move_cash = 0 - $move_cash; }
print $move_cash;
$row->php = $move_cash;
but views_calc give this error in views preview:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS sum__views_php_3, 'node' AS field_data_field_paycash_node_entity_type, 'nod' at line 1
Views Query
SELECT node.nid AS nid, node.created AS node_created, 'node' AS field_data_field_paycash_node_entity_type, 'node' AS field_data_field_type_node_entity_type
FROM
{node} node
WHERE (( (node.status = '1') AND (node.type IN ('move')) ))
ORDER BY node_created DESC
Comments
Comment #2
NikolasI CreditAttribution: NikolasI commentedhttps://www.drupal.org/node/1655152