Replace/concat May Not Result In Data > 32000 Bytes. (11678)

PrJlndni

Member
Good day Masters,

I would like to ask for your expert advice.
I have this code that use to retrieve all the names and its corresponding code ID in the database.
The list record as counted is around 1,266. I wanted to view it using a combo box. Upon running, this error occurs (REPLACE/CONCAT may not result in data > 32000 bytes. (11678)).

Code:
DEFINE VARIABLE t-to-user  AS CHARACTER FORMAT "x(24)" label "User  " view-as combo-box.
define variable userstr as char init "".
FOR EACH TSGInv.employee where TSGInv.employee.user-code NE "000"  by TSGInv.employee.emp-name.
         ASSIGN userstr = userstr + ',' + string(trim(TSGInv.employee.emp-name),"x(20)") + "|" + TSGInv.employee.user-code.
END.
ASSIGN t-to-user:LIST-ITEMS IN FRAME fr-user = userstr.

Please help. Thank you so much in advance Masters. :)


Regards,
PrJlndni
 
How many records is that generating on TSGInv.employee? Basically the userstr variable is being given more than 32KB of data which is the maximum for a character variable.
 
Hello Master Cringer,
Good day!

According to the specifics of the code, the program will return a 1,266 total number of records.
Have you encountered something like this before Sir? How did you resolve it? :)
 
Yes I've encountered this many times before. The first question you need to ask yourself is what use would a combo box be with 1266 records in it? That's going to be a nightmare to work with. If you really need something like this then you're going to have to come up with a different way of selecting the record you want. A simple way would be a fill in with a button that runs a partial lookup with a browse in it.
 
As Cringer points out, that is a lot of records for a combo box and a browse would be better. If you have to use a combo box then add each list item individually:
Code:
FOR EACH TSGInv.employee where TSGInv.employee.user-code NE "000" NO-LOCK by TSGInv.employee.emp-name:
   ASSIGN userstr = /* userstr + ',' + */ string(trim(TSGInv.employee.emp-name),"x(20)") + "|" + TSGInv.employee.user-code.
   t-to-user:ADD-LAST(userstr) IN FRAME fr-user.
END.
 
Good morning Masters.

Master Cringer: Indeed, there are a lot of ways to show those records but then combo-box is the nicest way to show to the clients the items based on the design. :)

Master Osborne: Thank you so much Master. :)

Thank you Masters :)

Regards,
PrJlndni
 
I also already have this issue.

Maybe you have also other variables defined as not NO-UNDO (example : DEFINE VARIABLE c AS CHARACTER.).

If you have a lot variables defined without the NO-UNDO option and you store in each also a lot of data, then you may exceed the limit of 32000.

Without NO-UNDO, the limit of 32000 applies to all the variable of the program together (meaning : LENGTH(var1) + LENGTH(var2) + LENGTH(var3) +... must be < 32000), so it can be overflowed very fast.
If you use NO-UNDO, you will have a limit of 32000 per/ for each single variable of the programseparately, so the limit may be overflowed slower/later.

This article give the complete explanation :
Progress KB - Error "Attempt to update data exceeding 32000 . (12371)" raised when assigning a value to a variable

I agreed, it is not good to store this amount of data into a single CHARACTER variable.

Depending on what you can do, it is better to use CHARACTER NO-UNDO or a LONGCHAR NO-UNDO (unless you use these variables in a TRANSACTION block) , or better, a TEMP-TABLE to fill your combo-box / browse widget.

Hopes it can help.
 
Back
Top