I have listing of different fields for a node ,i have selected exclude option for the fields and tried to group those fields in a global custom text field ....when i do this it returns only the last row for each node .....

ex: i have selected node id to be excluded from the export view,then i have included node id in the global text field in order to convert that into different style ,when i export the views as xml the global custom field return only the last row values

ex:let have four nodes of a content type
[custom text] 4 [/custom text]
[title]node1[/title]
[custom text]4[/custom text]
[title]node2[/title]

like wise ..... can you kindly help me with this issue

Comments

dhayalan_ms’s picture

StatusFileSize
new5.91 KB

I have changed the views_export.module in order to achieve what i want ..... can anyone kindly check this issue and return back ...... after doing that it works perfectly

neclimdul’s picture

Status: Active » Needs work

Its much easier if you can create a patch rather than uploading the entire module. see http://drupal.org/patch/create

Also, there are a lot of unrelated changes around header addition and the changes seem to be specific to the xml plugin?

Your example is a little vague as well. Can you explain what the expected output should be? Also, maybe export you're view and provide it as an attachment to this issue. That'd help me see how to reproduce the problem.

dhayalan_ms’s picture

StatusFileSize
new1.85 KB
new607 bytes
new589 bytes
new500 bytes
new24.86 KB

Wat i want i really i need to present some of the content using global:Custom Text field so i have chosen exclude option in some of the fields and grouped them to put it under global:custom text field ...... i have attached a sample screen shot of my view , and also the result of docc,xl,xml,txt i have got......

i have created a patch to how to avoid that kind of issue ........ i am also attaching that......

the result wat i got is if the fields are excluded and then those fields are included they gives only the last row as result

if you go through the screen shot "node_id_custom_text" has node id printed correctly

in all the exported files only fiveth node id will be printed below "node_id_custom_text"

is that clear? or else i need to explain more?

dhayalan_ms’s picture

StatusFileSize
new607 bytes
new589 bytes
new500 bytes

After Applying that patch i have got correct result .....

dhayalan_ms’s picture

here is my view

$view = new view;
$view->name = 'export_nodes';
$view->description = '';
$view->tag = 'export';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'nid' => array(
'label' => 'Nid',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'exclude' => 1,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'nothing' => array(
'label' => 'node_id_custom_text',
'alter' => array(
'text' => '[nid] ',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'nothing',
'table' => 'views',
'field' => 'nothing',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'nothing' => 'nothing',
'nid' => 'nid',
'title' => 'title',
),
'info' => array(
'nothing' => array(
'separator' => '',
),
'nid' => array(
'sortable' => 0,
'separator' => '',
),
'title' => array(
'sortable' => 0,
'separator' => '',
),
),
'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'exportblog');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler = $view->new_display('feed', 'Feed', 'feed_1');
$handler->override_option('style_plugin', 'views_xml');
$handler->override_option('style_options', array(
'mission_description' => FALSE,
'description' => '',
'attach_text' => 'XML',
'provide_file' => 1,
'filename' => 'view-%view.xml',
'parent_sort' => 0,
));
$handler->override_option('row_plugin', '');
$handler->override_option('path', 'exportxml');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler->override_option('displays', array(
'page_1' => 'page_1',
'default' => 0,
));
$handler->override_option('sitename_title', FALSE);
$handler = $view->new_display('feed', 'Feed', 'feed_2');
$handler->override_option('style_plugin', 'views_xls');
$handler->override_option('style_options', array(
'mission_description' => FALSE,
'description' => '',
'attach_text' => 'XLS',
'provide_file' => 1,
'filename' => 'view-%view.xls',
'parent_sort' => 0,
));
$handler->override_option('row_plugin', '');
$handler->override_option('path', 'exportxl');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler->override_option('displays', array(
'page_1' => 'page_1',
'default' => 0,
));
$handler->override_option('sitename_title', FALSE);
$handler = $view->new_display('feed', 'Feed', 'feed_3');
$handler->override_option('style_plugin', 'views_txt');
$handler->override_option('style_options', array(
'mission_description' => FALSE,
'description' => '',
'attach_text' => 'Plain Text Document',
'provide_file' => 1,
'filename' => 'view-%view.txt',
'parent_sort' => 0,
));
$handler->override_option('row_plugin', '');
$handler->override_option('path', 'exporttxt');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler->override_option('displays', array(
'page_1' => 'page_1',
'default' => 0,
));
$handler->override_option('sitename_title', FALSE);
$handler = $view->new_display('feed', 'Feed', 'feed_4');
$handler->override_option('style_plugin', 'views_doc');
$handler->override_option('style_options', array(
'mission_description' => FALSE,
'description' => '',
'attach_text' => 'Word Document',
'provide_file' => 1,
'filename' => 'view-%view.doc',
'parent_sort' => 0,
));
$handler->override_option('row_plugin', '');
$handler->override_option('path', 'exportdoc');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler->override_option('displays', array(
'page_1' => 'page_1',
'default' => 0,
));
$handler->override_option('sitename_title', FALSE);

theohawse’s picture

I've found that when trying to exclude some fields and call them in a customfield with tokens / rewrite the output:

-The excluded fields must have a higher weight than custom field.
-You can't call the same field twice, at least with NID's

Using some of the above methods, I've built a custom copy+paste code made for craigslist, to easily arrange up to 6 images and product details, with image header+footer, contact info etc. It needed some clever usage of escaped characters, and took quite a long time.

neclimdul’s picture

Yeah, that's one reason I was eager to see an export but that unfortunately does not seem to be dhayalan_ms's problem. I really don't know how this would be happening(especially since I'm not seeing it) and don't see how the patch would fix it which is why I haven't committed it.

djroshi’s picture

I am having the same problem. I am using views export to output a table view to a csv file. Everything works fine except...

view export does not handle any global fields correctly, and exports the last value for these columns into every row of the exported csv file.

For example I have two CCK text fields - first_name and last_name. I have added these fields to a view with a table layout and excluded them from the view. I have added a global custom text field with does: [field_first_name] [field_last_name] and thereby displays the full name in one column.

I have added a feed which is set up to export a csv file. The exported file should look like:

Full name 1, other columns for row 1...
Full name 2, other columns for row 2...
Full name 3, other columns for row 3...

but it doesn't, it looks like:

Full name 3, other columns for row 1...
Full name 3, other columns for row 2...
Full name 3, other columns for row 3...

In other words, totally corrupt >:|

I have used views export extensively and have not had any problems with it till now. I imagine you should be able to duplicate this error quite easily following the same process...

neclimdul’s picture

Status: Needs work » Fixed
StatusFileSize
new789 bytes

I see what the actual problem is now. Thanks djroshi. I think maybe the rendering requirements have changed slightly since I originally wrote that section of code. Luckily there's an easy way to do it now using views internal rendering so the attached patch has been committed and should fix it.

djroshi’s picture

No, thank you neclimdul :)

