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 Mike Lewis 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.

goldfishhh

IS-IT--Management
Jul 23, 2008
23
0
0
US
I've been staring at this too long. Why am I getting this error with this formula: "Too many arguments have been given to this function."


iif(
Length ({ProdJobABEND.TIME})>10,
time(5,5,5),
(Time(
(Mid ({ProdJobABEND.TIME},9,2)),
(Mid ({ProdJobABEND.TIME},12,2)),
(Mid ({ProdJobABEND.TIME},15,2))
)
)

)


My initial test works great:

iif(
Length ({ProdJobABEND.TIME})>10,
time(5,5,5),
time(10,10,10)
)
 
Hi,
I suspect it is confused by the formula as the false choice - it only expects 2 choices and may see this as more..

Try creating a variable for this construction :
Code:
Mid ({ProdJobABEND.TIME},9,2)),
         (Mid ({ProdJobABEND.TIME},12,2)),
         (Mid ({ProdJobABEND.TIME},15,2))
and use the variable like:

Code:
iif(
     Length ({ProdJobABEND.TIME})>10,
      time(5,5,5),
        time(@Timevar)                   
    )



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
DING DING DING! Thanks for the push in the right direction. After a bit of fiddling and data validation, here is what I came up with:

Code:
//Small Timestamp

Local Stringvar SmallFirstTime := totext(Mid ({ProdJobABEND.TIME},1,1));
Local Stringvar SmallSecondTime := totext(Mid ({ProdJobABEND.TIME},3,2));
Local Stringvar SmallLastTime := totext(Mid ({ProdJobABEND.TIME},6,2));

Local Stringvar SmallTime := "0" + SmallFirstTime + ":" + SmallSecondTime + ":" + SmallLastTime;

//Medium Timestamp

Local Stringvar MediumFirstTime := totext(Mid ({ProdJobABEND.TIME},1,2));
Local Stringvar MediumSecondTime := totext(Mid ({ProdJobABEND.TIME},4,2));
Local Stringvar MediumLastTime := totext(Mid ({ProdJobABEND.TIME},7,2));

Local Stringvar MediumTime := MediumFirstTime + ":" + MediumSecondTime + ":" + MediumLastTime;

//Large timestamp

Local Stringvar LargeFirstTime := Mid ({ProdJobABEND.TIME},9,2);
Local Stringvar LargeSecondTime := Mid ({ProdJobABEND.TIME},12,2);
Local Stringvar LargeLastTime := Mid ({ProdJobABEND.TIME},15,2);

Local Stringvar LargeTime := LargeFirstTime + ":" + LargeSecondTime + ":" + LargeLastTime;


If
  Length ({ProdJobABEND.TIME}) = 7
Then
  SmallTime
  Else if
    Length ({ProdJobABEND.TIME}) = 8
  Then MediumTime
    Else If 
      Length ({ProdJobABEND.TIME}) > 10
    Then LargeTime
 
Hi,
Glad to help..The version you came up with will provide you with added flexibility as well.




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top