Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenTue, 27 Jun 2017 04:03:08 +0200Formulas in Data Field Type & Data fieldhttps://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/In Base Report Design how to I enter a formula here:
![image description](/upfiles/14978442763841407.png)
----------
I want to put in something like for example CONCAT(`FieldName1`, ' ', `FieldName2`) in for the `Data field`. It appears that it will take this from the `=` sign here ![image description](/upfiles/14978443751572734.png) but I can't figure out how to enter a formula.
----------
*I know that I can do this in the underlying query, but it just seemed like I was also able to do this in the Report design editor.*Mon, 19 Jun 2017 05:57:20 +0200https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/Answer by charlie.it for <p>In Base Report Design how to I enter a formula here:</p>
<p><img alt="image description" src="/upfiles/14978442763841407.png"></p>
<hr>
<p>I want to put in something like for example CONCAT(<code>FieldName1</code>, ' ', <code>FieldName2</code>) in for the <code>Data field</code>. It appears that it will take this from the <code>=</code> sign here <img alt="image description" src="/upfiles/14978443751572734.png"> but I can't figure out how to enter a formula.</p>
<hr>
<p><em>I know that I can do this in the underlying query, but it just seemed like I was also able to do this in the Report design editor.</em></p>
https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?answer=101473#post-id-101473Ciao, use: `[FieldName1] & " " & [FieldName2]`
**If my answer helped you, vote it with ✔ (here on the left)**
`Edit:` in this file it works:
[Report con 2 campi concatenati.odb](/upfiles/14982862766901474.odb)
![image description](/upfiles/14982863557229061.png)
Mon, 19 Jun 2017 18:20:01 +0200https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?answer=101473#post-id-101473Comment by EasyTrieve for <p>Ciao, use: <code>[FieldName1] & " " & [FieldName2]</code></p>
<p><strong>If my answer helped you, vote it with ✔ (here on the left)</strong></p>
<p><code>Edit:</code> in this file it works:</p>
<p><a href="/upfiles/14982862766901474.odb">Report con 2 campi concatenati.odb</a></p>
<p><img alt="image description" src="/upfiles/14982863557229061.png"></p>
https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?comment=101704#post-id-101704Thanks @charlie.it , I tried it but it does not work for me.Wed, 21 Jun 2017 16:08:22 +0200https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?comment=101704#post-id-101704Comment by charlie.it for <p>Ciao, use: <code>[FieldName1] & " " & [FieldName2]</code></p>
<p><strong>If my answer helped you, vote it with ✔ (here on the left)</strong></p>
<p><code>Edit:</code> in this file it works:</p>
<p><a href="/upfiles/14982862766901474.odb">Report con 2 campi concatenati.odb</a></p>
<p><img alt="image description" src="/upfiles/14982863557229061.png"></p>
https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?comment=101975#post-id-101975Please seee my `Edit`Sat, 24 Jun 2017 08:35:21 +0200https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?comment=101975#post-id-101975Comment by EasyTrieve for <p>Ciao, use: <code>[FieldName1] & " " & [FieldName2]</code></p>
<p><strong>If my answer helped you, vote it with ✔ (here on the left)</strong></p>
<p><code>Edit:</code> in this file it works:</p>
<p><a href="/upfiles/14982862766901474.odb">Report con 2 campi concatenati.odb</a></p>
<p><img alt="image description" src="/upfiles/14982863557229061.png"></p>
https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?comment=102460#post-id-102460Ok, Thanks. Finally figured out how to get it to work: after you edit the `Data Field` you must move the focus out of the Data Field , e.g. by typing Tab or the like. (This is obviously a bug, but I've reported so many recently that I'm going to let this one lie for now.)Tue, 27 Jun 2017 03:55:42 +0200https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?comment=102460#post-id-102460Comment by EasyTrieve for <p>Ciao, use: <code>[FieldName1] & " " & [FieldName2]</code></p>
<p><strong>If my answer helped you, vote it with ✔ (here on the left)</strong></p>
<p><code>Edit:</code> in this file it works:</p>
<p><a href="/upfiles/14982862766901474.odb">Report con 2 campi concatenati.odb</a></p>
<p><img alt="image description" src="/upfiles/14982863557229061.png"></p>
https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?comment=102461#post-id-102461Also for what it's worth, some SQL function appear to work, like `Pi()`, but many SQL function silently fail to work. In particular one of my fields allows nulls, and so when the strings are concatenated by default if either string is null they sum to null which is no good. Normally I use `IFNULL(..)` or `COALESCE(..)` to fix this, but neither seems to work, at least not in Mariadb, nor HSQLDB1.8. Also `LEFT("abc")` returns "a", but `LEFT("abc",2)` returns nothing. So, this works, barely.Tue, 27 Jun 2017 04:03:08 +0200https://ask.libreoffice.org/en/question/101283/formulas-in-data-field-type-data-field/?comment=102461#post-id-102461