Exclude weekdays formula error number expected

The computer field in the form is type date/time.My formula is:

increment := weeks;

newdate :=@Weekday(@Adjust(@Created;0;0;increment;0;0;0));

@If(bydate!=“”;bydate;

newdate=7;@Adjust(@Created; 0; 0;2; 0; 0; 0);“S0”;

newdate=1;@Adjust(@Created; 0; 0;1; 0; 0; 0);“S0”;

@TextToTime(newdate))

I get the error “Incorrect data type for @function, number expected”

Subject: Exclude weekdays formula error number expected

also tried this and I got the some error

increment := 4;

newdate :=@Weekday(@Adjust(@Created;0;0;increment;0;0;0));

@If(bydate!=“”;bydate;

newdate=7;@TextToNumber(@Adjust(@Created; 0; 0;2; 0; 0; 0));

newdate=1;@TextToNumber(@Adjust(@Created; 0; 0;1; 0; 0; 0));

@TextToNumber(newdate))

Subject: RE: Exclude weekdays formula error number expected

@Created (even if adjusted with @Adjust) will always be a date value. Therefor, you cannot use @TextToNumber on its return value. Instead, try:

increment := 4;

newdate :=@Weekday(@Adjust(@Created;0;0;increment;0;0;0));

@If(bydate!=“”;bydate;

newdate=7;@Text(@Adjust(@Created; 0; 0;2; 0; 0; 0));

newdate=1;@Text(@Adjust(@Created; 0; 0;1; 0; 0; 0));

@Text(newdate))

Even still, I’m not sure what the intention of the @If return value is supposed to be because it will either return a non null text value in bydate OR it will return the text representation of a date/time value OR in the default case, it will return the text representation of a weekday for values of weekday between 2 and 6.

Not sure if this is what you want but…

Subject: Exclude weekdays formula error number expected

where is “weeks” defined? Is it a number field?

Subject: RE: Exclude weekdays formula error number expected

Yes, weeks is also a number in the form, it’s the increment, like 4.

Subject: Exclude weekdays formula error number expected

this is the solution:

increment := 4;

newdate :=@Adjust(@Created;0;0;increment;0;0;0);

@If(bydate!=“”;bydate;

@Weekday(newdate)=7;@Text(@Adjust(newdate; 0; 0;2; 0; 0; 0);“S0”);

@Weekday(newdate)=1;@Text(@Adjust(newdate; 0; 0;1; 0; 0; 0);“S0”);

@Text(newdate;“S0”))