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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The string is non-numeric

Status
Not open for further replies.

cpjeffm

IS-IT--Management
Mar 9, 2015
73
US
Got another one that I need some help with. I'm getting "the string is non-numeric" on the following formula.

local stringvar currGN := GroupName({SalesTotalAdjustment.RecDate}, "quarterly");
local stringvar currGM := if length(trim(currGN)) > 0 then left(currGN, instr(currGN,"/")-1);
local datevar currGD := date(toNumber(right(currGN,4)),toNumber(currGM),01);
shared datevar prevGD := currGD;

The highlighted portion of the formula when it errors is...

toNumber(right(currGN,4))

This report shows credits as a percentage of gross sales. It charts the credit % by quarter for that last completed quarter and previous 8 quarters.

I know there's no data in any of the quarters so I'm trying to build some checks in that will just return a blank report instead of erroring when there's no data to return.

Any help would be greatly appreciated. I'm no Crystal expert...I'm trying to modify a report build by someone else.
Thanks!
 
Not sure why you are getting an error. I think you need to see what each variable declaration is returning (FYI: I took the same formulas used a field I have access to and it worked, data source SQL Server 2005, and it worked fine for me).
 
You might have a two digit year instead of a 4 digit year, so 05 versus 2005.
This can be the case even if the Group Name is formatted to show a 4 digit year.
If that is the problem this can be fixed by creating a Group Name formula.
Right Click the Group and choose Options Tab.
Choose Customize Group Name.
Use a Formula as a Group Name.
ToText({SalesTotalAdjustment.RecDate},"M/yyyy")

Alternatively ....
And assuming I understand the correct intention of the formula which is to extract a date from the quarter.
So if the quarter is 1/2005 you want the date 1/1/2005 and if its 4/2005 you want it to be 1/4/2005.
If so try:
Local dateVar currGD := Date(Year({SalesTotalAdjustment.RecDate}), DatePart("q",{SalesTotalAdjustment.RecDate}) * 3 - 2, 1);
shared datevar prevGD := currGD;



Gordon BOCP
Crystalize
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top