Inclusion of table rows and fields stop when creating a dynamic subform

Hi All,

Creating a scheduled agent to dynamically create subforms pertaining to specific locations that offices reside in. The form opened by the user will encompass a pertiaining subform created that will have items listed in a table along with fields for the user to provide a count of the items. I am building the subforms on a scheduled basis for use and have achieved this design other than the fact the table row creation halts when being appended to the created subform. For example if a location has 300 items in the items view, the agent acknowledges all 300 documents to get the item name from, shows the table row data as expected for the exporter, the DXL importer log completes with no error. However when i open the subforms, there will be a less amount of table rows found then the subforms were created.

I have appended a snippet of my code for review:

'See if we already an item list subform and get rid of it

	Set subForm=db.GetForm("itemlist-" + configStore)

	If Not (subForm Is Nothing) Then

		Call subForm.Remove()

	End If

	Set nc = db.CreateNoteCollection(False)

	nc.SelectSubForms = True

	nc.SelectionFormula = |$Title="itemtemplate"|

	Call nc.BuildCollection

	

	Set exporter = session.CreateDXLExporter()

	dxlcode=exporter.Export(nc)

	

	Dim bstart As Long, bend As Long, blen As Long

	bstart=Instr(dxlcode, "<body>")

	bend=Instr(dxlcode, "</body>")

	blen=Len(dxlcode)

	'Msgbox Cstr(dxlcode)

	'Exit Sub

	y=1

	newbody=Replace(Left(dxlcode, (bstart+5)), "itemtemplate", "itemlist-" + configStore)

	newbody=newbody + GetBodyTop()

	

	'loop thru the items view and add allowable items for latest 10key entry subform

	Set item_doc=item_view.GetFirstDocument

	While Not item_doc Is Nothing

findex=Cstr(y)

		If (y<10) Then

			findex="0" + findex

		End If

		'add for dxl import

		item_namn=Trim(Cstr(item_doc.itemName(0)))

		

		'replace &'s with '&amp;'

		amp_poz=Instr(1,Cstr(item_doc.itemName(0)),"&",5)

		If amp_poz <> 0 Then

			part1=Strleft(Cstr(item_doc.itemName(0)),"&")

			part2=Strright(Cstr(item_doc.itemName(0)), "&")

			item_namn=Trim(part1+"&amp;"+part2)

’ Msgbox item_namn

		End If

'%%% add table row to table

	newbody=newbody + GetTableRow(item_namn+" -#"+Cstr(item_doc.itemNumber(0)), findex)

		y=y+1

		Set item_doc=item_view.GetNextDocument(item_doc)

	Wend

tnxt:

	newbody=newbody + GetBodyBottom()

	newbody=newbody + Right(dxlcode, (blen-bend+1))

	fileNum% = Freefile()

	fileName$ = "data.xml"

’ Write out some employee data.

	Open fileName$ For Output As fileNum%

	Write #fileNum%, newbody

	Close fileNum%

	On Error Goto errh

	

	Set importer=session.CreateDXLImporter(newbody, db)

	importer.ExitOnFirstFatalError=True

	importer.ReplaceDBProperties = False

	importer.ReplicaRequiredForReplaceOrUpdate = False

	importer.ACLImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE

	importer.DesignImportOption = DXLIMPORTOPTION_CREATE

	Call importer.Process

'%%%% TO BUILD TOP OF EXPORT ENTRY

Function GetBodyTop() As String

Dim restxt As String



restxt=|<richtext>
<table minrowheight='0.3000in' widthtype='fixedcenter' rowspacing='0.0097in'

refwidth=‘4.1222in’>|

GetBodyTop=restxt

End Function

'%%%% TO ADD ROWS TO TABLE

Function GetTableRow(fieldTitle As String, fieldIndex As String) As String

Dim restxt As String

