When i try to save to the database, no values will be displayed. If i uncheck "save to database" everythink works.
With int values it works by the way only strings do not work.

I did nothing complex i only saved "foobar" in the value.

LIKE: $node_field[0]['value'] = "FOOO";

thx for help

Comments

marcoka’s picture

Version: 5.x-1.2 » 6.x-1.0-beta5
freestylegary@yahoo.com’s picture

Checking save to database creates a field item, but no values are stored. Using following test code:

function computed_field_field_company_contact_expiry_compute($node, $field, $node_field){
	$startdate = $node->field_company_contact_date[0]['value'];
	$expiry = strtotime("+90 days", $startdate);
	$node_field[0]['value'] = $expiry;
}

Database shows null

giorgosk’s picture

increase data length (available space to store value)

Annakan’s picture

Sale behavior here with a float field saved in DTB, length 10,2.

Value is computer $node_field populated via a custom function.

No database update.

Same behavior in 6.x-dev

Annakan’s picture

Title: Saving to database » Saving to database not working

Deleting the field and recreating in with 6.x-dev bring a new interface (much better and more clear) for creating/updating the field definition but the behavior is somewhat "worse".
The field default value is null wihtout regard for the default value supplied.

The code is called as expected but the database is still not updated, at least for a float.

And the field is not displayed on the node where it is defined either.

Edit : same behavior with a string type field.

joemoraca’s picture

I have same problem - correct value will display but either 0 or nothing written to database table.

El Bandito’s picture

Version: 6.x-1.0-beta5 » 6.x-1.x-dev

Hi

Yep, I'm seeing this with a string based Computed Field using 6.x-1.x-dev dated 8th March 2011. Works when I don't select the "Store using the database settings below (required for Views use)" checkbox. When I do however the relevant database column is created but the field stubbonly remains set to NULL and nothing is displayed when viewing the node.

Happy to help with any debug assistance but I'm not a coder.

Thanks for the great module, but clearly this is a showstopper of an issue.

El B

duntuk’s picture

You have to re-save the content after you click the 'save to database'. Basically what is going on is that the computed value is ONLY stored into the database AFTER you save/update the node.

In other words, say you added a computed field to a content type with a bunch of pre-existing nodes. The pre-existing nodes will not get the computed field value inserted into the database automatically after you create the computed field. You have to hit save on the pre-existing node, and THEN the value is written....

So basically after creating the computed field you'll want to go to admin/content/node and select all the nodes that have the new computed field, check all checkboxes for those nodes, and select 'publish'

dqd’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Due to the Drupal core life cycle policy and security support advisery, Drupal 6 is no longer supported. So issues for Drupal 6 cannot be longer maintained. The project maintainer has asked for closing all D6 issues to clean up the issue queue.