TOPIC:

Don't want all fields in csv export! 2 weeks 3 days ago #276357

  • Topic Author
  • ricks
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 1
  • Thanks: 0
Hi,

Don't want all fields in csv export. How do I only have the fields in my form exported to csv file?

Also, the fields in the export are out of order. Is there something in fields that tell the order? I'm using free version.

Thanks,

Rick

Please Log in or Create an account to join the conversation.

Don't want all fields in csv export! 2 weeks 3 days ago #276358

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2967
  • Karma: 2
  • Thanks: 150
Hi,

what exactly do you want to remove ?

This requires changes in the source code.


if you want to remove 'SUBMITTED', 'USER_ID' and other metadata from the csv go to joomla/administrator/components/com_breezingforms/admin and in the recordmanagment.class.php file around line 2571 you need to comment out the following code as stated in the link you've sent:
$fields['ID'] = true;
		$fields['SUBMITTED'] = true;
		$fields['USER_ID'] = true;
		$fields['USERNAME'] = true;
		$fields['USER_FULL_NAME'] = true;
		$fields['TITLE'] = true;
		$fields['IP'] = true;
		$fields['BROWSER'] = true;
		$fields['OPSYS'] = true;
		$fields['TRANSACTION_ID'] = true;
		$fields['DATE'] = true;
		$fields['TEST_ACCOUNT'] = true;
		$fields['DOWNLOAD_TRIES'] = true;

This will only remove the header as you wrote, so to remove the values as well, around line 2617 comment out this piece of code as well:
$lines[$lineNum]['ID'][] = $rec->id;
			$lines[$lineNum]['SUBMITTED'][] = $rec->submitted;
			$lines[$lineNum]['USER_ID'][] = $rec->user_id;
			$lines[$lineNum]['USERNAME'][] = $rec->username;
			$lines[$lineNum]['USER_FULL_NAME'][] = $rec->user_full_name;
			$lines[$lineNum]['TITLE'][] = $rec->title;
			$lines[$lineNum]['IP'][] = $rec->ip;
			$lines[$lineNum]['BROWSER'][] = $rec->browser;
			$lines[$lineNum]['OPSYS'][] = $rec->opsys;
			$lines[$lineNum]['TRANSACTION_ID'][] = $rec->paypal_tx_id;
			$lines[$lineNum]['DATE'][] = $rec->paypal_payment_date;
			$lines[$lineNum]['TEST_ACCOUNT'][] = $rec->paypal_testaccount;
			$lines[$lineNum]['DOWNLOAD_TRIES'][] = $rec->paypal_download_tries;

Furthermore, since you want to exclude some form fields, here is how you can achieve that.
Around line 2587 in this piece of code:
	foreach ($element_fields As $element_field) {
			if (!isset($fields[strip_tags($element_field->name)])) {				 
				$field_key = md5(strip_tags($element_field->name));
				$fields[$field_key] = true;
				$head_keys[$field_key] = strip_tags($element_field->name);  
			}
		}

you need to add an if statement like this:
foreach ($element_fields As $element_field) {
			if (!isset($fields[strip_tags($element_field->name)])) {				 
				$field_key = md5(strip_tags($element_field->name));
				if(strip_tags($element_field->name) != 'field1' && strip_tags($element_field->name) != 'field2') {
				$fields[$field_key] = true;
				$head_keys[$field_key] = strip_tags($element_field->name);  }
			}
		}

This is an example code, if you do not wish to include fields from your form named 'field1' and 'field2'. Replace those values with the names of your form elements that you DO NOT want to have in the csv export.
That will remove the headers.

To remove the values from this fields as well around line 2665 in this if statement:
if ($sub->name != 'bfFakeName' && $sub->name != 'bfFakeName2' && $sub->name != 'bfFakeName3' && $sub->name != 'bfFakeName4')

add more conditions like this:
if ($sub->name != 'bfFakeName' && $sub->name != 'bfFakeName2' && $sub->name != 'bfFakeName3' && $sub->name != 'bfFakeName4' && $sub->name != 'field1' && $sub->name != 'field2')

NOTE: This will affect all exports from all your forms. The fields with that names won't be included in any export in Manage Records.
This is a sort of custom solution so managing this to work only for one wanted export would require additional coding which is out of scope of our support.
I hope that this will help.

Please before doing the changes backup the recordmanagment.class.phpfile, for example save it as OLD_recordmanagment.class.php.

Let me know whether you've managed to achieve what you wanted and apply this to your form.

NOTE. Maybe in my comment this number for a line of code where you need to make changes are not on the same code line in your file, then you need to find it somewhere in the file under another code line, but the code is the same.

I hope I explained it well!

Regards,
Mirko

Please Log in or Create an account to join the conversation.

Last edit: Post by Mirec.
  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.045 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!