# Tingimuste kirjeldamine

Tingimusi on vĂµimalik kirjeldada jĂ¤rgnevatele vĂ¤ljatĂĽĂĽpidele:

1. Tingimuslik tekst: kui tingimus on tĂ¤idetud, kuvatakse teksti A, kui mitte, siis teksti B.

2. Peidetud tekst: kui tingimus on tĂ¤idetud, peidetakse vĂ¤lja sisu.

3. Peidetud lĂµik: kui tingimus on tĂ¤idetud, peidetakse lĂµik.

4. Any record and next record: controls the access to database records.

The simplest way to define a condition is to type the logical expression directly in a Condition box using the following values:

 TĂ•ENE Tingimus on alati tĂ¤idetud. Tingimusliku tekstina vĂµib sisestada ka suvalise nulliga mittevĂµrdse vĂ¤Ă¤rtuse. VĂ„Ă„R Tingimus pole tĂ¤idetud. VĂµid sisestada vĂ¤Ă¤rtuseks ka 0.

JĂ¤ttes kasti Tingimus tĂĽhjaks, interpreteeritakse seda mittetĂ¤idetud tingimusena.

When you define a condition, use the same elements for defining a formula, namely comparative operators, mathematical and statistical functions, number formats, variables and constants.

Tingimuse kirjeldamiseks on vĂµimalik kasutada jĂ¤rgnevaid muutujatĂĽĂĽpe:

1. Predefined LibreOffice variables that use statistics on document properties

2. Custom variables, that are a created with the "Set variable" field

You cannot use internal variables, such as page and chapter numbers, in condition expression.

 x == 1 vĂµi x EQ 1 Tingimus on tĂµene, kui "x" vĂµrdub 1. x != 1 vĂµi x NEQ 1 Tingimus on tĂµene, kui "x" ei vĂµrdu 1. sinx == 0 Tingimus on tĂµene, kui "x" on pii kordne.

 x == "ABC" vĂµi x EQ "ABC" Kontrollib, kas muutuja "x" sisaldab (tĂµene) stringi "ABC" vĂµi mitte (vĂ¤Ă¤r). x == "" vĂµi x EQ "" vĂµi !x vĂµi NOT x Kontrollib, kas muutuja "x" on tĂĽhistring.

The "equal" comparative operator must be represented by two equal signs (==) in a condition. For example, if you define a variable "x" with the value of 1, you can enter the condition as x==1.

## Isikuandmed

You can include user data when you define conditions. To change your user data, choose - LibreOffice - User data. User data must be entered in the form of strings. You can query the user data with "==" (EQ), "!=" (NEQ), or "!"(NOT).

