Error ** More than 1024 items in a single statement. Use the -tok parameter. (136)

Mady

New Member
Hi All,

Can you please advise how to execute the attached query ? It is getting executed dynamically in the code and I was getting No data found in the end. When I execute this query in editor, I get this error ** More than 1024 items in a single statement. Use the -tok parameter. (136)
 

Attachments

  • Huge Query.txt
    12.9 KB · Views: 12

Cringer

ProgressTalk.com Moderator
Staff member
Wow that is never going to perform very well.
Why not make a temp table with the customer numbers and then make the query:
Code:
FOR  EACH ttCustomer, 
     each order no-lock 
    WHERE order.co_num = "1" 
      and order.warehouse = "primary" 
      and order.customer = ttCustomer.customer :
 

Mady

New Member
To me a bit more clear - It happens like below.

1. Query gets prepared through below logic
IF NUM-ENTRIES(searchstring) > 0 THEN
DO i = 1 TO NUM-ENTRIES(searchstring):

cOrd = ENTRY(i,searchstring).

IF i = 1 THEN DO:
IF NUM-ENTRIES(searchstring) > 1 THEN
querystring = querystring
+ ' and ( order.customer = '
+ CHR(34) + cOrd + CHR(34) .

else
querystring = querystring
+ ' AND order.customer = '
+ CHR(34) + cOrd + CHR(34).
END.
ELSE
querystring = querystring
+ ' Or order.customer = '
+ CHR(34) + cOrd + CHR(34) .

2. Then passing this query variable to get executed on appserver, like below

RUN cs_ord.p ON SERVER kServer TRANSACTION DISTINCT
(INPUT querystring,
INPUT RecordLimit,
OUTPUT TABLE temp_order,
OUTPUT viNum,
OUTPUT lRecords) NO-ERROR .

May I know where to modify the -tok parameter ?
 

Stefan

Well-Known Member
-tok is a client startup parameter, so it needs to be on the command line directly or indirectly (-pf) of whatever is starting your ABL session.
 
Top