• Resolved alexpinson

    (@alexpinson)


    I am using an HTML form to filter out certain Airtable data on the website side of things. The issue I am having using the

    $query->addFilter() function is that I can’t use multiple filters at once. Am I just using it wrong, or does it only allow one filter to be applied? Here’s my code:

    `<?php
    $query = new AirpressQuery();

    $query->setConfig(/*Insert title of Airtable Connection configuration*/”Speeds & Feeds”);

    $query->table(“Cutting Tool”)->view(“Grid view”);

    if($_POST[‘Brand_Lakeshore_Carbide’] == “Lakeshore Carbide”){
    $query->addFilter(“{Brand}=’Lakeshore Carbide'”);
    }
    elseif($_POST[‘Brand_AB_Tools’] == “AB Tools”){
    $query->addFilter(“{Brand}=’A.B. Tools'”);
    }
    elseif($_POST[‘Type_Face_Mill’] == “Face Mill”){
    $query->addFilter(“{Type of Cutting Tool}=’Face Mill'”);
    }

    $events = new AirpressCollection($query);

    foreach($events as $e){
    $piclink = $e[“Tool Picture Link”];
    echo $e[“Tool Diameter”] . “<br>”;
    }
    ?>

Viewing 1 replies (of 1 total)
  • Plugin Author Chester McLaughlin

    (@chetmac)

    Can you copy/paste the output from the airpress.log for this query?

    I use multiple addFilter calls all the time, so it should work fine.

    Here’s one of my actual production code snippets:

    
    $query->addFilter("IS_BEFORE({End Date},TODAY())");
    $query->addFilter("IS_AFTER({Start Date},'" . date("m/d/Y",time()-YEAR_IN_SECONDS) . "')");
    $query->addFilter("NOT({Trip ID} = '')")->sort("Start Date");
    $query->addFilter("NOT({Registration Status} = 'cancelled')");
    
Viewing 1 replies (of 1 total)
  • The topic ‘Applying Multiple Filters’ is closed to new replies.