Das Notes Forum

Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: ReneX am 04.06.03 - 12:11:34

Titel: Feld überprüfen
Beitrag von: ReneX am 04.06.03 - 12:11:34
Hallo,

habe ein kleines Problem.
Ich lese mit wert=doc.getitemvalue("Feld") den Wert eines Feldes aus, der mir als ja Variant zurück gegeben wird.
Nun möchte ich überprüfen ob etwas in dem Feld steht oder nicht.
Habe es mit
if wert="" Then ...
versucht, bekomme dann aber eine Fehlermeldung ("Type mismatch")

Wer hat einen Tip

mfg
Rene
 ???
Titel: Re:Feld überprüfen
Beitrag von: MadMetzger am 04.06.03 - 12:22:14
musst du als array ansprechen:
if wert (0) = "" then ...
falls das feld eine werteliste enthält bekommst du die über wert (1) etc.
Titel: Re:Feld überprüfen
Beitrag von: Axel_Janssen am 04.06.03 - 12:28:06
oder Du arbeitest mit dieser Syntax (sieht nicht nur komisch aus, ist es auch, ist aber praktisch):

wert=doc.getitemvalue("Feld") (0)

Dann bekommst Du das erste Element des Arrays zurück.
Meistens will man das, da Felder meistens keine Mehrwertfelder sind.

Axel
Titel: Re:Feld überprüfen
Beitrag von: Rob Green am 04.06.03 - 12:32:46
zum Variant handling:
Variant is a special data type: variables of type Variant can hold values of any of the following data types that LotusScript recognizes, except for user-defined data types:
A value of any of the scalar data types that LotusScript supports — Boolean, Byte, Integer, Long, Single, Double, Currency, String
A date/time value
An array or list
An object reference, that is, a pointer to an OLE Automation object or to an instance of a product-defined or user-defined class, or an object reference to a Java Object.
The NULL value
The EMPTY value
You declare a Variant variable the same way you declare a scalar variable — explicitly or implicitly.  If no Deftype statements are applicable, a variable that you declare without using an As dataType clause or a data type suffix is of type Variant. Here, Variant variables appear with the suffix V to distinguish them from object reference variables or variables of some user-defined data type. For example:
Dim myVariant1V As Variant
Dim myVariant2V
Public myVariant3V As Variant
myVariant4V = 123.45
When you declare a Variant variable explicitly, LotusScript initializes it to the special value EMPTY. (Use the function IsEmpty to test a Variant variable for this value.) Declaring a Variant variable is less efficient than assigning it another data type, but is convenient. When you assign a Variant variable a value, LotusScript determines the data type of that value in either of two ways, depending on the available information:...

Sprich:
IsEmpty(variant) or variant(0) = ""
Titel: Re:Feld überprüfen
Beitrag von: ReneX am 04.06.03 - 13:09:18
Vielen Dank für die super schnellen Antworten.
Jetzt klappt es auch.

Rene :D