User Tools

  • Vistasource Document Library

Handling Large Strings

When using the “GA” or “GAI” commands, the COM Interface returns the record info in one string. If you are handling a large number of records the string can be large. However, due to a limitation in Excel, cell strings are limited to a maximum of 32767 characters. See:
Excel 2003 - HP005199291 , Excel 2007 - HP010073849 , Excel 2010 - HP010342495

In order to get around this limitation, if a string is longer than 32767 characters, it will be split into parts. In this case, the command will return the string (parts)N , whereby N is the number of parts.

Your code has to iterate through the number of parts to obtain each partial string, and finally free the parts from memory with “GA F” or GAIF“.

Part names are labeled “GA N” for the “GA” command, and “GAIN” for the “GAI” command, where N is the part number. Note: GA requires a space before the part number.

Here is a pseudo code example for GA (dependant on the language you are using):

   info(1) = "localhost"
   for X = 0 to N - 1
      ' call the COM server with the command "GA " + X
      info(0) = "GA " + X 
      VSRTConnectData(TopicID, info(), "true", result)
      retstring = retstring & result
   next X
   ' call the COM server with  "GA F" to free the parts from memory 
   info(0) = "GA F"
   VSRTConnectData(TopicID, info(), "true", result)
If the parts are not freed from memory with the final command “GA F” or “GAIF”, they will be not be freed until the next time a parts list has to be made. It is is best practice to use the final command to avoid memory leaks.

See Creating a VB Application for more information.