I don't wanna hard-code me field names like

Isn’t it?Why do I have to hard code my field names.

I want to set the fields to blank ‘dynamically’, by taking the name of a RichText item, and then setting that to blank…

For now, I am just trying to do this, if the user has not attached anything. (hopefully, my user will agree to use Rich Text Lite fields instead, which avoids this problem coz you can make them so people can only enter attachments!)

But anyway…selected code:

Dim x As Integer

x = 0

Do While x <=3

'Item gets set correctly, I’ve seen it in debugger

If x=0 Then Set item = doc.GetFirstItem(“RGDocumentation1”)

If x=0 Then SOXtField = “RGDocumentation1”

'other lines of code here, then

'this code doesn’t work. Item name is set correctly to the field

'name but the field is not blanked out

If Isempty (item.EmbeddedObjects) Then

itemName = item.Name

Call uidoc.FieldSetText(itemName,“”)

doc.itemName=“”

Call uidoc.Refresh(True)

'If you do it like this instead, with hard coded field name then it works:

Call uidoc.FieldSetText(“RGDocumentation1”,“”)

doc.RGDocumentation1=“”

Call uidoc.Refresh(True)

Subject: I don’t wanna hard-code me field names like

Hi

this will obviously not work:

doc.itemName=“”

try this :

call doc.replaceItemValue(itemName,“”)

HTH

Subject: RE: I don’t wanna hard-code me field names like

Hi Yannick,It’s not obvouis to me! Why wouldn’t it work?

It’s basically the same code, just using extended class syntax?

Thanks for your answer though, and it does work your way.

Subject: RE: I don’t wanna hard-code me field names like

The difference:

doc.itemName=“”

This will create an item with the name “itemName”.

call doc.replaceItemValue(itemName,“”)

This will create an item with the name stored in the variable itemName.

So you cannot use doc.itemName to create variable fieldnames.

Regards,

René

Subject: RE: I don’t wanna hard-code me field names like

Hi back

The documentation says that a NotesDocument object contains field, which names are the field names.

i.e. if you have a field named dummy, it will be accessible with doc.dummy …

ian