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!

If Then Statment Not Working

Status
Not open for further replies.

talibm

MIS
Jan 23, 2007
85
US
Hi All,
I have created a report using crystal 11. This report calculates (sums) units billed and not billed. Billed units have a claim # and a 500 billing code. The not billed unit do not have a claim number and do not have a 500 billing code. I used the formulas below. The first formula works, but not the second part.
Billed units:
If Not (IsNull({billing_tx_charge_detail.CLAIM_NUMBER}) then {billing_tx_history.units_of_service})

Not Billed Units
If IsNull({billing_tx_charge_detail.CLAIM_NUMBER}) then {billing_tx_history.units_of_service}
else
IF {billing_pay_adj_history.payment_type_code} <> "500" then {billing_tx_history.units_of_service}

The report is still calculating the 500 code in billed units and I can't seem to figure this out. thanks

talib
 

I think it's a good idea to always address every possibility in an if statement - in the second formula, what happens if the claim number is not null and the payment type code = 500?

Try adding a catchall at the end:

If IsNull({billing_tx_charge_detail.CLAIM_NUMBER}) then {billing_tx_history.units_of_service}
else
IF {billing_pay_adj_history.payment_type_code} <> "500" then {billing_tx_history.units_of_service}
else 0
 
Hi brian,
Thanks for the response, but it didn't help me with the formula. it is still producing units for services not billed and for services with the 500. The if statements still
don't work together, but I am not sure why. the second if statement isn't working with the first one. The work seperately, but not together. help! :)
 
Your 1st post is a bit confusing to me.

You state that "... Billed units have a claim # and a 500 billing code..." yet your first If-Then-Else statement does not test the Billing Code. I suggest you amend the code to the two formulas as follows:

[Code BILLED]
If Not(Isnull({billing_tx_charge_detail.CLAIM_NUMBER})) and
{billing_pay_adj_history.payment_type_code} = 500
Then {billing_tx_history.units_of_service}
Else 0
[/Code]


[Code NOT_BILLED]
If Isnull({billing_tx_charge_detail.CLAIM_NUMBER}) and
{billing_pay_adj_history.payment_type_code} <> 500
Then {billing_tx_history.units_of_service}
Else 0
[/Code]

If these do not work, the logic explained in the first post is flawed. For example, the following data combinations are not tested for:

[pre]
Claim Number not null and Billing Code <> 500
Claim Number is null and Billing Code = 500
[/pre]
Can these combinations exist? How would you want them dealt with if they did arise?

Also, what are the data types for {billing_tx_charge_detail.CLAIM_NUMBER} and {billing_pay_adj_history.payment_type_code}? If they are strings, could it be they are empty strings rather than NULLS?

It seems to me likely that the data is not quite as you expect, and that there are combinations you simply aren't testing for.

Hope this helps.

Cheers
Pete
 
Hi Pete,
Thanks for your response. In my first post I forgot to include the 500 code in the formula. It is below. It is working fine.
If Not IsNull({billing_tx_charge_detail.CLAIM_NUMBER}) then {billing_tx_history.units_of_service}
else
if {billing_pay_adj_history.payment_type_code} = "500" then {billing_tx_history.units_of_service}.

The 500 billing code is a transfer code cannot exist with a claim number. claim_number and payment_code are string fields. What I am trying to do is count units for services with a claim number or 500 payment code as billed units. And for services without a claim number and services that do not have a 500 code as not billed units. I hope this helps. thanks
t
 
I am not clear on whether the {billing_pay_adj_history.payment_type_code} can be null, but as I said in my previous post, if the two fields in questions are strings it is possible they are empty strings rather than NULLs. Try amending the two formulas as follows (note I can't test the syntax, so apologies if there is an error in it somewhere):

[Code BILLED]
If (
Not(Isnull({billing_tx_charge_detail.CLAIM_NUMBER})) or
Trim({billing_tx_charge_detail.CLAIM_NUMBER}) <> ''
)
and
(
Not(Isnull({billing_pay_adj_history.payment_type_code})) and
{billing_pay_adj_history.payment_type_code} = '500'
)
Then {billing_tx_history.units_of_service}
Else 0
[/Code]

[CODE NOT_BILLED]
If (
Isnull({billing_tx_charge_detail.CLAIM_NUMBER}) or
Trim({billing_tx_charge_detail.CLAIM_NUMBER}) = ''
)
and
(
Not(Isnull({billing_pay_adj_history.payment_type_code})) or
{billing_pay_adj_history.payment_type_code} <> '500'
)
Then {billing_tx_history.units_of_service}
Else 0
[/Code]

I have tried to cover all the possibilities of nulls and empty strings. It may be a bit over the top but without knowing the data it is necessary.

Hope it helps
Pete
 
Go to the NetSmart Community website, post this in the Crystal Repository section. John Sawyer or Luis Quicano will have an answer (or a report that alreay does this) for you very quickly.
 
also when working with Avatar billing data, be sure to include this in your record select:

and isnull({billing_tx_charge_detail.transfer_to_gaurantor_code})
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top