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?

Comments

merlinofchaos’s picture

Project: Views (for Drupal 7) » Views Bonus Pack
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.

jasonwhat’s picture

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.

merlinofchaos’s picture

The Views Bonus pack, without a doubt.

tombarton’s picture

+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

lapurd’s picture

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

liquidcms’s picture

did this ever make it?

lapurd’s picture

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.

appel’s picture

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

lapurd’s picture

StatusFileSize
new24.64 KB

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

appel’s picture

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!

appel’s picture

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;
budda’s picture

Status: Active » 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.

peterdeitz’s picture

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.

mshaver’s picture

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?

hsfdrupal’s picture

> 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?

webchick’s picture

Status: Needs review » 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. :)

merlinofchaos’s picture

Status: Reviewed & tested by the community » 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

appel’s picture

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!

appel’s picture

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

webchick’s picture

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

mediashock’s picture

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

xamount’s picture

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

tignux’s picture

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

chriszz’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
StatusFileSize
new1.72 KB

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

chriszz’s picture

StatusFileSize
new1.74 KB

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.

dmitrig01’s picture

Status: Needs work » Closed (duplicate)

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

dmitrig01’s picture

Status: Closed (duplicate) » Active

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

robloach’s picture

Component: Code » Views Export

Definitely try to get the XML stuff into this one.

robloach’s picture

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.

robloach’s picture

Title: Export views results as CVS or XML » Export views results as XML

Changing the title to focus on the XML stuff.

jasonwhat’s picture

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

I'm excited to try it out.

robloach’s picture

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

mediashock’s picture

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

robloach’s picture

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

dmitrig01’s picture

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

cangeceiro’s picture

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.

svihel’s picture

Any news here? As more people before me said it would be great to have XML here. Especially since a great many of modules supports Views it would be perfect.

neclimdul’s picture

Actually, yes. I didn't realize this issue existed but I've got support for XML output in 6 and I do have the code for 5 for another project I'll work on merging. I'd say the above is correct about using services with flash but exporting with XML can be a very handy thing to have and worth providing in a simple manner like this.

svihel’s picture

Thats great! If you already have some code I could provide some testing.

neclimdul’s picture

committed test code

robloach’s picture

I think this has become deprecated by: http://drupal.org/project/views_datasource

merlinofchaos’s picture

I don't think views datasource is stable yet. I'd love it if it were, but I think it'd need a comaintainer.

neclimdul’s picture

Status: Active » Fixed

I think the code is pretty solid. Going to go ahead and mark this fixed.

Status: Fixed » Closed (fixed)

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