Print Page | Close Window

Need help calculating number of days worked

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=7654
Printed Date: 05 May 2025 at 10:31am


Topic: Need help calculating number of days worked
Posted By: RTSFO
Subject: Need help calculating number of days worked
Date Posted: 10 Sep 2009 at 1:37pm

Hi,

I have 7 columns in the database for seven days of the week with a Y or N value.

I want to calculate the number of days worked based on the value Y.

Can some one help?

Thanks in advance.




Replies:
Posted By: BernieHunt
Date Posted: 17 Sep 2009 at 12:29pm

How about step through each field and increment a counter if it contains a Y?

dim i as integer
dim daysWorked as integer = 0
 
For i = 0 to 7
   if myRow(i).compareto("Y") = 0 then daysWorked += 1
Next
 
Would something like this work for you?
 
Bernie


Posted By: RTSFO
Date Posted: 18 Sep 2009 at 10:15am
Thank you for your suggestion. I added the summing up formula to the sql and pulling the field from sql.
Thanks
 



Print Page | Close Window