Hopefully someone might be able to help here, i'm still relatively new to drupal and definitely to cck.
I installed the computed field module and then created a computed field on one of my
content types. I then added the field to the appropriate view.
Settings for Computed Field:
Computed Code:
$node_field[0]['value'] = 1;
Display Format:
$display = $node_field_item['value'] . 'is the value of the computed field';
The output is:
---> is the value of computed field
For some reason the value of $node_field[0]['value'] is not being assigned it seems.
Even if i use the "Make a node link to itself" example on the Computed Field module page, the value is
still not assigned and i get a link to node/ instead of node/x.
Is there a step i've missed along the way?
Comments
Comment #1
mydllurth commentedMuch of our call center content is computed. Operatives must be able to quickly enter essential data, and let readable content derive from critical information.
The current stage of development with Computed Field, requires us to store the result. Have you toggled the "Store using the database settings below" checkbox?
Typically, we use a varchar of 64 for our computed phrase lengths.
Comment #2
mydllurth commentedWow! Thanks for mentioning your problem. I just revisited my display code and am able to pare some data store.
Let's compare notes. A working configuration follows -- without toggling the "Store using the database settings below" checkbox.
Widget: Computed
Display in group: No group
Help text: NULL
Data settings.Required: FALSE
Data settings.Multiple: FALSE
Data settings.Computed:
Data settings.Display: TRUE
Data setting.Display_Format:
Resulting output for a test node:
The dial string is 1 987-654-3210 extension 9999
NOTE: All of our components are string types. Try putting quotes around your assignment when it might be interpreted as numeric instead of a string.
Comment #3
nancydruComputed code:
Display Format:
Problem #1: "Cert Num" is not displaying on the edit screen. Doesn't matter if it's "required" or not.
Problem #2: field_cert_num is not updating.
Here is the message log after submitting the node:
* cert_status(d): FC, cert_number: none
* yes, the setting code was driven 123456
* cert_status(c): FC, cert_num: 123456, certification_number: 123456
* cert_status(d): FC, cert_number: none
* The Interpreter has been updated.
* cert_status(d): FC, cert_number: none
* cert_status(d): FC, cert_number: none
And this is the var_dumps:
array(1) { [0]=> array(2) { ["value"]=> string(2) "FC" ["view"]=> string(17) "Federal Certified" } } array(1) { [0]=> array(1) { ["value"]=> string(4) "none" } } array(1) { [0]=> array(2) { ["value"]=> string(2) "FC" ["view"]=> string(17) "Federal Certified" } } array(1) { [0]=> array(1) { ["value"]=> string(4) "none" } }
As you can see, the value of field_cert_num should now be "123456" from field_certification_number. It is unchanged from what is in the database. I have even tried clearing cache_content, with no difference.
@mydllurth: If I remove the "[0]" from the field in the display code, it doesn't show the cert_num field at all.
Comment #4
nancydru@_Dan_, don't assign an issue to yourself unless you intend to submit a patch.
Comment #5
richv commentedI have the same issue as Dan, running Drupal 5.3.
I don't think "$node_field_item['value'];" is working properly, there's just nothing in it. If I throw a
print_r($node_field_item);in the Display Format field, it just outputsfor each node.
Here's how I have the field configured:
Widget: Computed
Label: Yepper2
Help Text: (empty)
Required: False
Multiple values: False
Computed Code: $node_field[0]['value'] = 'hi';
Display this field: Yes
Display Format: $display = $node_field_item['value'];
Store using the database settings below: yes
Database Storage Settings:
Data Type: text
Data Length: (empty)
Default Value: (empty)
Not NULL: False
Sortable: True
Comment #6
richv commentedI just verified that this problem exists on a system running Drupal 5.5, too. There *has* to be something Dan and I are missing here, as this module simply doesn't work for us. Any clues?
Comment #7
nancydruDoesn't work for me either. I've pretty much abandoned any hope of it ever being useful. I did a few days ago see a new CCK module that's similar, but I can't remember what it was.
I've just looked at this author's other modules and he appears to have a record of producing abandon-ware. Looking at the issue statistics for this module, it would appear that no problem has ever been fixed. If someone feels capable of taking over this module please contact the author and offer to do so.
Comment #8
alansz commentedI have the same problem. Drupal-5.6. Any simple computation with display on and store off appears to have no visible effect when viewing the node.
Comment #9
wmclark commentedThis module isn't working for me either. I used the example on the project page also. When I look at the node in devel, the value remains null.
I am using the drupal 5.5 with the latest version of cck
Comment #10
wmclark commentedAfter doing some more research on this, I figured out that the node will update the field AFTER you edit and save a node of that type. It will not update all nodes of that type when you create/update the computed field.
If you would like to batch calculate all nodes of a certain type, you can run the php that was posted in this issue (I put this in an unpublished node and it worked for me):
http://drupal.org/node/195013
Also, there is a bug that the computed field will not update when viewing the node which is related to another issue which has a patch found here (I haven't tried the patch yet):
http://drupal.org/node/134661
Comment #11
alansz commentedThanks, the patch for update on view fixed the problem!
Comment #12
Justin Freeman commentedHey NancyDru - if you really want to help this module then submit documentation, a patch, help solve the issue with the other users or do something else constructive. Being critical of the author(s) does not add any value to the process.
Comment #13
Justin Freeman commentedMarking as duplicate and closing, see issue #134661: Recompute on every display not working?.
Comment #14
nancydruI already maintain at least 16 contributed modules, taking on another one is simply not possible. I was not trying to be critical - just realistic of the chances for a solution. If you've taken this on, then I'm happy. Meanwhile my customer has canceled this project because this capability wasn't there and didn't want to pay me to dig into this module and make it work.
Comment #15
Justin Freeman commentedThe reality is that someone ultimately has to pay for the development of open source software. It's a false economy to depend entirely on free software without making some investment. This would be a good discussion at a pub so lets end it there :)