Computed Field is a module that implements a field to execute PHP code to set its value.

learn more… | top users | synonyms

0
votes
3answers
42 views

How can I sum up fields that reside in multiple nodes?

I am using Drupal as an inventory management system and wanted to know how can I sum up fields to get a net total? Say I purchased 10,000 widgets over 2012, and I want to be able to sum up all the ...
0
votes
0answers
25 views

Output is not matching the required result

I am using the computed field because I want to compare two fields "field_finance_date" and "field_coordination_date_" and put the smallest in a third field "field_approved". field_finance_dat is a ...
0
votes
1answer
62 views

Using Drupal 7 Computed Fields I need to reference a custom field I created in User Profile

I am still learning a lot with Drupal 7 and unfortunately on the fly. I used computed fields to calculate weight loss. This is what I current have. Which works in a sense but only where the user ...
0
votes
0answers
50 views

Strict warning: Only variables should be passed by reference at eval() ..computed_field.module(466) : eval()'d code [closed]

This is warning message I got. Strict warning: Only variables should be passed by reference at eval() ..computed_field.module(466) : eval()'d code I think it's related to the code that I inserted ...
0
votes
1answer
36 views

multiplying fields values

Hi can someone help me with some field maths. I have taxonomy vocabulary called "plast" with several terms (large box, small box etc.) i have created field within the taxonomy called weight which is ...
0
votes
1answer
31 views

Computed field - count number of taxonomy terms in term reference field

So I simply want to count the number of tags on a term reference field.. I've tried a count (below) and it simply returns "1" (there are a lot more terms tagged than 1): $entity_field[0]['value'] = ...
0
votes
1answer
64 views

Computed Field: Setting up entity title

Hello fellow Drupal people, I have written inside a Computed Field's Computed Code section the following code, which works except the commented out section which includes two options for setting up ...
0
votes
1answer
59 views

If NID doesn't exist, save node?

I'm using menu_get_object() to get the NID for a computed field. The problem is that on a node save, NID doesn't exist yet so the computed field produces an error. If I resave the node, everything ...
0
votes
1answer
105 views

Computed Field - Reference Custom Field on User Profile

I'm very close to getting this working right. I created a custom content type with several decimal fields and an entity reference field where you select a user to assign the content to. I am using a ...
0
votes
0answers
18 views

Unique serial number on conditional select field

I need to create a serial number in a format. First entry I want to do from myself and then after I want some logic to create it on one conditional select. I have a select box with option ...
0
votes
0answers
20 views

retrieving data from another source and storing it in a uneditable user field

I am creating a fan website for a certain game. I have an api that returns a user's rank in the game when called. What I am trying to accomplish is have a field in the user's account that contains a ...
0
votes
2answers
108 views

Computed Fields calculation help needed

I have a specific calculation that works in a Global PHP field in a view, and I need it to be "translated" so that it works with a Computed Field CCK field. Here is the code... can anyone shed some ...
0
votes
0answers
35 views

Change type of computed field in phpmyadmin

I want to have a computed field with DateTime data type but datatime is missing in list. my question is : What happens if I choose text from list and change that to datetime with phpmyadmin? What is ...
0
votes
0answers
37 views

How do you set a default value of a text field based off of another field?

Currently i want to set the default value of a text field if nothing is entered to another field in the same node. I created a computed field that parses a bunch of other fields together to form the ...
0
votes
1answer
83 views

Computed Field Module, how do you reference another field properly?

In drupal 7, for the "computed field module". How do you reference another field properly?
2
votes
2answers
83 views

Update Computed field with hook_cron

I have a field age in profile of my Drupal Instant which computes age from the D.O.B of the user. How do I make sure the age is updated along with cron job. Is there any way to trigger. Right now I ...
0
votes
0answers
56 views

How to use computed field with CCK Table

I have CCK Table Field named "feature" and another text field is "weight", and in "feature" field I type : " height : 1.3m weight : //How can I use the value of "weight field" here ???????????? " ...
1
vote
1answer
100 views

Computed code db query issue — working in PHPmyadmin but not field

On my site, I have venues, and reviews of the venues, related with an entity reference field. I'm creating a computed field to store the UID of the first person to create a review for each venue. To ...
0
votes
0answers
38 views

I need help to calculate the price with Computed Field

I have a content type with 2 fields: price and currency. I need a Computed Field that calculates the price in euros approximately. I would change it by hand, no need to do it automatically. Example: ...
0
votes
1answer
192 views

Getting a taxonomy-term-name as plain-text in computed field

In an entity-type with term-reference i want to add a computed field, which grabs the term and sanitizes it for further use with the drupal_clean_css_identifier for example. My code doesn't work, ...
0
votes
1answer
247 views

Converting date into unix timestamp not giving expected result

