[Solved] If Else with an empty array

Discuss the spreadsheet application
Post Reply
JessyRey
Posts: 3
Joined: Thu Sep 28, 2017 3:47 pm

[Solved] If Else with an empty array

Post by JessyRey »

Hello everyone,

hope you might help me.

$if('$$Geschl'=='weiblich', 'Frau', $if('$$Geschl'=='männlich', 'Herr', ' '))
$$Vorname $if('$$AntiZus'<> ' ', $$AntiZus, ' ') $$Nachname
$$Strasse
$$PLZ $$Ort

I am trying to generate an address array in Libre Office Writer.
The first line works properly, the second with "Vorname" and "Nachname" too.
But I am struggling with the "name affic" and the "second address line" - here $$AntiZus and $$Zusatz. If there is a "name affic" i want it to appear in the line with the name . But if the field is empty, the field should not be displayed. The same with "$$AntiZus" - if there is an additional address, display it. But if not, do not. Actually it looks like this, if the "AntiZus" and "Zusatz" field is empty:

Rosa $$AntiZus Testname
$$Zusatz
Borussiastrasse 158
44145 Dortmund

and like this if the "AntiZus" and the "Zusatz" fields are not empty:

Rosa von Testname
Room 200
Borussiastrasse 158
44145 Dortmund

Hope you understand whats the problem is and might help me with this one. I am a newbie with coding by the way. Answers in englisch or german would be great. :)

Thanks a lot.
Last edited by JessyRey on Wed Oct 04, 2017 2:14 pm, edited 2 times in total.
LibreOffice 5.3.6.1 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: If Else with an empty array

Post by Villeroy »

Why don't you use serial letters (aka mail merge, form letters)?

http://freesoftwaremagazine.com/article ... ffice_org/ (paragraph below Figure 2)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
JessyRey
Posts: 3
Joined: Thu Sep 28, 2017 3:47 pm

Re: If Else with an empty array

Post by JessyRey »

I need the .odt file for a reporting system. I dont have access to the database itself. Only have to create the odt documents and upload them to the reporting system in HisInOne. So i guess that doesnt work for me, right?
LibreOffice 5.3.6.1 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: If Else with an empty array

Post by Villeroy »

It is totally unclear what you are doing here. Are you working with Writer? You posted in the Calc forum.
Are you working with an office suite anyway?
$if('$$Geschl'=='weiblich', 'Frau', $if('$$Geschl'=='männlich', 'Herr', ' '))
Is this a programming language? Pseudo-Code?

If you don't have access to the database that is supposed to substitute your variables, then the other side should provide access to the databsae. If that database is accessible via ODBC, JDBC or by means of a built-in office driver (SDBC) then it would be a matter of seconds to create a Base document on the target system. A Base document is a bridge between one database and office documents.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
JessyRey
Posts: 3
Joined: Thu Sep 28, 2017 3:47 pm

Re: If Else with an empty array

Post by JessyRey »

Nevermind, I solved it now. I just had to write an ! behind the variable.
$$Zusatz! - so he leaves an empty field, if the database field is empty.

Thanks anyway!
LibreOffice 5.3.6.1 on Windows 7
Post Reply