I'm working with a script designed to compare values returned from a form against values from a database dumped to an array, via GetRows.
Currently, the code uses an inner and outer loop to run this comparison, with a temporary variable being assigned the current col/row from the
aforementioned array. An lcase and trim operation are performed on the value to obtain the temporary variable.
This is causing a considerable performance drain, and I was wondering if the lcase/trim functionality could perhaps be performed during the creation
of that array, rather than in a looping situation?
Here's my code:
**note: this utilizes the FastString Class for concatenation, thus the "FastString" and ".Append"
dim iRowLoop, iColLoop, zRowLoop, strChange, tempDbValsCase
Set strChange = New FastString
for iRowLoop = 0 to ubound(arrDbVals, 2)
for zRowLoop = 0 to ubound(arrFormComplete)
'****below line is what is causing the bottleneck, according
'****to a timer test
tempDbValsCase = lcase(trim(arrDbVals(1, iRowLoop)))
if (mid(trim(arrFormComplete(zRowLoop)),1,8) = trim(arrDbVals(0, iRowLoop))) AND (mid(trim(arrFormComplete(zRowLoop)),9) <> tempDbValsCase)
strFormAllVals = arrFormComplete(zRowLoop)
strChange.Append strFormAllVals & ","
On the database side, the table from which the array is derived through GetRows contains the bit datatype column "Complete". The lcase and trim
operations are performed upon this column of the array. Does the bit datatype add any hidden characters in the output? Visually, I don't detect
any, but when I compare a value of "True" from the form input against a value from the array that looks like "True," it doesn't match, until I run
the lcase and trim on the "Complete" column.
Thanks for any help!
Kind Regards :)