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.

RG_LEAD_DETAIL table uniques

  1. In the wp_rg_lead_detail table, taken together are the three columns "lead_id", "form_id", and "field_number" always unique?

    Posted 7 years ago on Monday February 18, 2013 | Permalink
  2. Yes, combined, those three fields can form a unique key. For one form and one lead, there can only be one value stored for a field_number.

    Posted 7 years ago on Monday February 18, 2013 | Permalink
  3. Perfect. By the way, does gravity forms provide an API to update a set of these rows? (I'm trying to figure out how to update a set of these values and if it doesn't exist, create a new row.)

    ...happy to just have you answer, "we don't support that." Thanks for the help regarding my orginal question!

    Posted 7 years ago on Monday February 18, 2013 | Permalink
  4. There is no API really. The best documentation for the plugin is the plugin files themselves. If you can explain your use case, maybe we can come up with more ideas for you.

    Posted 7 years ago on Monday February 18, 2013 | Permalink
  5. I've created an form that updates enteries of another form. I hook into the submission, and custom process it, updating the database with a query like such: http://pastebin.com/cnp8P5HA

    The problem is, with this query, if the original form did not create a new row (for instance if the field was empty), then this data is not updated (because it doesn't exisit to be update.)

    So I'm trying to come up with an elegant solution. I was thinking ON DUPLICATE KEY UPDATE might work, but the current database structure doesn't seem (in my limited sql experience) to jive with it as I need knowledge of the primary_key.

    Perhaps you have an idea, or perhaps you could show me where the code exists to update the exisiting form from the admin area.

    Posted 7 years ago on Monday February 18, 2013 | Permalink
  6. Just to be sure I follow along, with this question:

    Perhaps you have an idea, or perhaps you could show me where the code exists to update the exisiting form from the admin area.

    Do you mean the code to update an existing entry in the admin? If so, you can look at forms_model.php around line 798 for the function save_lead:

    [php]
    public static function save_lead($form, &$lead){

    That might give you some clues.

    Posted 7 years ago on Monday February 18, 2013 | Permalink
  7. Yup, thanks.

    Posted 7 years ago on Monday February 18, 2013 | Permalink