Search code examples
lotuslotusscript

Lotus view column compare to string/integer


I have a lotus view that stores a number. I need to perform some math against the value, but I am having a lot of problems getting the types to match up.

doc.numOfGold = numGold 

and CInt(doc.numOfGold) = numGold

and CInt(doc.numOfGold) = CInt(numGold)

and doc.numOfGold = CInt(numGold)

all return type mismatch. I've tried changing the column properties to treat it as a decimal, with no better luck.

Any thoughts?

Thanks!


Solution

  • Never access a field like this: "doc.fieldname". User doc.GetItemValue("fieldname")(0), this returns the correct type.

    If doc.numOfGold is a numberfield, and numGold is an int, it should work like this:

    Dim numOfGold as integer
    numOfGold = doc.GetItemValue("numOfGold")(0)
    

    if doc.numOfGold is a textfield, you have to do a conversion, e.g. val(doc.GetItemValue("numOfGold")(0))

    Also verify that your field value is not an empty string, e.g. use a field validation formula.