<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Custom Reporting</title>
		<link>https://legacy.forums.gravityhelp.com/topic/custom-reporting</link>
		<description>Gravity Support Forums Topic: Custom Reporting</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 14:18:58 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/custom-reporting" rel="self" type="application/rss+xml" />

		<item>
			<title>m4change on "Custom Reporting"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-reporting#post-26237</link>
			<pubDate>Tue, 24 May 2011 15:03:35 +0000</pubDate>
			<dc:creator>m4change</dc:creator>
			<guid isPermaLink="false">26237@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;We're having the same issue. Getting data out to evaluate surveys is a pain in the butt.  The CSV file is near useless in this respect.  Due to the retained IDs when moving/deleting fields in the form, things can get even more confusing.  In this case, you can't do a simple join.&#60;/p&#62;
&#60;p&#62;Inherit of issues with wordpress, the language-tied sub-storage (php serialization) in the database is messy and hard to translate without PHP to unserialize the knot.  Lucky for us, a developer with a keen sense of perl was able to sift through the trash and output something we could use for analytics.&#60;/p&#62;
&#60;p&#62;This, obviously, is by no means a *real* solution.  We'd *really* appreciate a custom reporting addition.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;#!/usr/bin/perl

use strict;
use warnings;

use DBI;

my ($num) = @ARGV;

my $dsn = &#38;quot;DBI:mysql:database=wordpress-site;host=localhost;port=3306&#38;quot;;
my $pw = &#38;quot;password&#38;quot;
my $dbh = DBI-&#38;gt;connect($dsn, &#38;quot;root&#38;quot;, $pw);

my $mexpr = &#38;quot;SELECT display_meta, entries_grid_meta FROM x_rg_form_meta WHERE form_id=?&#38;quot;;
my $mdata = $dbh-&#38;gt;selectrow_hashref($mexpr, {}, $num);

# weird encoding used by wordpress
# usage: ($rest_of_string, $result) = parsew $string;
sub parsew($);
sub parsew($)
{
	my ($str) = @_;
	if($str =~ s/^s:(\d+):&#38;quot;//)
	{
		my $n = $1;
		$str =~ s/^(.{$n})&#38;quot;//s
			or die &#38;quot;Format error at s:$n:\&#38;quot;$str&#38;quot;;
		return ($str, $1);
	}
	elsif($str =~ s/^N//)
	{
		return ($str, undef);
	}
	elsif($str =~ s/^[bi]:(-?\d+)//)
	{
		return ($str, $1);
	}
	elsif($str =~ s/^a:(\d+):\{//)
	{
		my $n = $1 * 2;
		my @o = ();
		if($n &#38;gt; 0)
		{
			for(0..$n-1)
			{
				($str, my $item) = parsew $str;
				push @o, $item;
				$str =~ s/^;?//;
			}
		}
		$str =~ s/^\}//
			or die &#38;quot;Format error in array (length $n, ends with $str)&#38;quot;;
		return $str, {@o};
	}
	else
	{
		die &#38;quot;Invalid field type: $str&#38;quot;;
	}
}
(undef, my $metadata) = parsew $mdata-&#38;gt;{display_meta};

my %fields = ();
for(values %{$metadata-&#38;gt;{fields}})
{
	$fields{$_-&#38;gt;{id}} = $_-&#38;gt;{label};
}
#use Data::Dumper; print Dumper $metadata;

my $expr = &#38;quot;SELECT COUNT(*) cnt, floor(x_rg_lead_detail.field_number*1) field_number, lead_id, IFNULL(x_rg_lead_detail_long.value, x_rg_lead_detail.value) value FROM x_rg_lead_detail LEFT JOIN x_rg_lead_detail_long ON x_rg_lead_detail.id = x_rg_lead_detail_long.lead_detail_id WHERE form_id=? GROUP BY field_number, value ORDER BY field_number ASC, cnt DESC, value ASC&#38;quot;;
my $data = $dbh-&#38;gt;selectall_arrayref($expr, { Slice =&#38;gt; {} }, $num);

my $lastfield = undef;
for(@$data)
{
	#$_-&#38;gt;{field_number} =~ /^(\d*)/; # extract the &#38;quot;main&#38;quot; field number
	if(!defined $lastfield &#124;&#124; $_-&#38;gt;{field_number} ne $lastfield)
	{
		$lastfield = $_-&#38;gt;{field_number};
		print &#38;quot;\n$fields{$lastfield}\n&#38;quot;;
	}
	my $val = $_-&#38;gt;{value};
	$val =~ s/\s+/ /g;
	print &#38;quot;\t$_-&#38;gt;{cnt}\t$val\n&#38;quot;;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Jeremy on "Custom Reporting"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-reporting#post-25310</link>
			<pubDate>Wed, 11 May 2011 13:22:15 +0000</pubDate>
			<dc:creator>Jeremy</dc:creator>
			<guid isPermaLink="false">25310@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I would pay for a reporting add-on.  We have to use other services at this point to do our surveys and reporting and we'd obviously like to keep everything in one place (and within our website structure).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Custom Reporting"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-reporting#post-21743</link>
			<pubDate>Mon, 28 Mar 2011 10:46:12 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">21743@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Currently there is not a Reporting Add-On.  It is something we would like to create in the future.  The only option right now is to export to CSV and create custom reports in Excel or something similar.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>zguerra on "Custom Reporting"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/custom-reporting#post-21711</link>
			<pubDate>Sun, 27 Mar 2011 14:15:57 +0000</pubDate>
			<dc:creator>zguerra</dc:creator>
			<guid isPermaLink="false">21711@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Is there a WP Reporting Suite plugin or something that works with Gravity Forms?  I understand you can export the submissions into Excel but I'm going to require custom reports of the submissions that I want to be able to view as a page within Gravity Forms but also export into Excel.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
