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

od and even number detection

Status
Not open for further replies.

mart10

MIS
Nov 2, 2007
394
GB
I am using Crystal XI

I have the following:
if{bnkacrpt.trans_type}= "AI" and{#RTotal0}<=2 then "Interest" else
if{bnkacrpt.trans_type}= "AI" and{#RTotal0}>2 then "Withholding Tax deducted"

but on looking at data I need to actually detect if the {#RTotal0}result is odd or even How can I do this please?
 
It doesnt seem tro like this:

if{bnkacrpt.trans_type}="OB" or {bnkacrpt.sectype}="NA" then "" else
// The next piece test a running total to test for WHT
if{bnkacrpt.trans_type}= "AI" and({#RTotal0},2) =0 then "Interest" else
if{bnkacrpt.trans_type}= "AI" and({#RTotal0},2) =1 then "Withholding Tax" else

if{bnkacrpt.trans_type}= "GL" then "IGA Journal"
else {sectype.name}
 
you left 'remainder' out of your formula.

also, sectioning your logic using parenthesis is not only a good practice, but can prevent crystal from misinterpreting your intentions.

if ({bnkacrpt.trans_type}="OB" or {bnkacrpt.sectype}="NA") then "" else
(
if ({bnkacrpt.trans_type}= "AI" and remainder({#RTotal0},2) =0) then "Interest" else
(
if ({bnkacrpt.trans_type}= "AI" and remainder({#RTotal0},2) =1) then "Withholding Tax" else
(
if {bnkacrpt.trans_type}= "GL" then "IGA Journal"
else {sectype.name}
)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top