CSV Export

  • kaatt
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 0

kaatt created the topic: CSV Export

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
#233008
  • Posts: 2483
  • Karma: 86
  • Thank you received: 335

mihaela replied the topic: CSV Export

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
#233199
The following user(s) said Thank You: kaatt
  • kaatt
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 0

kaatt replied the topic: CSV Export

That worked perfectly. Thanks so much!
#233446
  • Posts: 2483
  • Karma: 86
  • Thank you received: 335

mihaela replied the topic: CSV Export

Hello again,

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

Best regards,

Mihaela
#233455
  • kaatt
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 0

kaatt replied the topic: CSV Export

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?
#233625
  • Posts: 2483
  • Karma: 86
  • Thank you received: 335

mihaela replied the topic: CSV Export

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
#233638
Moderators: ForumSupporttomeperica
Time to create page: 0.068 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here