WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form DB
Exporting based on certain values (4 posts)

  1. zaccubus
    Member
    Posted 1 year ago #

    I am struggling to export certain database values entered by the contact form.

    My contact form is for real estate enquiries, such as:
    name, email, buying/selling, enquiry type (e.g house, land), location (e.g america, africa, new zealand), subject, and message.

    What I am wanting to do is export emails only for different variables.
    An example would be I want to get the email for people wanting to buy, house, in america.

    I have got to the stage where I can get e.g email for, "buying", but when I add more filters it just includes all listed locations no matter if its a house or unit.

    an example of the filter is:
    buyingorselling=Buying&&House=House&&America=America||Africa=Africa
    the results given can be correct, but it will show emails from people who are also "selling" if the locations are there.

    I have no idea if the filter is capable of doing this, I am only using the "database short code" page and the filter towards the bottom.

    http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/

  2. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    The AND and OR logic computes as:

    (Buying&&House=House&&America=America ) || Africa=Africa

    So if the Africa=Africa evaluates to true, then the whole filter is true and the row is shown.

  3. zaccubus
    Member
    Posted 1 year ago #

    wow thanks so much,I get it now, its been doing my head in! Very much appreciated feedback :)

    Is there a way to work with it so I can use the OR within the AND.

    e.g If I want to get the emails for multiple locations not exactly both, but either.

  4. Michael Simpson
    Member
    Plugin Author

    Posted 1 year ago #

    Unfortunately the boolean logic cannot be grouped by paratheses which limits how much you can express.

    So in a mixed AND and OR expression, ANDs get evaluated first and ORs last. This is standard convention. It is analogous to mathematical expressions where you would think of AND like multiplication and OR as addition.

    So a an expression like
    A || B && C || D = A || (B&&C) || D
    evaluates in analogous way to
    A + B x C + D = A + (BxC) + D

    But if you wanted something to evaluate like
    (A||B) && (C||D)
    You would need the parentheses and that is not currently supported

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.