<div dir="ltr">I think the way shoud be adding a filter for NID where: nid NOT IN (custom PHP)<div><br></div><div>AND use custom php to select all nids with bookings for those days (loading a view)</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-19 17:46 GMT+01:00 Lluís Forns <span dir="ltr">&lt;<a href="mailto:enboig@gmail.com" target="_blank">enboig@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Not working; nearly solved this using:<div>[other filters]</div><div>AND</div><div>[</div><div>filter_start_date &gt; booking_end_date</div><div>OR</div><div>filter_end_date&lt;booking_start_date</div><div>OR</div><div>booking_nid IS NULL</div><div>]</div><div><br></div><div>But nearly all rooms appear because they have previous bookings outside the interval.</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-01-19 16:52 GMT+01:00 Steve Kessler <span dir="ltr">&lt;<a href="mailto:skessler@denverdataman.com" target="_blank">skessler@denverdataman.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you require the relationship it should fix that.<span><span></span><br><br>On Monday, January 19, 2015, Lluís Forns &lt;<a href="mailto:enboig@gmail.com" target="_blank">enboig@gmail.com</a>&gt; wrote:<br></span><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I was trying to make it without coding a new module; the steps and the result are:<div><br></div><div>1. created a join, which is no required</div><div>I can list all the rooms with the nid of bookings (if avaliable).</div><div>2. Created a filter per dates:</div><div>only rooms with bookings for that night are available</div><div>3. Filter for NULL related booking nid</div><div>No room listed</div><div><br></div><div>I think the filter should affect only joined content, but it it is affecting the full content. How can I limit to the join?</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-19 16:07 GMT+01:00 Jamie Holly <span dir="ltr">&lt;<a>hovercrafter@earthlink.net</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>How are you associating the rooms
      content type to the reservations one? If you&#39;re using entity
      reference, then you would want to create a relationship with the
      reservations content type through that reference field. Make sure
      you don&#39;t check &quot;require this relationship&quot; then add a filter so
      that the related node (reservations) nid is NULL. <br>
      <br>
      The other option is in a custom module, using
      hook_views_query_alter. Load the reserved room nids, through a
      normal DB query, then add a NOT IN condition to the list of nids.
      Here&#39;s the documentation on that hook:<br>
      <br>
<a href="https://api.drupal.org/api/views/views.api.php/function/hook_views_query_alter/7" target="_blank">https://api.drupal.org/api/views/views.api.php/function/hook_views_query_alter/7</a><span><font color="#888888"><br>
      <br>
      <pre cols="72">Jamie Holly
<a href="http://hollyit.net" target="_blank">http://hollyit.net</a></pre></font></span><div><div>
      On 1/19/2015 9:37 AM, Lluís Forns wrote:<br>
    </div></div></div><div><div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>I have a site with 2 content types: rooms and reservations.
          I want to list all the rooms without a reservation for an
          interval, and also for services, capacity, ....<br>
        </div>
        <div><br>
        </div>
        <div>I tried creating a view with a PHP filter to check free
          rooms, but then if the page lists 10 rooms, sometimes there
          are 7, 2, or 0; because the filter lists the 10 rooms and
          after remove the occupied ones.<br clear="all">
          <div><br>
          </div>
          <div>I have tried to create a &quot;subview&quot; filter to select nodes
            &quot;not in (view of occupied rooms); but I haven&#39;t find a way
            to do so.</div>
          <div><br>
          </div>
          <div>Any idea of how to accomplish this?</div>
          <div><br>
          </div>
          <div>thanks</div>
          -- <br>
          <div>*Ser freak no és imprescindible
            per ser informàtic, però ajuda.<br>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
    </blockquote>
    <br>
  </div></div></div>

<br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>*Ser freak no és imprescindible per ser informàtic, però ajuda.<br>*La vida no ha de ser feliç, ha de ser plena.<br>*Abans d&#39;imprimir aquest missatge, pensa en el medi ambient.</div>
</div>
</blockquote><br><br></div></div><div><div>-- <br>Steve Kessler<div>Owner and Lead Consultant </div><div>Denver DataMan, LLC </div><div>303-587-4428</div><br>
</div></div><br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>*Ser freak no és imprescindible per ser informàtic, però ajuda.<br>*La vida no ha de ser feliç, ha de ser plena.<br>*Abans d&#39;imprimir aquest missatge, pensa en el medi ambient.</div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">*Ser freak no és imprescindible per ser informàtic, però ajuda.<br>*La vida no ha de ser feliç, ha de ser plena.<br>*Abans d&#39;imprimir aquest missatge, pensa en el medi ambient.</div>
</div>