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

Issue Summary

Hi all,

I have a flexifield field, unlimited number of values.

I want to filter a view using this field, by setting a particular value. But I want to select nodes with that value, only if the value is the last (or the first) of the list.

For example:

Flexifield:
[+] year: 2008 name: john
[+] year: 2009 name: james
[add another item]

So I have a node with a title, a body, etc, and two "flexifield" items,

2008 - john
2009 - james

Now I need a view that selects all nodes with name = james, but only if that name is set for 2009 (or is the last of the list).

I could use the views php filter module, writing a query to select nid related with the max(delta) in content_field_[field] table, or simply writing a module and using drupal/views/... api, but I'd like to know if there is a "flexifield way" to do it.

Thanks,
aded

Comments

#1

"Now I need a view that selects all nodes with name = james, but only if that name is set for 2009 (or is the last of the list)".

I rectify:

(...) but only if that name is the last of the list.

Bye,
aded

#2

Status:active» fixed

First, I'm guessing you've already read this, but if not, check out bullet point 6 on http://drupal.org/node/300668#comment-1683698 for using the relationships part of views for this kind of filtering.

If you wanted to match on the 1st, 2nd, etc. positions, there's a "delta" option on the relationship.

Unfortunately, there's no option there for "last". I created an issue for CCK regarding this: #547732: Expose negative/reverse/last delta in views integration.

Until that's implemented, I don't have a better answer for you.

#3

Status:fixed» closed (fixed)

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

nobody click here