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

Error in formula:A number is required here

Status
Not open for further replies.

lana123

Programmer
Aug 20, 2003
79
US
Hi,people.
I'm getting error in formula in Crystal 9.2 and cannot take it out without changing the common sense of the formula:

if {CLAIM.STATUS}='Open'then
if {?Range}='Indemnity' then
{AMOUNT.IND_RES}
else if {?Range}='Expense' then
{AMOUNT.EXP_RES}
else if {?Range}='Total' then
{AMOUNT.IND_RES} + {AMOUNT.EXP_RES}
else
true
else if {CLAIM.STATUS}='Closed'then
if {?Range}='Indemnity' then
{AMOUNT.IND_PAID}
else if {?Range}='Expense' then
{AMOUNT.EXP_PAID}
else if {?Range}='Total' then
{AMOUNT.IND_PAID} + {AMOUNT.EXP_PAID}
else if {?Range} = 'Current Range Type' then
true
(If CLAIM.STATUS not in ('Indemnity','Expense',Total'),
it doesn't have to work)
The error is:"A number is required here"

I'll appreciate any answer.
Thanks in advance.

Lana
 
Since you gave no indication of the intent, I simply took a wild stab at restructuring this formula.

Please post technical information when posting, in this case:

Example data
Expected output
Where this formula is, and what it's used for

I know it's a pain to explain to tech people what your environment is, but it really is helpful, much more so than "I'm getting error". BTW, I see no evidence of common sense in the formula.

if {CLAIM.STATUS}='Open'then
(
if {?Range}='Indemnity' then
{AMOUNT.IND_RES}
else
if {?Range}='Expense' then
{AMOUNT.EXP_RES}
else
if {?Range}='Total' then
{AMOUNT.IND_RES} + {AMOUNT.EXP_RES}
else
0
)
else if {CLAIM.STATUS}='Closed'then
(
if {?Range}='Indemnity' then
{AMOUNT.IND_PAID}
else
if {?Range}='Expense' then
{AMOUNT.EXP_PAID}
else
if {?Range}='Total' then
{AMOUNT.IND_PAID} + {AMOUNT.EXP_PAID}
else
if {?Range} = 'Current Range Type'
or
CLAIM.STATUS not in ['Indemnity','Expense','Total']
then
0
)
else
0

-k
 
Hi and thank you for answer.
I'll try to explain everything as better as I can.
Example data:
don't have it because the formula doesn't work
Expected output:
I have to get records from table CLAIMS
according to the parameters ({?Range}and {?RangeValue}):
First,
the user chooses the value of parameter {?Range}:‘Current Claim Status’(default),’Indemnity’, ’Expense’, ’Total’
Second,
the user inserts the currency value into parameter {?RangeValue}.
According to the formula which I put to SelectExpert I'm getting the results for “Where” close:

( if ({?Range}='Current Range Type' and {?RangeValue }='')and {CLAIM_STATUS}in (‘Open’;’Closed’))
then
true
else if
({?Range} <> 'Current Range Type' and {?RangeValue }<>'' )then
({@INCURRED_RANGE_AMT }={ ? RangeValue }))

So why I need this formula({@INCURRED_RANGE_AMT }), which I sent.
When user doesn’t touch the parameter {?Range}, it has the default value ”Current Range Type” and we don’t use {?RangeValue},no values in “Where …”

Thank you for help.
Lana
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top