Basically I was trying to get age from date of birth, for which I am using Computed Field module. Following code was used: $isoArray = explode ( '-', ...
1
vote
1answer
182 views

Expose a computed field (or external data) to Views

I want to add a virtual field to a "node", its content should be computed from other fields of this node (with the module of the same name or with a hook) AND it must be usable by Views filter and ...
0
votes
1answer
175 views

PHP error with Computed field

here is my code: $nid = $entity->field_empf_number['und']['0']['nid']; $result = db_query("SELECT MAX(entity_id) FROM field_data_field_empf_number WHERE field_empf_number_nid = ...
2
votes
0answers
106 views

PHP code not saving in a Computed Field

I'm using Drupal 7 and the Computed Field module. I have this problem both with Custom Content Type and with Custom Entity Type. When I add a computed field and go to the Field Settings, I type in ...
1
vote
1answer
88 views

Easy PHP, Radioactivity module: Read out a node's current energy?

Sorry, this is a super stupid problem but I'm new to PHP and failed at solving it myself. On my node I have an energy field (Radioactivity module) and a computed field. The computed field is supposed ...
0
votes
1answer
179 views

Computed field module: value of field when creating new content

for my content type I have this computed field code and when I update existing node everything is ok, but when I create new node, menu_get_object return empty values and drupal display this error ...
1
vote
1answer
48 views

Using computed fields module to display certain fields?

I just installed the computed fields module and I'm a little lost as to how to use it. I have 2 fields in my content type: field_shortdesc and field_audio_description. If field_shortdesc is blank I ...
1
vote
1answer
343 views

Sum of integer vaules of a multi value field using Computed Field Module

I have a field that is configured to have unlimited values. (field_a) How can i use Computed field to add all of the integer values of A? A: 10, 5, 2 The computed field would then spit out 17 ...
3
votes
1answer
172 views

How can I find (programmatically) which fields have been edited on a piece of content?

I want to have a computed field pull in the name and content of a field after it has been edited. I would also like the computed field to contain the content that was edited before edit (if that makes ...
0
votes
1answer
139 views

When does the computed field compute?

I don't understand when a computed field computes. Does it compute when the fields it draws on are updated or when someone views the node its used in?
0
votes
1answer
80 views

Strange PDOException Error With Computed Field

I have a computed field which is calculating values based on an entity reference field. It works fine when calculating an AVG, but I realized today that what I actually would like is for it to find ...
0
votes
1answer
252 views

What alternative do I have to use the Computed Field module?

I am currently using the Computed Field module to calculate field in Field Collection and use PHP code to generate the formula. The problem is that the user does not enough PHP skill to write that PHP ...
0
votes
1answer
199 views

Computed field won't update itself or save to the database

UPDATED ISSUE: In the original issue below, I was getting an error when a query was empty. I've now gotten rid of the error, but content no longer saves into the database (where it saved fine before). ...
0
votes
1answer
122 views

Making geolocated latitude/longitude values available to computed field in Drupal 7

I'm working on a D7 project where I need to pass a latitude/longitude value from a Location field (acquired from geolocating during import) to a Computed field. I found the following code in the ...
-1
votes
1answer
471 views

PDOException Error upon saving node with computed field

I know cross-posting is bad, but this is time-sensitive and I haven't gotten any response on the actual issue queue. I have a node with three fields that I need to concatenate into a single computed ...
0
votes
0answers
70 views

Creating a new field after creating a computed field fails

I am using Drupal 7.14. I have successfully created a new computed field and it works great. I try to create another one and I receive these errors: Notice: Undefined index: field_name in ...
0
votes
0answers
85 views

Attach a file using computed field and CCK

I have a CCK custom type that ask some info to the user and uses those info to generate a file using computed fields. The last thing i have to do is find a way to attach this file to the node or at ...
0
votes
0answers
93 views

Computed field: How to retrieve data

I'm new to Drupal (7) and I'd like to make use of the computed field module to get a multi-axis rating average. At the moment my database field looks like this: field_data_field_lage: entity_type ...
1
vote
1answer
241 views

Display average from a column?

EDITED: This has been altered to include the code suggested by Dooshta. I need to fill a computed field with the average value of all entries in a certain field, and only from nodes that have a ...
1
vote
1answer
405 views

how to retrieve date in computed field

How to retrieve date from a date field and store it in computed field? I have tried this code: $start_date = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_start_date'))); ...
2
votes
0answers
369 views

Display average using computed from multiple fields

I have multiple fivestar rating fields that I want to calculate using the computed fields module. I was able to display the average using PHP but I need to have the computed fields module input my ...
0
votes
2answers
737 views

Can't get computed field to work

This is the code: $number->field_max['und'][0]['value']; $array = array( "7mm Shorty over 7mm Jump" => 10, "7mm Shorty over 5mm Jump" => 14, "7mm Jump" => 13, "5mm Shorty ...
0
votes
0answers
63 views

What is the correct function to call?

I want to write code for a computed field which gets the value of a field for a node I want to create. I used menu_get_object(), and field_get_item() but it works only when the node is edited; when ...
1
vote
2answers
370 views

How to run PHP code only once on node creation?

I'm using Drupal 7, and the Computed Field module. I want to run code just once, when the node is created. Is there any specific function?
1
vote
1answer
620 views

Getting taxonomy name from entity for computed fields

Im trying to create a computed value field using the the computed_field module. I trying to do something like http://drupal.org/node/792922 but that example is for drupal 6. Can someone point me in ...
0
votes
2answers
538 views

How to retrieve a query result in a computed field?

I'm trying to run the following select in a computed field, but it doesn't work: any clue on what is going wrong ? $nid = $node->nid; $result = db_query('SELECT description FROM ...