0

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).

1
  • 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.
    – au_stan
    Commented Apr 24, 2012 at 11:58

1 Answer 1

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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