Patch works perfectly, cheers

dafeder’s picture

Version: 6.x-1.0-beta4 » 6.x-1.x-dev
Status: Fixed » Active

I installed the dev version to be able to use excluded fields and rewrites with tokens, and now all my fields are blank. (IE, a row of my csv file now looks like this "","","","","","","","","","","","","","","","","","","",""). But I don't see any bug reports so maybe I am the only one this is happening to?

dafeder’s picture

It is definitely this patch, I tried making the same change to 6.x-1.1 and had the same problem.

neclimdul’s picture

Weird... what version of views are you using?

dafeder’s picture

Ah - 6.x-2.6. I suppose that could likely be my problem. I'll update and report.

dafeder’s picture

Status: Active » Fixed

Yup. That did it. Might want to include a note somewhere recommending people use the most recent version of views, though I suppose that should go without saying... Thanks!

neclimdul’s picture

Yeah, that's over a year old. This fix was converting off the way that section of views worked a year ago :)

That said, the latest -dev not working with a year old views isn't really that big a concern. It shouldn't really be a common problem with the latest stable release even since if you found you're way to updating views bonus, you probably saw you needed the security releases of Views that have happened since then.

Glad you figured out your problem though.

dafeder’s picture

Yeah you're right of course - was working on a site I didn't build myself and hadn't checked version numbers or to see if update status was turned on :)

Some people might be interested to note I've submitted a patch to Views Export XLS which was suffering from the same bug: #705368: rewrite output bug? or by design?

Status: Fixed » Closed (fixed)

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

weseze’s picture

It's been 2 months now since this bug has been fixed. As it applies to all export functionality I would really like to see a new release of Views Bonus Pack with this bugfix. Is there anything holding back a new release?

shark’s picture

Version: 6.x-1.x-dev » 6.x-1.1
Priority: Critical » Major
Status: Closed (fixed) » Active

Had the same problem, using Views 6.x-2.16 and Views Bonus Export 6.x-1.1.

The patch in #9 worked. I'm amazed that Views Bonus Pack hasn't had a stable release incorporating patch #9 since this was reported over two years ago.

Can anyone say why there hasn't been a stable release in such a long time?

This bug does not render the entire Drupal system unusable, so I'm changing the priority to Major.

To clarify to others that this is still an open issue (it isn't fixed in the stable version) I'm changing the version and marking as active. Please feel free to correct me if there is a better way to communicate that.

Thanks!

neclimdul’s picture

Issue summary: View changes
Status: Active » Closed (outdated)