TOPIC:

CSV Export 3 years 7 months ago #233008

  • Topic Author
  • kaatt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 22
  • Thanks: 0
I have a form that clients fill out in depth for registration with the organization but the same information has to be sent to the head office in a different layout as they don't require all of the information we do.

Thusly, I'm trying to figure out a way to export my records as a CSV but I do not want all of the fields to export so I am trying to narrow down the ones I wish to still export.

I saw another support post stating to comment out several lines of code

crosstec.org/en/forums/51-breezingforms-...mize-csv-export.html

but commenting them out only removed the headers, not the fields, nor was I able to pick and choose the form fields to be exported in this fashion.

Any support would be greatly appreciated.

Running:
BreezingForms 1.9.0
Joomla 3.9.1

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

CSV Export 3 years 7 months ago #233199

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 416
Hello,

Sorry for the late response, Crosstec Support staff was on collective holiday vacation, as noted in the forum.

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

Regards,

Mihaela
The following user(s) said Thank You: kaatt

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

CSV Export 3 years 6 months ago #233446

  • Topic Author
  • kaatt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 22
  • Thanks: 0
That worked perfectly. Thanks so much!

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

CSV Export 3 years 6 months ago #233455

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 416
Hello again,

I'm glad I've helped and that it works as you wanted. :)

Best regards,

Mihaela

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

CSV Export 3 years 6 months ago #233625

  • Topic Author
  • kaatt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 22
  • Thanks: 0
Is there a way to have the CSV export put entries past a certain element in the form onto the next line in the CSV?

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

CSV Export 3 years 6 months ago #233638

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 416
Hello,

Can you please explain a bit more how this should look like. If you mean that some element's Name is, for example, in row 3 and submitted value then in row 4, it is not possible to do so. Titles will be in first row and submitted values below.

Let me know whether this is what you wanted to know.

Regards,

Mihaela

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

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.048 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!