<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Subforms: Connecting to a field created by a function fails - wrong SQL-Code"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=107457">107457</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Subforms: Connecting to a field created by a function fails - wrong SQL-Code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0.0.5 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Base
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>robert@familiegrosskopf.de
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="http://bugs.documentfoundation.org/attachment.cgi?id=132872" name="attach_132872" title="Open the form and have a look at the SQL-error. Appears since LO 5.*">attachment 132872</a> <a href="http://bugs.documentfoundation.org/attachment.cgi?id=132872&action=edit" title="Open the form and have a look at the SQL-error. Appears since LO 5.*">[details]</a></span>
Open the form and have a look at the SQL-error. Appears since LO 5.*

Open the attached database.
Open the form.
An SQL-error appears.
Let you show the details of the error. It gives the following code:

SELECT "ID", "Text", "DateStart", "DateEnd", YEAR( "DateStart" ) AS
"YearStart", YEAR( "DateEnd" ) AS "YearEnd" FROM "Table" WHERE ( "YEAR(
"DateStart" )" = :link_from_YearStart ) AND ( "YEAR( "DateEnd" )" =
:link_from_YearEnd )

The query uses the function YEAR. The code after WHERE is wrong. There are
double-quotes added around function and fieldname. Must be YEAR( "DateStart" ),
not "YEAR( "DateStart" )"

The form will work right in LO 4.4.7.2
Fails first here with LO 5.0.0.5
Both tested with OpenSUSE 42.1 64bit rpm Linux.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>