... and it does not matter, if I include the flexifield or the original fields (included also in the flexifield) themselve.
All fields are empty in views 2.


fterrier’s picture

same thing here, nothing shows up, regardless of the style. by the way, awesome module, does exatly what I need

dvdsantana’s picture

I have same problem. Filters can be configured with flexifield field, but results of search are empty.

Somebody can help me?

Update: That is sql sentence generated by my view:

SELECT DISTINCT(node.nid) AS nid,
   node_data_field_nombre.field_nombre_value AS node_data_field_nombre_field_nombre_value,
   node_data_field_nombre.nid AS node_data_field_nombre_nid,
   node.type AS node_type,
   node_data_field_cnae.field_cnae_value AS node_data_field_cnae_field_cnae_value,
   node_data_field_cnae.nid AS node_data_field_cnae_nid
 FROM node node 
 INNER JOIN content_type_experiencia node_data_field_cnae ON node.vid = node_data_field_cnae.vid
 LEFT JOIN content_type_experiencia node_data_field_nombre ON node.vid = node_data_field_nombre.vid
 WHERE node_data_field_cnae.field_cnae_value = '1'

experiencia is secondary content type. Node is saved correctly, but content_type_experiencia table is empty, so "INNER JOIN" always will be empty.

wdennen’s picture

Same problem here, unfortunately!

choster’s picture

Comment #34 in the "content multigroup" thread, #119102: Combo field - group different fields into one, seems to indicate that Flexifield integration with Views is at least very difficult.

colinnc’s picture

Has anyone found a solution to use a flexifield with views?

Flexifield works perfectly in allowing me to add multiple scheduled dates (bundled with other data) to a node. Unfortunately, without at the ability to use views this solution won't work.

If anyone has a different solution to this problem please let me know.

effulgentsia’s picture

Title: Using flexifield in views 2 result in empty field » Add views integration
Category: bug » feature
Status: Active » Postponed

Just updating anyone following this, that indeed, flexifield/views integration (in the sense of being able to use child fields within a flexifield as fields, arguments, or filters within a view) is a very challenging problem, so for any short-term use-cases where this kind of views support is required, you're probably better off trying to see if content_multigroup (bundled with CCK, but hidden, since it is still very much exerimental) is a better fit for you.

This is an unofficial statement, but my hope is that CCK for Drupal 7 will include some kind of module that will combine the best parts of content_multigroup, flexifield, have full views integration, and an upgrade path available from both content_multigroup and flexifield. I'm going to do my part to try to help in that effort.

At this time, I'm unable to predict whether or not I'll be able to get views integration into flexifield for Drupal 6, but I'll update this post again, if I am able to predict that one way or the other.

effulgentsia’s picture

Status: Postponed » Active

I changed my mind. It's just too important a feature to hand wave away. It's back on the list as something I plan to get working before releasing a beta1. I at least plan on making progress on it this month, though it remains tough to predict how long it will take to get it working.

vistree’s picture

This sound great!!
Thank you.

horaceho’s picture

My vote for a "Date + Text" combo field, which is Calendar-view friendly.

Thank you!

Dracolyte’s picture

subscribing. Thanks for this wonderful module.

dirksonii’s picture


effulgentsia’s picture

Status: Active » Needs review

Woohoo! I just committed to the dev branch the code that makes views integration work. I could use some help with testing, before releasing this as alpha5. For anyone following this thread who wants to help:

1) Do the following on a test site!!! And if you've put a lot of work in setting up your data, back it up first. I don't expect this code to mess up your data, but you never know.

2) Upgrade to CCK 2.3: download it, and run update.php.

3) Get the dev snapshot of flexifield (dated June 9 or later). You may need to wait 12 hours from the timestamp on this comment before it's available on the project page. Or, you can get it from CVS.

4) Run update.php.

5) If you have existing content using flexifield, edit and re-save the corresponding nodes. This is only needed for node content using flexifields that you want to have available to views. Later, I will create an update function so that this is done as part of running update.php.

6) Create a view. You can add a flexifield field as a relationship. You can then set other fields and/or filters to use this relationship. For example, suppose you have a field of type "flexifield" named "full name". And the child fields within this are text fields named "first name" and "last name". You can add "full name" as a relationship within your view, and "last name" as a filter using the "full name" relationship. This will filter the nodes displayed in your view to those that have a "full name" flexifield containing a "last name" matching your filter.

Please report any successes and/or failures, and especially if there's any data corruption during the upgrade process, to this issue. Once there are some reported successes and no reported critical failures, I'll release alpha5. Thanks in advance to everyone who helps with this.

justindodge’s picture

I gave this a shot, but was unsuccessful.
Running CCK 2.4 and Views 2.6
I have a Node type view set with a relationship to my flexi-field (field_flexi_field) and one field (field_flexi_field) using the previous relationship.
Previewing reports a query error:

