I wanted to use InputField to change multiple rows at once, and used the macro below. In development, the macro worked well, having no problem with several thousand rows. However, when I published to a website and tried the macro through AJAX, it worked, BUT it was only able to handle a small number of rows at a time - with a larger number, it stopped responding, and task manager showed the server CPU was continuously cycling from 0%-40% usage. I left for 10 minutes with no change.
Does anyone know if I can improve performance in AJAX? The macro below is in VBscript. The file is ~60MB with 1.7M rows.
' Set the macro variables to current variable values
set vInputIds = ActiveDocument.Variables("vSelectedInputIds")
set vValueOption = ActiveDocument.Variables("vSelectedValueOption")
' add one divider in the end to avoid handling the special case of not finding it
vRemainingInputIds = vInputIds.getcontent.string & "|"
' loop through all the ReferenceProductInputIds and set them to the selected Product
Do While len(vRemainingInputIds) > 0
' find the next divider |
vDividerLocation = instr(1, vRemainingInputIds, "|") - 1
' get the ReferenceProductInputId using the position of the divider
vCurrentInputId = left(vRemainingInputIds, vDividerLocation)
' Update the ReferenceProductInput on the current id | [FieldName].SetInputFieldValue Row, Value
ActiveDocument.Fields("InputValue").SetInputFieldValue vCurrentInputId, vValueOption.getcontent.string
' remove the used id from the list
vRemainingInputIds = right(vRemainingInputIds, len(vRemainingInputIds) - 1 - vDividerLocation)