Print Page | Close Window

Boolean Problem

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=5853
Printed Date: 28 May 2024 at 3:48am


Topic: Boolean Problem
Posted By: om09
Subject: Boolean Problem
Date 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



Replies:
Posted By: jkwrpc
Date 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.
http://www.CustomReportWriters.net - www.CustomReportWriters.net


Posted By: om09
Date 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


Posted By: jkwrpc
Date 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.
http://www.CustomReportWriters.net - www.CustomReportWriters.net


Posted By: wmdaggie
Date 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


Posted By: hilfy
Date 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( mailto:%7b@MCData_1or0 - {@MCData_1or0 }, {table.group_field})
 
If it's a total sum for the report it will look like this:
 
Sum( mailto:%7b@MCData_1or0 - {@MCData_1or0 })
 
To do the percentage, create another formula that looks like this:
 
If {field or other sum formula} = 0 then
  0
else
  mailto:%7b@MCData_Sum%7d%%7bfield - {@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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: wmdaggie
Date Posted: 12 May 2009 at 12:53pm
Thank You!

-------------
WMDAggie



Print Page | Close Window