Support forums

Please check @brandnewbox_uk for support status updates.

Search     Advanced Search

   
Grid Field Import Error (creates rows when it shouldn’t)  
Posted: 27 February 2017 01:41 PM —   [ Ignore ]  
Newbie
Rank
Total Posts:  4
Joined  2013-12-20

When importing into a channel entry with Grid fields there is no option to ‘Do nothing’

At present the import either:

1. Deletes all grid rows
2. Appends rows onto existing
3. Attempts to update a row if a grid field matches

If you just want to update an existing channel entry which has a grid field but no action is needed on that grid field the import always adds a row to the grid with no data in it.

This causes problems because templates often check for grid rows and output content if a row exists - DG creates an empty row which it shouldn’t

An option is needed for ‘Do nothing to this grid field’

This is the case on other custom fields where if no value is submitted then no action is taken.

Profile
 
 
Posted: 02 June 2017 03:58 PM —   [ Ignore ]   [ # 1 ]  
Newbie
Rank
Total Posts:  2
Joined  2013-01-04

I am having this exact same issue.

I do not want any Grid rows created when importing channel data and an empty row is being created. This breaks the templating on the site. Someone has to go through each channel item and delete the empty row to fix the templating, which could be many rows.

There is a stack question with more details here.

Profile
 
 
Posted: 07 August 2017 01:59 PM —   [ Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  7
Joined  2011-06-23

An option is needed for ‘Do nothing to this grid field’

I’ve just done this in the grid fieldtype for Datagrab v.1.8.0.

Before you use, make sure you’ve got backups. If you change this on your site, then responsibility for whatever happens next is up to you.

If you’re on the right version of Datagrab - 1.8.0 - then replace the existing fieldtype here:

/third_party/ajw_datagrab/fieldtypes/datagrab_grid.php

with the one in the zip file here (unzip to get it of course):

https://www.dropbox.com/s/p08z1kn462v9xsn/datagrab_grid.php-datagrab1.8.0.zip?dl=1

The logic for other versions of Datagrab is likely to be similar - I’ve not checked.

Changes are in lines 104 and 204.
Line 104 added option value of -2 to dropdown to “Keep existing rows and ignore import”
Line 204 added conditional to check for that value and replace newly added $grid with $old version just retrieved which contains the original instead.

Andrew, if you read this, please feel free to integrate these updates into your build(s).

Cheers,

Aidann

 

Profile
 
 
Posted: 09 August 2017 08:50 AM —   [ Ignore ]   [ # 3 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  1323
Joined  2006-04-12

Hi Aidann,

Thanks for your post. I’m working on an update that I’m hoping to release shortly. I’ll take a look at your solution - thanks.

The issue where a new row was always added was a bug that should be fixed in the next version.

Andrew

Profile
 
 
   
 

‹‹ Importing UTF-8 Characters via CSV fails      Fatal error: Maximum execution time exceeded ››

Select A Theme