Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too Many Arguments

Status
Not open for further replies.

fxsage

Programmer
Sep 9, 2002
21
US
The following block of code produces the error "Too many arguments". I know this is due to the number of variables I have in the 'inlist(discode1)' routine.
Is there a way I can get around this?

Thanks


SELECT PASS6
SCAN
STORE exp_1 TO m.keyfld
SELECT applcnt
IF SEEK(m.keyfld)AND INLIST(discode1,'85400','95901','343','3152',;
'318','V62.89','317','7421','3170',;
'3180','854','742.4','34500','7834',;
'759.81','3182','759.89','780.39',;
'3181','3453','8530','7581','740.0',;
'742.3','742.4','758.2','759.81')
store keyfld TO m.keyfld
STORE discode1 TO m.discode1
INSERT INTO dev_delay (keyfld,discode1)VALUES (m.keyfld,m.discode1)
ENDIF
ENDSCAN
 
fxsage

According to the help file the maximum expressions is 24 and you have 27. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
You can get round this by using the '$' operator

Code:
private m.IncludeOnly
m.IncludeOnly = "85400,95901,343,3152,318,"
m.IncludeOnly = m.IncludeOnly+"V62.89,317,7421,3170,3180,"
m.IncludeOnly = m.IncludeOnly+"854,742.4,34500,7834,759.81,"
m.IncludeOnly = m.IncludeOnly+"3182,759.89,780.39,3181,"
m.IncludeOnly = m.IncludeOnly+"3453,8530,7581,740.0,"
m.IncludeOnly = m.IncludeOnly+"742.3,742.4,758.2,759.81"
 
SELECT PASS6
SCAN
    STORE exp_1 TO m.keyfld
    SELECT applcnt
    IF SEEK(m.keyfld)AND Trim(Discode1)+","$m.IncludeOnly
        store keyfld TO m.keyfld
        STORE discode1 TO m.discode1
        INSERT INTO dev_delay (keyfld,discode1)VALUES (m.keyfld,m.discode1)
    ENDIF
ENDSCAN

I have assumed that Discode1 is a string, and that by triming it and adding the ',' the values in the list become unique - or at least reliably different!

You might want to exclude blank discode1 entries, as they will allways be in the list!

Good luck
Regards

Griff
Keep [Smile]ing
 
Could you create a CURSOR containing your INLIST() values, ie:

CREATE CURSOR curInList ( VALUE C(15) )
INSERT INTO curInList VALUES ( '85400' )
INSERT INTO curInList VALUES ( '95901' )
etc...

and then change you INLIST() statement to be:

IF SEEK(m.KeyFld) AND discode1 IN(SELECT Value FROM curInList)

Would that work?

Neil "I like work. It fascinates me. I can sit and look at it for hours..."
 
Oh, you probably want periods either side of the AND

Code:
IF SEEK(m.keyfld) .AND. Trim(Discode1)+","$m.IncludeOnly

And you might want to be specific about source of Discode1,
if it is an element of PASS6 - if it comes from applcnt you're ok.



Regards

Griff
Keep [Smile]ing
 
Thanks to mgagnon and griffmg and fatslug
for your insight.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top