<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 href="mailto:hovercrafter@earthlink.net" target="_blank">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 class="HOEnZb"><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 class="h5">
      On 1/19/2015 9:37 AM, Lluís Forns wrote:<br>
    </div></div></div><div><div class="h5">
    <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 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>