project QadFinancials > class BMultiCyProcessor > method ConvertLongCharToTempTable

Description

This method converts long char into simple temp table. This is because of long char maximum size and size of the char.


Parameters


ipLongTextinputlongchar
tAsyncInstanceDataSerializedoutputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BMultiCyProcessor.ProcessRequestAsyncInit


program code (program1/bmulticyprocessor.p)

/* =============================================================================================== */
/* This method stores text in the longchar input parameter into the temp-table, that has just      */
/* character variables                                                                             */
/* =============================================================================================== */

empty temp-table tAsyncInstanceDataSerialized.

assign viSegmentSize = 1024
       viIndex       = 0
       viTextSize    = length(ipLongText, "CHARACTER").
       
do while true:
    assign viStartIndex = viIndex * viSegmentSize + 1.
           
    /* if the size of the string is less then starting index, nothing more to do */
    if (viTextSize < viStartIndex) then leave.
    
    /* Put the segment of the XML into temp-table */
    create tAsyncInstanceDataSerialized.
    assign viIndex                                   = viIndex + 1
           tAsyncInstanceDataSerialized.ti_Sequence  = viIndex
           tAsyncInstanceDataSerialized.tcXMLSegment = substring(ipLongText, viStartIndex, min(viSegmentSize, viTextSize - viStartIndex + 1), "CHARACTER").
end. /* do while true: */