PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Getting values from the database

  1. vixvii
    Member

    I know reporting is not a function of gravity forms, but how difficult is it to access data in the database? All I need to do is create pie charts based on user registration data. I want to use the EasyChartBuilder plugin and it's syntax is pretty straight forward, it uses manual data entries to draw the chart eg :
    [easychart type="pie" height="300" width="620" title="Sample pie chart" groupnames="Group 1, Second group, Group 3" groupcolors="FF00FF, 005599, 229944" valuenames="Value 1, Value 2, Value 3, Value 4" group4values="22, 41, 15, 133"]

    So... if I can get the data from the database, do the calculations in php and just create a shortcode, I am set.

    From what I read in some of the other posts, the gravity forms data in the database is not so easy to access?

    Or is there maybe another way of doing this?

    Posted 10 years ago on Sunday June 5, 2011 | Permalink
  2. The data is stored in a way that is not so straight forward to retrieve, but there are functions in Gravity Forms that will do most of the work for you. What data are you looking to populate the graph with? Data across multiple fields or just one field? What type of field(s)?
    If you can be a little more specific on how you want to use your data, I will be able to give you code snippet that will help you get this done.

    Posted 10 years ago on Monday June 6, 2011 | Permalink
  3. vixvii
    Member

    Thanks for the prompt reply! The problem is a little bit more complicated than just the graphs. I need to create a completely new log in form which will register a new Wordpress user (Team Leader), but then there needs to be up to 11 sub members associated to the main user. The "sub-users" won't have any log in rights, they will basically be the team members and I need to capture Age, Race, Sex and Region. So I need to be able to draw graphs of these 3 fields to display average age etc.

    The Team Leader will never change, but he must also be able to edit Team members by adding or removing members.

    The more I type about this - the bigger the mountain feels :-)

    Posted 10 years ago on Monday June 6, 2011 | Permalink
  4. @vixvii What you want is very specialized. Gravity Forms could do what you want but not without customizing it. You would need to know how you want it to work and then be able to implement the customizations using PHP and available Gravity Forms API hooks that are in the Developer Docs area of the Documentation to implement your customizations.

    Posted 10 years ago on Monday June 6, 2011 | Permalink
  5. vixvii
    Member

    I understand it is very specialized and I don't expect an out of the box solution either. I love the way Gravity Forms work and I need a platform to start off with. I am just a bit concerned about the posts on retrieving data directly from the database. I don't want to start with Gravity Forms and run into major problems later.

    I appreciate the help and will look at the Developer Docs. If I could maybe just get some basic guidelines as to what I am looking for in these Docs? Just a shorthand breakdown of how you see the process will go? I will hack my way through the coding :-)

    Posted 10 years ago on Monday June 6, 2011 | Permalink
  6. I am still a little bit fuzzy on exactly what you need as far as getting the data, but here is some info on how the data is stored. There is a main entry table (wp_rg_lead). Every entry created by Gravity Forms will create a record in the wp_rg_lead table. This table, doesn't however keep the actual field values. Those are stored in the wp_rg_lead_detail table. This table has a lead_id column which is a foreign key to the wp_rg_lead table and also a field_number column that maps to the ID of the field.
    So, if you have a form with the fields (age, race and sex), and assuming the field Ids are age=1, race=2 and sex=3, the data related to a submission of that form would look like the following:

    wp_rg_lead
    id    date_created    .....other columns
    1     6/5/2011
    
    wp_rg_lead_detail
    id    lead_id   field_number       value
    1     1            1                20
    2     1            2              white
    3     1            3              hispanic

    So, to read all values for the age field, you would query the wp_rg_lead_detail table WHERE field_number = 1

    As far as hooks that you will need to use to pull off your custom functionality, it looks like a good one to start looking is the gform_post_submission hook (http://www.gravityhelp.com/documentation/page/Gform_post_submission). It allows you to do any processing needed after a form is successfully submitted.

    Good Luck!

    Posted 10 years ago on Monday June 6, 2011 | Permalink
  7. vixvii
    Member

    Thanks again Alex! This is definitely helping and putting me on the right track. I think I have combined several problems in one and that is why it is so "fuzzy" - but your answer is definitely spot on to my main problem. Basically...

    1) I have a multisite set up where teams can register
    2) The Team Leader is the Wordpress User, so he will register
    3) Upon registration he must also fill in his team members' details
    4) The Team Leader must be able to edit his team members' details
    5) As "Superadmin" I need to be able to draw a list of all the teams, pull reports on demographics etc.

    By being able to access data straight in the database, I can write my own functions to pull the required data for the reports. Your answer on the database says to me it is not as complicated as some of the other posts made it out to be, and using hooks I can even do a lot of the calculations as soon as a form is submitted.

    I will start my journey and take it one small step at a time :-)

    Posted 10 years ago on Tuesday June 7, 2011 | Permalink
  8. I am glad i was able to help.
    Good luck!!

    Posted 10 years ago on Tuesday June 7, 2011 | Permalink
  9. vixvii, i quess it could be useful http://www.geertdedeckere.be/shop/graphup

    Posted 10 years ago on Friday June 10, 2011 | Permalink
  10. vixvii
    Member

    Dimitri thanks for this and I will definately have a look, for now I first need to capture the data to display :-)

    Please let me know if I need to create a new topic for this, but it is still part of my overall problem. I created the user registration form and it works great, but I need to register up to 11 students too. Is it possible to have a form within a form? I need to register the students the same time I do the user registration for the multisite.

    I want to have a dropdown to select the nr of students to register and it must bring up the student registration form X nr of times. My only other option (what I can see) is to have 11 student registration fields for name, age etc. And display the fields with a conditional argument...

    Posted 10 years ago on Friday June 10, 2011 | Permalink
  11. @vixvii This isn't a feature of the User Registration Add-On. The User Registration Add-On only registers/creates one user at a time. If you wanted to do this, you'd have to write your own customization to handle the user registration of the additional students.

    Posted 10 years ago on Friday June 10, 2011 | Permalink
  12. vixvii
    Member

    Carl, thanks for the reply - just to clarify, the students won't be registered as wordpress users. I just need to capture all their details and this should be linked to the Team Leader (Actual Wordpress user)

    Reading some of the other posts on the forum I think you did suggest to someone that you are hoping to implement "sub-forms" in version 1.5.3? But in the mean time creating a field for every entry and using conditional logic is the way to go. This isn't a problem - I just want to do the right thing ;-)

    Thanks

    Posted 10 years ago on Saturday June 11, 2011 | Permalink
  13. was this ever resolved? I am also in need of having a reporting program... I have a membership site where people log in referrals, they need to be able to check the following in some form of a data string:

    Each referral forms has 4 spots we want pulled back into a report on a user basis...

    the person given the referral and giver of the referral, name of referral, date, dollar amount

    that is it!

    I really could use this resolved this week!

    David

    Posted 9 years ago on Monday November 28, 2011 | Permalink
  14. vixvii
    Member

    David - sorry I only saw your comment now and I know it is most probably WAY too late. But just an update. Reporting wasn't "resolved" but once you know how the data is stored it isn't too difficult to write your own reporting. I am a php "hacker" and I have no real clue what I am doing, but I got pretty far in terms of reporting and putting Gravity Forms to good use.

    Posted 9 years ago on Wednesday September 5, 2012 | Permalink
  15. I would love to see what your insight is... Are you on Skype? drosales43 is my Skype handle

    Posted 9 years ago on Wednesday September 5, 2012 | Permalink

This topic has been resolved and has been closed to new replies.