JĂ¤rgnev tabel kirjeldab isikuandmete muutujaid ja nende tĂ¤hendusi:

 Muutuja TĂ¤hendus user_firstname Eesnimi user_lastname Perekonnanimi user_initials Initsiaalid user_company EttevĂµte user_street TĂ¤nav user_country Riik user_zipcode Postiindeks user_city Linn user_title Tiitel user_position Amet user_tel_work TĂ¶Ă¶telefon user_tel_home Kodune telefon user_fax Faksinumber user_email Meiliaadress user_state Maakond (mitte kĂµigis LibreOffice'i versioonides)

NĂ¤iteks, kui soovid peita lĂµiku, teksti vĂµi sektsiooni kasutaja eest, kelle initsiaalideks on "LM", siis sisesta tingimuseks user_initials=="LM".

You can define conditions for accessing databases, or database fields. For example, you can check the contents of a database field from a condition, or use database fields in logical expressions. The following table lists a few more examples of using databases in conditions:

 NĂ¤ide TĂ¤hendus Andmebaas.Tabel.EttevĂµte Andmebaas.Tabel.EttevĂµte NEQ "" Andmebaas.Tabel.EttevĂµte != "" Tingimus on tĂµene, kui vĂ¤li ETTEVĂ•TE ei ole tĂĽhi. Esimeses nĂ¤ites polegi tehtemĂ¤rki vaja. !Andmebaas.Tabel.EttevĂµte NOT Andmebaas.Tabel.EttevĂµte Andmebaas.Tabel.EttevĂµte EQ "" Andmebaas.Tabel.EttevĂµte == "" Returns TRUE if the COMPANY field is empty. Andmebaas.Tabel.EttevĂµte !="Sun" Andmebaas.Tabel.EttevĂµte NEQ "Sun" Returns TRUE if the current entry in the COMPANY field is not "Sun". (Exclamation sign represents a logical NOT.) Andmebaas.Tabel.Eesnimi AND Andmebaas.Tabel.Nimi Tagastab tĂµese vĂ¤Ă¤rtuse, kui kirje sisaldab nii ees- kui perekonnanime.

Note the difference between the boolean NOT "!" and the comparative operator not equal "!=" (NEQ).

When you refer to a database field in a condition, use the form Databasename.Tablename.Fieldname. If one of the names contains a character that is an operator, such as a minus sign (-), enclose the name in square brackets, for example, Databasename.[Table-name].Fieldname. Never use spaces inside field names.

### NĂ¤ide: tĂĽhja andmebaasivĂ¤lja peitmine

Sul vĂµib tekkida soov luua tingimus, mis peidab tĂĽhja vĂ¤lja. NĂ¤iteks, kui mĂµnede kirjete vĂ¤li ETTEVĂ•TE on tĂĽhi.

Select the Hidden Paragraph list entry, and type the following condition: Addressbook.Addresses.Company EQ ""

vĂµi sisesta jĂ¤rgnev

Kui vĂ¤li ETTEVĂ•TE on tĂĽhi, siis on tingimus tĂµene ja lĂµik peidetakse.

To display hidden paragraphs on the screen, you can choose - LibreOffice Writer - Formatting Aids, and clear the Fields: Hidden paragraphs check box.

## Examples of Conditions in Fields

The following examples use the Conditional text field, although they can be applied to any fields that can be linked to a condition. The syntax used for conditions is also used for the Hidden text, Hidden paragraph, Any record or Next record fields.

## Tingimusliku teksti kuvamine vastavalt lehekĂĽlgede arvule:

1. Vali Lisamine - VĂ¤ljad - Muud ja klĂµpsa kaardil Funktsioonid.

2. KlĂµpsa loendis TĂĽĂĽp oleval kirjel "Tingimuslik tekst".

3. Sisesta kasti Tingimus vĂ¤Ă¤rtuseks "page == 1".

4. In the Then box, type "There is only one page".

5. In the Or box, type "There are several pages".

6. KlĂµpsa Lisa ja seejĂ¤rel Sulge.

## To display conditional text based on a user-defined Variable

2. In the Type list, click "Set Variable".

3. In the Name box, type "Profit".

4. In the Value box, type "5000".

5. KlĂµpsa Lisa.

6. Click the Functions tab, and click "Conditional text" in the Type list.

7. Sisesta kasti Tingimus vĂ¤Ă¤rtuseks "Kasum < 5000".

8. In the Then box, type "Target is not met".

9. In the Or box, type "Target is met".

10. KlĂµpsa Lisa.

To edit the contents of the "Profit" variable, double-click the variable field.

## To display conditional text based on the contents of a database field:

The first part of this example inserts a space between the "First Name" and "Last Name" fields in a document, and the second part inserts text based on the contents of a field. This example requires that an address data source is registered with LibreOffice.

1. Vali Lisamine - VĂ¤ljad - Muud - kaart Andmebaas.

2. In the Type list, click "Mail merge fields".

3. In the Database selection box, double-click an address book, click "First Name", and then click Insert. Repeat for "Last Name".

4. In the document, place the cursor between the two fields, press Space, and then return to the Fields dialog:

5. Click the Functions tab, and then click "Conditional text" in the Type list.

7. In the Then box, type a space and leave the Or box blank.

You can now use a condition to insert text based on the contents of the First Name field.

1. In the Fields dialog, click the Functions tab.

2. KlĂµpsa loendis TĂĽĂĽp oleval kirjel "Tingimuslik tekst".