restxt={<tablerow>

<font size=‘8pt’ style=‘bold’ name=‘Arial’

pitch=‘variable’ truetype=‘true’ familyid=‘20’/>} + fieldTitle + {<font size=‘8pt’ style=‘bold’

name=‘Arial’ pitch=‘variable’ truetype=‘true’ familyid=‘20’/>:

<font size=‘8pt’ name=‘Arial’ pitch=‘variable’

truetype=‘true’ familyid=‘20’/><field usenotesstyle=‘false’ height=‘0.2500in’ width=‘1in’ multiline=‘true’ borderstyle=‘single’ type=‘number’ kind=‘editable’

name=‘invItem} + fieldIndex + {’><numberformat format=‘fixed’ digits=‘2’ punctuated=‘true’

parens=‘false’ percent=‘false’/>@If(@IsNumber( @ThisValue ); @ThisValue; 0)<font size=‘8pt’ name=‘Arial’

pitch=‘variable’ truetype=‘true’ familyid=‘20’/>

}

GetTableRow=restxt

End Function

'%%%% FUNCTION TO CLOSE THE EXPORT ENTRY

Function GetBodyBottom() As String

Dim restxt As String



restxt=|</table>

|

GetBodyBottom=restxt

End Function

Basically a location with 300 items will script a subform of only 50 table rows with no error msg found whereas the test dxl file created shows all entries.

Any direction to resolution or to troubleshoot this further would be greatly appreciated.

TIA,

Geoff-

Subject: RE: Inclusion of table rows and fields stop when creating a dynamic subform…

There’s a documented limit to the number of rows in a rich text table – 255. You would have to break it up into multiple tables.

However, I have some doubts about your whole design approach. That many differently named fields can get pretty unmanageable, as well as making your form really slow. Do you really need all these to be individual summary fields, or can you just pop them into a rich text field containing a table with your labels and a blank column for the numbers? Or might you use a technique for storing all the data in a single multivalued field per column, e.g. as described in Dynamic table on a Notes form?

Subject: RE: Inclusion of table rows and fields stop when creating a dynamic subform…

Hi Andre,

I am aware of the row limitiation and would expect an error at some point in that attempt though the script doesn’t even create the table that far. This is plan B in an attempt to create a form to have a user key in vlaues for a dynamic set of item fields. The multivalue text field approach will take the user a long time to enter and refresh the columns. I am trying to generate a 10key like form with predetermined set of items based on location so they fields can be tabbed.

Any approach or compromise to accomplishing this (for the notes client) would be appreciated,

Geoff-

Subject: RE: Inclusion of table rows and fields stop when creating a dynamic subform…

The approach I linked to does let you move to the next row with the tab key, as would a table in a rich text field.If you just had a multivalued field with newline separators that you let them edit, you could have them use Enter to get to the next line.

If you have DXL with >255 rows in a single table, I guess I’m not sure what the expected behavior should be. That’s illegal data, and yes, it would be nice if it rejected it with an error or something (did you check the DXL importer Log property, by the way!?) but I’m not too surprised if it just doesn’t work very well. If you have 255 rows exactly, does it work?

Subject: RE: Inclusion of table rows and fields stop when creating a dynamic subform…

I have added a counter to explicitly stop and close the table at row 45. One location subform has 40 rows, a second location subform only has 18 rows. Though there is no error from the importer.log or fatal error from the compile; I’m guessing at this point there is whitespace or an invalid character somehow in the exporter data (though if I save the file as xml i can open just fine via Explorer or XMLPad) when the importer is composing the subforms.

On another note, I will check out your example and see if I can meet expectations and satisfy the needs of my application with the entry format you have provided.

Thanks,

Geoff-

Subject: RE: Inclusion of table rows and fields stop when creating a dynamic subform…

You might try creating a department that has copies of only the configuration docs of the missing fields from one of these examples, and saving your DXL to a file. Then you can mess around with editing and importing it to see what the key difference is that prevents them being recognized.