I have a doc where if I do Database → properties → fields
there are 2 identical field names
e.g.
FIELD111
field111
I thought field names are not case sensitive have to be unique in the same form.
I have a doc where if I do Database → properties → fields
there are 2 identical field names
e.g.
FIELD111
field111
I thought field names are not case sensitive have to be unique in the same form.
Subject: Are field names case sensitive?
Actually there are two things “Field and Item” which often use interchangeably but are distinct:
a. Field: This term is used in design time and a single Form cotains a unique field name. Fields are only containers and used at UI Level to display the value stored in Item. Where as Item holds the actual value of that field.
So when you see document properties, you are not actually seeing the field, instead you are looking the Items.
In notes document, there con be multiple Items with same name…but when you open that document, Signle field will display all the values in All Items with same name.
Now to your question, FIELD111 and field111 are two items, normally Items with capital letter are those created through Lotusscript (programmatically)
HTH
Subject: RE: Are field names case sensitive?
OK,
One question.
If I have code like:
doc.field111 = “A”
does this mean FIELD111 = “A” or field111=“A”?
If I have identical names for item and field,
will the item and field conflict (i.e. bad practice)?
I am trying to track down where the in the code this CAPs field is being created.
Subject: RE: Are field names case sensitive?
Hi,
the items (in document properties) do have the same name but a different DUPLICATE ID!! the first one is 0 the second has 1. The reason this occurs can be:
(rich text) field has too much data. So several items are created.
in some LotusScript code document.appendItemValue is used. This method APPENDS an ITEM to the document instead of appending a value to an item…
My guess for your problem is the second case. So search your code for this method and change it to: replaceItemValue. This will remove all items with the same name and creates a new one with teh desired value.
Have Fun!!
Subject: RE: Are field names case sensitive?
OK If I want to get rid of one of the item how can I do it?
Will
doc.RemoveItem (“field111”)
remove 2 fields or 1?
or
is RemoveItem case sensitive?
Thanks
JJ
Subject: RE: Are field names case sensitive?
Use the getFirstItem() method to make a copy of the ‘real’ item eg realField111 and then remove the item using the removeItem() method.
Then continue to use getFirstItem to get what used to be the second item, remove it. Repeat as needed.
Then copy realField111 back as field111.
THis Losutscript function should do the job:
Sub removeExtraItems( itemName As String, doc As NotesDocument )
' get the first of the items and make a copy
Dim item As NotesItem
Set item = doc.getFirstItem( itemName )
Dim realItem As NotesItem
Set realItem = doc.copyItem( item, "real" + itemName )
' remove all items with the same name
Do Until ( item Is Nothing )
Call item.Remove()
Set item = doc.getFirstItem( itemName )
Loop
' copy the real item back with its original name
Call doc.copyItem( realItem, itemName )
' delete the copy of the first item
Call realItem.remove()
End Sub
Use it like this:
call removeExtraItems( “field111”, doc )
Mr Frunobulax
Subject: RE: Are field names case sensitive?
ok,
will try that. Thanks for the help!