developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks




FindFirstElement fails
Liza Davila 01/17/2006 11:50 AM
Applications Development 6.0.2 CF2 Windows XP


Hi,

I have a form with a rich text field where I want to attach a table. Since the table has to have specific features, what I do is that I have a table with one row and all the settings I want in a profile document and from the form I use AppendRTItem to copy the table to my rich text field. I'm able to copy the table to the field but I also want to put a time stamp to the first column of the only row in the table but my code never finds the table when I try to use FindFirstElement. This is a piece of the code I wrote:

'tablefield is the table from my profile document
Call rtitem.AppendRTItem( tableField )
Call rtitem.Update
Set rtnav = rtitem.CreateNavigator
'After I append the table, I look for it in the field and I don't see it, so the If statement is not executed.
If rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then
Set rtt = rtnav.GetElement
flag = rtnav.FindNthElement(RTELEM_TYPE_TABLECELL,1)
'Now I'm positioned on the first column of the last row
Call currentTime.SetNow
timeOnly = currentTime.TimeOnly
militaryTime = Cstr(Format$(timeOnly,"h:mm:ss"))
Call rtitem.BeginInsert(rtnav)
richStyle.Bold = True
Call rtitem.AppendStyle(richStyle)
Call rtitem.AppendText(militaryTime)
richStyle.NotesColor = COLOR_Black
richStyle.Bold = False
Call rtitem.AppendStyle(richStyle)
Call rtitem.EndInsert
flag = rtnav.FindNthElement(RTELEM_TYPE_TABLECELL,2)
End If

The line where I'm having the problem is:

If rtnav.FindFirstElement(RTELEM_TYPE_TABLE)

because after I append the table, I try to look for it with the IF statement and the if fails.

I appreciate any help!

Go back