Export views results as XML

jasonwhat - November 9, 2006 - 17:10
Project:Views Bonus Pack
Version:5.x-1.x-dev
Component:Views Export
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

views does a great job of filtering and laying out data on the page. I'm imagining it wouldn't be that hard to add the ability to create a CSV fille from the views data. It would also be great to create a valid XML file (in my exprience the RSS in views is not very clean and does not reflect user filters see, http://drupal.org/node/93072).

I know the new import/export api exists and maybe should have something to do with this, but it seems views already does a good job of filtering and extracting data, so why not add two other displays of xml and csv?

#1

merlinofchaos - November 9, 2006 - 17:27
Project:Views» Views Bonus Pack
Version:4.7.x-1.x-dev» 4.7.x-1.x-dev
Component:Views Data» Code

These are perfectly fine ideas and I think someone should do them but they would go into the bonus pack, not Views itself.

#2

jasonwhat - November 9, 2006 - 17:36

Yeah, I don't think they should be in the core of views, but not sure where to file this to have it go elsewhere.

#3

merlinofchaos - November 11, 2006 - 21:30

The Views Bonus pack, without a doubt.

#4

tombarton - November 24, 2006 - 13:51

+1

This is a great idea... I'm trying to develop some functionality based around a simple flash file calling on some equally simple xml data, and I'm convinced that Views is by far and away the best way of spitting out that xml data. Unfortunately I ain't no coder... but if anyone has the time to work on this I'd be in your debt forever!

Cheers,

Tom

#5

lapurd - November 30, 2006 - 21:12

Done, I have CSV and XML views finished in the Bonus pack. Will upload later.

#6

liquidcms - December 11, 2006 - 08:52

did this ever make it?

#7

lapurd - December 12, 2006 - 15:09

ptalindstrom, yes this has been completed. I'm still having the functionality of the code reviewed before I'll submit this. Also I am working out my CVS access which has some probs.

#8

appel - January 3, 2007 - 11:13

lapurd, what's the current status? I've been wanting to try this for a while... :)

#9

lapurd - January 4, 2007 - 19:44

Hi there again. OK Appel, I still have this very annoying CVS access problem over here (it seems my account has been disconnected on the Drupal CVS server itself).

I have tested my code updates locally and I can't find any bugs. I have attached an updated 4.7 module, but I can't seem to do anything usefull around here because of my CVS problem. However, if anyone wants to test this, you can use the attached file which gives you CSV and XML export views.

Let me know if there is a problem or if it works for you.

Casper

p.s. the code follows all Drupal code format standards

AttachmentSize
views_bonus.module24.64 KB

#10

appel - January 17, 2007 - 10:56

Thanks! I've tried it out and it seems to be working okay. I've noticed there's no first row with column names, though I'm not sure if the patch is to blame. Could very well be something that escaped my attention or perhaps it's technically not possible. If it is possible, wouldn't it make sense to use the label values from the used fields? Thanks again!

#11

appel - January 17, 2007 - 11:10

For what it's worth, here's some code to have the column names printed on the first row of the CSV file (It worked for me). Put this between line 229 and 230 of lapurd's views_bonus.module to make it work.

foreach ($view->table_header as $h) {
$header[] = $h['data'];
}
$rows[] = $header;

#12

budda - February 21, 2007 - 12:25
Status:active» patch (code needs review)

Still having problems getting this in to CVS? Just installed and it works a treat. Excellent stuff, includ9ing the additional column heading code in the above comment.

#13

peterdeitz - February 24, 2007 - 20:17

Is there a version 5.0 version in the works? I am very interested in putting this feature to use for several drupal sites. I can't believe the feature hasn't been developed already... it's incredibly useful.

#14

mshaver - March 12, 2007 - 17:19

This is great, although I was hoping it wasn't just another view, but attached to a table view. That way users could download the current table view they are viewing. Has anyone tried putting the code into the header or footer to see if it works?

#15

hsfdrupal - April 13, 2007 - 21:36

> I was hoping it wasn't just another view, but attached to a table view. That way users could download the current table view. . .

