Link to home
Start Free TrialLog in
Avatar of Jason Russell
Jason RussellFlag for United States of America

asked on

too many arguments have been given to this function

I'm trying to create a 2d DataMatrix barcode. With trying to do this and follow customer specs for said barcode, I'm running into issues with my code. I need fields such as {V_LMINVTRY_MANUFACTURED.PART_NO} to have 15 chars in it and same with {V_LMINVTRY_MANUFACTURED.FG_LOTNO}. These are giving me issues. Part number and FG_LOTNO are both strings. Any help with this will be greatly appreciated. The bolded text is the part I need helped with. The rest works fine.

StringVar CompleteBarcodeString:="";
StringVar DataToEncode:= ('#P'+totext({V_LMINVTRY_MANUFACTURED.PART_NO},0000000000000000')+' '+'&VNONE  '+' '+('#Q'+totext({V_LMINVTRY_MANUFACTURED.QUANTITY},'00000'))+('&L'+totext({V_LMINVTRY_MANUFACTURED.FG_LOTNO},'000000000000000'));
NumberVar i:=0;
NumberVar Segments:=
DataMatrixEncodeSet(DataToEncode, -1);
For i:=0 to Segments Do
(
CompleteBarcodeString := CompleteBarcodeString +
DataMatrixEncodeGet(i);
);
CompleteBarcodeString
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

It sounds like you're passing more parameters to a function than the function is prepared to accept.  If I had to take a wild guess, I'd guess one of the parameters has a delimiter in it that the function reads as delimiting a particular parameter.  Consequently, the function thinks you're sending more parameters than you intend.

I would look at the values for the various variables you're including in DataToEncode and make sure there isn't a comma or semicolon in there that shouldn't be.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James0628
James0628

It may not be the only problem, but you're missing the opening quote on the format string in the first Totext function.  You have

totext({V_LMINVTRY_MANUFACTURED.PART_NO},0000000000000000')

 instead of

totext({V_LMINVTRY_MANUFACTURED.PART_NO},'0000000000000000')


 FWIW, I'll disagree with mlmcc on the use of + vs &.  I prefer +, because that forces all of the concatenated members to be strings.  I normally do any required conversions to strings myself (so that I can control the formatting), and using + makes sure that I don't miss anything.

 James