[Solved] If Else with an empty array

Discuss the spreadsheet application

[Solved] If Else with an empty array

Postby JessyRey » Thu Sep 28, 2017 4:04 pm

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
JessyRey
 
Posts: 3
Joined: Thu Sep 28, 2017 3:47 pm

Re: If Else with an empty array

Postby Villeroy » Thu Sep 28, 2017 11:24 pm

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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 24400
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: If Else with an empty array

Postby JessyRey » Fri Sep 29, 2017 8:11 am

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
JessyRey
 
Posts: 3
Joined: Thu Sep 28, 2017 3:47 pm

Re: If Else with an empty array

Postby Villeroy » Fri Sep 29, 2017 1:35 pm

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 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 24400
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: If Else with an empty array

Postby JessyRey » Wed Oct 04, 2017 2:13 pm

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
JessyRey
 
Posts: 3
Joined: Thu Sep 28, 2017 3:47 pm


Return to Calc

Who is online

Users browsing this forum: No registered users and 44 guests