That would be a great way to deliver this functionality. Possible?

#16

webchick - April 13, 2007 - 22:05
Status:patch (code needs review)» patch (reviewed & tested by the community)

Sure, put a link to the page view in the page footer area of the parent view. ;)

I'm going to mark this RTBC. It still has a couple bugs, but overall, this is a fantastic improvement. We used this on the OSCMS site to export a list of registered users to Yahoo! a few times, and I didn't hear anyone screaming. :)

#17

merlinofchaos - April 13, 2007 - 23:13
Status:patch (reviewed & tested by the community)» patch (code needs work)

There isn't a patch here, and the given views_bonus.module is old enough that it doesn't even contain the reconfiguration for the new setup where each plugin is its own fi.e

#18

appel - April 19, 2007 - 15:32

Actually, I think hsfdrupal has a point. A user could filter the data through exposed filters and then download the filtered data directly in CSV format. Very intuitive. I see many uses for this scenario!

#19

appel - April 19, 2007 - 15:34

I meant to say 'mshaver', it's him who has a point! Bareuh!

#20

webchick - April 19, 2007 - 15:54

Oops, I meant to make the other CSV patch RTBC. Sorry!

#21

mediashock - May 30, 2007 - 12:54

any news on this and VERSION 5? i cant install this on version 5.. and i would like a views plugin that will let me view the all the fields as seperate XML tags...

#22

xamount - June 3, 2007 - 02:06

I eagerly await version 5 for this....this will very useful.

#23

tignux - June 12, 2007 - 10:02

I really quote the previous reply ..... a 5 version would be a god's gift

#24

Christian Zange - June 25, 2007 - 05:54
Version:4.7.x-1.x-dev» 5.x-1.x-dev

I am still refining - but this version did basically work. Use it on your own risk. You need to have import-export installed!

AttachmentSize
bonus_csv.tar_.gz1.72 KB

#25

Christian Zange - June 25, 2007 - 06:22

Some refinements for better use with excel. You still need to import via Data->import. If you just open the file, you'll get problems with character-settings.

AttachmentSize
bonus_view_csv.tar_.gz1.74 KB

#26

dmitrig01 - July 2, 2007 - 17:10
Status:patch (code needs work)» duplicate

could you please try to merge this with http://drupal.org/node/114115? BTW, I *love* the XML idea.

#27

dmitrig01 - July 20, 2007 - 14:06
Status:duplicate» active

nm... this is results and the other is the view itself... keep up the good work and *roll a patch*

#28

Rob Loach - July 31, 2007 - 16:26
Component:Code» Views Export

Definitely try to get the XML stuff into this one.

#29

Rob Loach - August 1, 2007 - 22:48

If you check out the latest CVS, you'll notice a big change in the Views Bonus Export module. I moved a bunch of things around to make it easier to extend (with argument selectors too), so if we just add in your XML stuff, we should be good.

#30

Rob Loach - August 15, 2007 - 20:17
Title:Export views results as CVS or XML» Export views results as XML

Changing the title to focus on the XML stuff.

#31

jasonwhat - August 29, 2007 - 13:52

Is the CVS version for Drupal 5.x or 6?

I'm excited to try it out.

#32

Rob Loach - August 29, 2007 - 15:13

The ability to export as CSV and DOC is in there. Export as XML isn't, I believe.

#33

mediashock - September 12, 2007 - 15:18

is it possible yet to create a custom XML view .. this would help soo much with flash sites :)

#34

Rob Loach - September 12, 2007 - 18:07

For Flash stuff, the Services module, along with AMFPHP, is the way to go ;-) .

#35

dmitrig01 - September 15, 2007 - 14:13

@merlinofchaos: as Rob said, the AMFPHP + services modules. Those will output in a flash-friendly method.

#36

cangeceiro - May 20, 2008 - 04:22

any word on xml exports? this would dramatically helpful as there are a ton of programs that can parse xml where this would be handy...ie exporting articles to indesign templates.

 
 

Drupal is a registered trademark of Dries Buytaert.