user warning: Column 'nid' in field list is ambiguous query: 
SELECT nid, type, vid FROM node node 
LEFT JOIN content_field_flexi_field node_data_field_flexi_field ON node.vid = node_data_field_flexi_field.vid 
LEFT JOIN flexifield_items flexifield_items_node_data_field_flexi_field ON node_data_field_flexi_field.field_flexi_field_item_id = flexifield_items_node_data_field_flexi_field.item_id 
LIMIT 0, 10

Alternative solution
Because I am impatient, I immediately developed a workaround for this. This is clearly not a long-term solution since views integration is obviously right on the tip of the tongue of this module, but I wanted to share it in case the code is helpful or revealing to anyone out there.
This is far from elegant and downright hacky, but I have achieved a simple way of making a flexi-field work with views by using the Views Custom Field module (http://drupal.org/project/views_customfield) and a snippet of PHP.

For my use case I had a node of type flex_node with Title and 1 field (field_flexi_field). I wanted to display the nodes in a view but I needed to separate the field from the title, node links, and other garbage.

To set up the view:
Under fields, choose your regular flexi-field field. For it's options, check 'Exclude from display'. This is so it's data will be loaded, but we'll display it with a different method.
Next, add a Customfield: PHP code field. For the value of the field:


foreach ($data->node_data_field_flexi_field_field_flexi_field_item_id as &$el) {
  $el['value'] = unserialize($el['value']);
  $aElement['#node'] = node_load($data->nid);
  $aElement['#item'] = $el;


This will render the field exactly as you would see it in the context of viewing a node! I have never tried this method using more than 1 flexi-field, but I'm sure you would need to figure out what the name of the key for the other field would be by examining the contents of $data (node_data_field_flexi_field_field_flexi_field_item_id_2 or something - but really I have no idea).

effulgentsia’s picture

Version: 6.x-1.x-dev » 6.x-1.0-alpha5
Status: Needs review » Fixed

I released alpha5. Some notes:

1) @justindodge: Thanks for pointing out that bug, the fix to which is included in alpha5. Now, you can build a view with a row style of "fields", and select the fields you want to display. If you select a flexifield, it will be formatted correctly.

2) Related to comment 13, I want to clarify when to use a flexifield as a relationship. If what you want to do is display the entire flexifield, you don't need a relationship for that, and setting a flexifield to use itself as its relationship will result in errors. If you want to display a child field of a flexifield, or filter by a child field of a flexifield, that's where the relationship comes in. See item #6 from comment #12 for an example.

3) Item #5 from comment #12 still applies. If you have content that you entered with an earlier version of flexifield, and would like to build views from that content that can show or filter on child fields of a flexifield, you will need to edit and re-save the node. I really should add the code for this to happen automatically as part of running update.php, but I didn't want this to hold up the release of alpha5.

Dracolyte’s picture

I'm having great results with Flexifield in Views, but I'm stuck on one point -- trying to filter on a flexifield subfield. I'm doing exactly what's described in Comment 12, number 6, except that I'm exposing the filter. But so far the filtering isn't taking -- all the values are displayed regardless of filter.

Dracolyte’s picture

Okay, it turns out the answer is simple. In order to use the flexifield-filtering-by-subfield described above, when you add the flexifield to your view, you must uncheck the Group Multiple Values option. It's checked by default, so beware.

what4software’s picture

I cannot seem to get this to work I get no records from the query. I am using CCK 2.4, Flexifield 6.x-1.x-dev and VIews 2.6.
I have a Flexifield with a node reference and 3 text fields as children called Delivery Info. Delivery Info is used by my content type Load, only 1 Delivery Info per Load.
In my view I have Delivery Info in the relationships and I have one of the text fields listed as a field to display with the relationship back to Delivery Info.
The only fields that I am displaying are Nid and the Delivery Time from Delivery Info. No filtering other than by Node Type of Load. No arguments. Sorting is by Nid Desc.

Is there only a certain style of view that I can use, (Grid, Table, etc)?
Did I miss something else?

thommyboy’s picture

i'm using the alpha5 and set up a relationship to get a subfield of a flexifield. set up a new contenttyp using the flexifield, only one node to get around
#5 from comment #12 but still getting the same error "user warning: Column 'nid' in field list is ambiguous query: SELECT nid, node.title AS node_title, ..."

any idea?

just checked the resulting SQL. before adding the relationship, the first line of the query is
SELECT node.nid AS nid,
after adding the relationship it changes to just
as "nid" is a field in the node-table AND the (added through relationship) content-type-table the SQL is generating this error
am I doing something wrong or is this a bug?

Status: Fixed » Closed (fixed)

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

thtas’s picture

same problem as #18 here too

thtas’s picture

Status: Closed (fixed) » Needs work
BWPanda’s picture

Status: Needs work » Closed (fixed)

As the views integration code has already been added into the latest alpha version, you're probably best opening a new issue for any problems you're having with it.

Vacilando’s picture