Sue Taylor
asked on
A string is required here error
I can't figure out why I'm getting 'A string is required here' error in my formula and require assistance. I'm using CR 2008
The error is when I test my formula called "Outage" which is:
({@MainReportVariable}+ ({p21_view_inv_loc.order_q uantity})) /({p21_vie w_inv_loc. inv_min}*6 )
{p21_view_inv_loc.order_qu antity} is the item that is highlighted and is a number field. I need it to be a number field in order to perform some basic math in my report.
My subreport called "Available" has a formula called "SubReportVariable" which is:
Shared numbervar Tot;
tot:=Sum ({@Available})
--mail-staylor--Custom-Reports-Purch.rpt
The error is when I test my formula called "Outage" which is:
({@MainReportVariable}+ ({p21_view_inv_loc.order_q
{p21_view_inv_loc.order_qu
My subreport called "Available" has a formula called "SubReportVariable" which is:
Shared numbervar Tot;
tot:=Sum ({@Available})
--mail-staylor--Custom-Reports-Purch.rpt
ASKER
I'm not sure exactly where I was supposed to try that but I created new formula in the subreport and got errors when checking it. Please provide more details.
Replace your existing formula with the formula I gave. Do not create a new one.
ASKER
Replace which formula? The one called "Outage"? I did that and got ' The remaining text does not appear to be part of the formula' error
Replace
tot:=Sum ({@Available})
with below-
tot:=
SUM
(
if IsNull ({@Available}) or not NumericText ({@Available}) then
0
else
ToNumber ({@Available})
)
tot:=Sum ({@Available})
with below-
tot:=
SUM
(
if IsNull ({@Available}) or not NumericText ({@Available}) then
0
else
ToNumber ({@Available})
)
ASKER
I get an error 'A string is required here' and it highlights ({Available}) when I check the formula
ASKER
It highlights the second Available
Do you have NULL, ABC kind of characters in that column apart from Numbers?
Try this then
tot:=
SUM
(
if IsNull ({@Available}) or not NumericText ({@Available}) then
0
else
{@Available}
)
tot:=
SUM
(
if IsNull ({@Available}) or not NumericText ({@Available}) then
0
else
{@Available}
)
ASKER
It errors on the second ({Available}) that's in the [ or not NumbercText ]
So I took the parenthesis off of that one and then the error changed to the key word 'then' is missing, but it is clearly there.
So I took the parenthesis off of that one and then the error changed to the key word 'then' is missing, but it is clearly there.
ASKER
I forgot....all of the fields that I am summing in the formula are number fields. Not text Yes they could be null.
Please try ..
tot:=
SUM
(
if IsNull ({@Available}) THEN 0 else ({@Available})
)
tot:=
SUM
(
if IsNull ({@Available}) THEN 0 else ({@Available})
)
ASKER
A field is required here and the entire If line is highlighted.
Please check if this works?
tot:=
(
if IsNull ({@Available}) THEN 0 else ({@Available})
)
tot:=
(
if IsNull ({@Available}) THEN 0 else ({@Available})
)
ASKER
No errors this time! Yay! But when I check the "outage" formula I still get an error 'A string is required here' and it highlights the ({p21_view_loc.order_quant ity})
({@MainReportVariable}+ ({p21_view_inv_loc.order_q uantity})) /({p21_vie w_inv_loc. inv_min}*6 )
({@MainReportVariable}+ ({p21_view_inv_loc.order_q
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is my MainReportVariable...
Shared numbervar Tot;
""
Isn't that a number?
Shared numbervar Tot;
""
Isn't that a number?
No it returns the empty string. Delete the ""
mlmcc
mlmcc
ASKER
Thanks mlmcc!
I fixed the original error and no points? Sad :(
Pls try like..
Open in new window
Hope it helps!