Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: Boolean Problem Post Reply Post New Topic
Author Message
om09
Newbie
Newbie
Avatar

Joined: 22 Mar 2009
Location: India
Online Status: Offline
Posts: 2
Quote om09 Replybullet Topic: Boolean Problem
    Posted: 23 Mar 2009 at 2:29am
Tongue hi guys,

i am using crystal report to view true/false value from the table fields.In report designer i have to get yes as one field value and no as other depending on the table field values. for this i have created a formula where i will get true or false value but when i am dragging the formula field for yes and no .i am getting the same result..i need a fomula to get different boolean value based on table fields

   can anyone  help me.......... ??


Thanks in advance!!

Regards,
Om


a
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 23 Mar 2009 at 1:03pm
If you could post your formula we may be better able to offer a solution.
 
Regards,
 
John W.
IP IP Logged
om09
Newbie
Newbie
Avatar

Joined: 22 Mar 2009
Location: India
Online Status: Offline
Posts: 2
Quote om09 Replybullet Posted: 23 Mar 2009 at 10:44pm

hi,

First thanks for ur reply.I have used this formula.

 if{MQM_USP_PatientQIDataElementValuesForReport;1.DataElementId}="AMI_39" then
    if{MQM_USP_PatientQIDataElementValuesForReport;1.DataElementValue}="true" then
          Chr(254)
    else
        
         Chr(168)
  

Else
 
    if{MQM_USP_PatientQIDataElementValuesForReport;1.DataElementValue}="false" then
     Chr(254)  
    else
         
       Chr(168) 

 

Please check it..I have given formula for both Yes and No options but  how to know whether it is true or false for yes..because on the basis of boolean value in Yes we can assigned the boolean for No.I saw some object name..whether it will be helpful..or not if yes then how we can use that in formula.

 Regards,

Om
a
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 24 Mar 2009 at 7:21am

Set a variable to hold the value for which I take to be CHR(168) then change the var based on the following code in the first part I removed the nested if and uses an 'AND' because both must exist to be a true, if that is incorrect change as appropriate...
---------------------------------
var = Char(168)

IF  {MQM_USP_PatientQIDataElementValuesForReport;1.DataElementId}="AMI_39" AND
  {MQM_USP_PatientQIDataElementValuesForReport;1.DataElementValue}="true" THEN
         var = Chr(254)  

ELSE
 
    IF 2{MQM_USP_PatientQIDataElementValuesForReport;1.DataElementValue}="false" THEN
     var =  Chr(254)  
 -----------------

Hope this helps
 
Regards,
 
John W.
IP IP Logged
wmdaggie
Newbie
Newbie
Avatar

Joined: 12 May 2009
Location: United States
Online Status: Offline
Posts: 2
Quote wmdaggie Replybullet Posted: 12 May 2009 at 8:36am

 

Ok, I got that, I used the following to convert yes and no to numbers

If {RA.MCData} = "Yes" then 1
Else IF {RA.MCData} = "No" then 0

Now I need to SUM the "1s" and then use that sum to get a percentage of another field or sum...
 
Can someone help?  I cannot just drop the Formula field into the Formula expert.
 
Thanks, need help ASAP!
WMDAggie
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 12 May 2009 at 12:50pm
Create your formula for the 1 and 0 in the Formula Expert - I'm going to call it MCData_1or0. 
 
Create another formula to do the sum - I'll call it MCData_Sum.  If you need the sum at a group level it will look like this:
 
Sum({@MCData_1or0}, {table.group_field})
 
If it's a total sum for the report it will look like this:
 
 
To do the percentage, create another formula that looks like this:
 
If {field or other sum formula} = 0 then
  0
else
  {@MCData_Sum}%{field or other sum formula}
 
You need to make  sure that you're not dividing by 0, hence the first part of the If.  The '%' operator does the percentage calculation (a/b*100) for you.
 
-Dell
IP IP Logged
wmdaggie
Newbie
Newbie
Avatar

Joined: 12 May 2009
Location: United States
Online Status: Offline
Posts: 2
Quote wmdaggie Replybullet Posted: 12 May 2009 at 12:53pm
Thank You!
WMDAggie
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.