Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Users uploaded two csv files to create nodes for two CCK content types (Delivery Note and Payment), i.e.

 Delivery       Payment
----------     ---------
 Order No.      Order No.
 Recipient      Charge
 Address

I would like to create a view as a report for the boss:

 Order No.  Recipient  Charge
 ---------  ---------  -------
  ...        ...        $...
  ...        ...        $...
  ...        ...        $...

Order No. field is unique and both content types.

How's it possible to do it in Drupal's view?


The above question was asked on SO and I found a solution. However, the solution was way too slow (for example, it takes more than a hour to download ~2000 records via Views Data Export).

share|improve this question
    
did you check your database for slow queries? you could use the devel mod to check queries against the db and see whats going on. personally, if you're looking to speed things up, i would start writing a specific module. –  austin Apr 24 '12 at 11:58
add comment

1 Answer 1

Since you don't have a reference between the two, Views has no way of knowing how the node's relate to eachother. Views has no direct support for joining on arbitrary columns.

So to solve this, you need to declare the relationship to Views your self. You do this by implementing hook_views_data, or in this case, since Views has likely already created most of the array, hook_views_data_alter. The documentation for the first function has an example with code for a relationship.

share|improve this answer
    
Two CCK types share the same CCK Field (Order No. in this example), will the shared CCK Field served a join column? –  ohho Apr 24 '12 at 8:48
    
I don't understand the question. –  Letharion Apr 24 '12 at 9:07
    
The Order No. Field is used both CCK Content Types. –  ohho Apr 24 '12 at 9:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.