Download & Extend

when I storing the field in database, it stop show to me on node

Project:Computed Field
Version:6.x-1.0-beta3
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi

I am not sure if it is a feature or the bug, but when I check "storing in database" for any computed field, then it stop to show to me on node.
It is neccessary to have 2 same fields, one for showing on node and the second for storing in database (for using in views e.g.) ?
I tried to store really simple computed field, to found if it will be shown or not,: $node_field[0]['value'] = 'test'; db options were text, and length 100, default value was: test2
this field after checking "store in db" was never shown.

Thanks for the answer
Igorik
http://www.somvprahe.sk

Comments

#1

What you are describing is not normal. The point of the computed field is that it shows on the node view.

Make sure the "Display Format:" box has:
$display = $node_field_item['value'];

#2

Hi

I have exactly that format in display:
$display = $node_field_item['value'];

Normally I see all my computed fields on node. But when I chceck "store using database...", it disappears.

Thanks for the help
Igorik

#3

Another possibility is the Default Value in the database storage settings. Try to delete the 'test2' and see if that helps.

There can be problems using the default value with the text datatype.

#4

I know it's been a while, but are you still having an issue with this? Database storage for Computed Fields shouldn't affect their display, and I haven't seen this happen personally. If you have any further information, I can try testing it out here though.

#5

I have this exact same issue. Everything works fine when I don't tell it to save to the database. But when I do, it does not display and it does not get stored, no matter what I'm trying to store, and I've tried leaving it as null or not, and typically tested with default set empty.

#6

Hi stickybenson, I didn't try it for a while, but there was a changed concept aabout month ago with latest version and data are not storing into db but into files or something else I think. Read latest issues and try the latest module version.

#7

Category:support request» bug report

Version: 6.x-1.0-beta2

I am getting the same thing. It completely tricked me, I spent about 1/2 hour staring at each character in the example to make sure I had everything right, but nothing would show in the computed field, until I turned off the database storage option.

This is surely a bug.

#8

I upgraded to 6.x-1.0-beta3 and it is still broken.

As soon as I select 'Store using the database settings below' the computed field vanishes.

I need to be able to access the computed field from Views, so I need the database storage option.

Very grateful for attention to this soonest,

Webel

#9

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

#10

My trouble occurs with 6.x-1.0-beta3 vs. Drupal 6.8.

#11

If anybody has managed to get 6.x-1.0-beta3 working could you please confirm that and post a minimal example here, along with the Drupal version. As far as I can tell 6.x-1.0-beta3 is broken, one can't store to database, and so one can't use views of computed fields, which compromises this promising module.

Q: When was the last version known to work together with Views ?

#12

I am using a few Computed Fields with 6.x-1.0-beta2 and I am storing the fields in the database. I am using the varchar data type and setting a data length.

Several months ago I did see a problem using the text data type. Please try varchar.

#13

Category:bug report» support request

Moonshine has kindly assisted me with this clarification (extracts from email):

DB stored "computed code" values are computed and stored to the DB when nodes are *saved* or *edited*. So if you have a bunch of existing nodes that were created before you switched to db stored fields, don't expect them to have computed values in the db until they are saved again. Display output code on the other hand is triggered (if used for display) when the field is displayed.

That was exactly my problem.

However if the display output code uses the computed value, which most people do, and that computed value isn't in the db yet, it won't have anything to work with.

And that was what I overlooked.

Thanks for clarification, it works now, however I have to edit and resave a couple of hundred nodes,

Webel

#14

Same bug but I discovered a work around by simply resaving the node. See this post on issue que.

http://drupal.org/node/627010

#15

Has this been fixed? Because I can't get my values to show whether saving to the database or not. They're there in the node, and they're in the database. But I can't get the value to show in views or when viewing a node.

Computed Code:
$node_field[0]['value'] = 'weird_unique';

Display Format:
$display = $node_field_item['value'];

Also, as suggested in the post on #14, fields saved to the database need to the node to be saved in order to be updated (which makes sense). However, this limits the dynamic functionality of this field to use with views.

My main goal for using this module is to display fields from a referenced node if they are blank in the current node. Both when viewing the node and in views. Is this going to be possible?

Thanks...

EDIT:

I found the problem being caused by a weird conflict with the content templates module. I had this installed previously, but had not set up any templates. After re-installing contemplates the computed fields showed up on the node and in views (strange!).

I'm going to do another test by uninstalling computed fields, and then installing contemplates again first to see if there actually is a problem with installing these modules in that order.

#16

Priority:normal» critical

Ok so how do I get to show the computed field on a node. I have data that is imported with node_import and the data should be computed immediately and there is just no way for me to re-submit any of the nodes. I need to be able to use this data in views and it should be visible of course.

#17

Priority:critical» normal

I don't even see the field in the node edit view. How is this supposed to work.

I have a very good suggestion and I really hope someone reads this:

I have no (like in none) interest to start at my age to program in php but since I am now forced because of the lack of good developers for Drupal where I live to start learning php and Drupal development I am going to write a module. I would really appreciate any help with this and even some coding would be highly appreciated.

Here is the plan:

You have CCK!
1. You create any amount of fields (but for our purposes let's say 4 and we name them field_1 and so on)
2. You have a module (the one I'm going to try and write)
3. You have an extra field that you can create (call it field_calc) that you can then select previous created fields and do operations on the fields you've selected. So for instance you have two fields (field_1 and field_2) and you have operations (+ - / * % or your very own entered) and you select the first field (field_1) you select the operation (+) and you select the second field (field_2). Once you create the field and you enter 5 into field_1 and the value 2 into field_2 then the result (which will be seven 5+2=7) will appear in the field_calc on node save.

Then you can display the results in views and if someone can get the views_calc module to work you can calculate the columns too. The possibilities for this are endless

What do you think and will be anybody be interested in helping me? I really hope so I could use any help

#18

Status:active» fixed

This is not a bug, but the way it currently works. You can apply the patch at #62 of #195013: Recompute all instances of a computed field upon field change to automatically recompute the field on all nodes whenever the node type is edited/saved.

#19

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.