Any chance of using a computed field as a displayable field in views 2?

Comments

kswan’s picture

Status: Active » Fixed

It works for me. I have the "Store using the database settings below" box checked in the Computed field and it works great with Views 2.

I haven't tried it without storing in the database.

BAJV’s picture

Yes, this module works with Views 2 but I wonder why is the output is NULL? Another question is, the computed field value does not return any value in a node.

Thanks for any response.

mikeytown2’s picture

I try to stay away from storing it in the database, I have shared hosting and the database is very slow. So it looks like I need to put it in the database. Thanks for the info.

kswan’s picture

I am considering another approach that might help http://groups.drupal.org/node/17466. As far as I know that approach is not yet available. I am considering writing a module that would allow custom field entries in Views.

There would be a few significant differences between this hypothetical module and the computed field module.

  • The custom field would only display on the view. It would not be on the node view.
  • The custom field would use SQL functions instead of PHP. PHP would not work.
  • The custom fields would not be abstracted to the database. For example "(TO_DAYS(NOW) - TO_DAYS(field_due_date)) AS days_late" would work in MySQL, but not Postgres.

I have not started working on this module so I don't know if it is actually possible. Please respond to my post on g.d.o if you are interested or have feature requests.

mikeytown2’s picture

I have over 100 nodes that need to be "updated" for the computed field database entry... any easy way to do this? Clicking edit and save on all of those nodes would suck; plus in the future if I need to update it again, it would be a nice thing to have.

Status: Fixed » Closed (fixed)

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

glennnz’s picture

Bump

My computed field value won't show in my View. It's being stored in the database, I can see it there.

Thanks

Glenn

--UPDATE--

This is bizarre, I am using Ubercart and uc_node_checkout to create my node which has the computed CCK field./

Before checkout, the computed field is in the database. Aftyer checkout, it's gone. The checkout process is deleting it.

My computed filed code is:

$nid = $_GET[product_nid];
$title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $nid));
$node_field[0]['value'] = $title;

Thanks

Glenn

glennnz’s picture

Category: feature » bug
Priority: Normal » Critical
Status: Closed (fixed) » Active

Updated status re my previous comment.

Glenn

deekayen’s picture

Category: bug » feature
Priority: Critical » Normal

Views is a third party module, which makes supporting it a feature.

corbacho’s picture

Title: Views 2 Intergration » Views 2 Integration

fix title

Moonshine’s picture

Status: Active » Closed (fixed)

Computed field does work with Views 2, so I'm closing this. Issue in #7 already has another issue posted:

#544488: Field content being deleted during checkout

sydkoh’s picture

Computed fields not showing in Views is a definite issue. I've been looking all over for a solution, but in every thread it seems to get dismissed.
Has someone figured out why computed fields stored in the database are not being displayed in views? Or why is it that for some people it works and for others it doesn't?