Workingdays with one date field

Morning all,
I have a report which uses only one date field. This report takes averages of lenses and jobs per day.
The report works fine when it is running on daily basis however when it runs on monthly basis it messes up the averages.
For example:
Daily report:
Job -1
Lens - 1
Average per day (job) -1
Average per day (lens) - 1
Month to date report
Date Range: Month to date (01/08/2008 to 28/08/2008)
Job - 6
Lens - 438
Average per day (Job)- 0.21 (where it should be 0.31)
Average per day (lens)- 15.64 (where it should be 23.05)
If you see above example, monthly should be taking Weekends and bank holidays in account.
I have done similar thing but used two different date fields however here I am facing only one date field which is being used.
So What I have done is, I modified the formula like this
WhileReadingRecords;
DateVar Array Holidays;
DateVar Target:={lab_rework.rework_date};
NumberVar Add:= -2;
NumberVar Added := 0;
WHILE Added > Add
Do (target := target -1;
    if dayofweek (target) in 1 to 7 and not (target in holidays)
        then Added:=Added-1
        else Added:=Added);
Target;
I added this formula into my Report Selection formula like this
({@WeekdaysOnly} in MonthToDate)
Oh and background of the report history:
Crystal Reports: 2008
Database: Informix
Report: Record Selection formula ({lab_rework.rework_date} in MonthToDate);
Report Group by: Report grouped by Reason Code
Report Average formula:
Whileprintingrecords;
Numbervar FAvg;
Numbervar myaverage=0;
Numbervar CAvg=0;
myaverage := {#Total Lenses}; 
CAvg:= myaverage /Day(Maximum(MonthToDate));
//({@EndDate}-{@StartDate}+1);
FAvg:=FAvg + CAvg;
CAvg
Anyone who can help me using only one formula which I can use to take in account working days?
The expected results aren't coming up correctly.
Regards
Jehanzeb

Nope, no need for that.
I sorted it out after editing my working days formula
here is the solution I used
WhileReadingRecords;
Local DateVar Start := Date(Year(CurrentDate),Month(CurrentDate),1);// place your Starting Date here
Local DateVar End :=   Currentdate;// place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
DateVar Array Holidays;
Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0)  +
(if DayOfWeek(End) = 7 then -1 else 0); 
Local NumberVar i;
For i := 1 to Count (Holidays)
do (if DayOfWeek ( Holidays<i> ) in 2 to 6 and
     Holidays<i> in start to end then Hol:=Hol+1 );
Weeks + Days - Hol;
//Holidays Code
//Holiday Array Formula for the report Header:
BeforeReadingRecords;
DateVar Array Holidays := [
Date (2003,12,25),   // you can put in as many lines for holidays as you want. 
Date (2003,12,31),
Date (2008,08,25)
0
Regards
Jehanzeb

Similar Messages

  • How to create a group with multiple data fields

    Post Author: RichS
    CA Forum: Formula
    Using CR XI.  Using CSV input from ODBC text driver.  No problems here.
    There are 3 fields that I want the same group by action.  Is this possible?) 
    If any one of these 3 fields change I want some header information and column fieldnames to display.  The header information I only want displayed on the first page (on the change) and the column fieldnames to display on every page.  I have played around with things like "InRepeatedGroupHeader" and "report group header on each page".  I am not getting all the results that I am looking for though.
    I want report to look like:
    Page header stuff  (to display on every page)  This data consists of some fields that will have static data and will display on every page.  And it consists of 3 non-static fields that I want to group on. 
    Group header stuff that I only want displayed on the first page on a change from one of the 3 fields mentioned above.
    Column headings that I want displayed on every page.
    Details data
    Group footer stuff (details not important for this)
    I get the expected output (column headings displayed on every page, and group header stuff display on the first page on each group change) with one group field.  But I want the group change to happen for all 3 fields.
    It seems simple but I can't find a way to create a "group" so if "field1 or field2 or field3" change, I get the same "group by" action.  I just need to know how to get the expected action.
    I expect that I might have some terms mixed up and/or some important information that would aide you in helping me.  If that is the case please re-post and I will add any missing or mis-stated information.
    Thanks,

    Post Author: V361
    CA Forum: Formula
    I am slightly confused, but perhaps you can create a formula
    Then group on the formula.  If this is not what you want, could you post some sample data, with the desired results.

  • Billing report with due date field

    Dear Friends,
    Can you please tell the logic of Billing report with due date field.
    Input.  billing document no, date range, sales organisation
    Output : billing document no, sales organisation, Amount. Due date.
    If any clarification required, Please let me know.
    Thanks in advance
    Ranjan

    Is it VF05 is suffiant for your purpose?
    use further selection criteria tab.
    Amit.

  • Extend shoping cart item overview with one additional field in approvals

    Hey there,
    I don't find any BADI for extending the SC item overview table with
    one additional field in the approvals area of srm.
    is there a way to do this without modifications ?
    best regards,
    Sven

    I went through the document on the mentioned by you.
    But my requirement is a bit diiferent.
    I want to have 3 different drop downs with a  numeric field attached to them.The sum of these numeric fields should always be 100 (two values are manually selected but the third value should be calculated automatically based on the previously selected values).
    Example,
    I select 10 as a value for Drop down 1, 40 for drop down2 then for the drop down3 the value should populate automatically as 50 (100 - (10+40)).i.e. the sum being 100.
    Can you or any one please help me with this.
    Also I am not sure how do we give multiple options for selection (like 10,20,..50 etc upto 100) for a drop down.

  • Form Size with one text field 442kb

    I started work on a new version of a three page dynamic form because the old version was 1,537kb.
         After setting up my new blank master pages (3), I placed a text field on the blank "cover page". The from size went from 12kb to 442kb with one text field. How can one small text field with no caption increase the file size so tremondously. That's a factor of 36! Any suggestions? I am using:
    Microsoft Windows 7
    Adobe Acrobat Pro X 10.1.6
    Livecycle Designer ES2 Version 9.0
    FYI: I have read that there exists some tools out there to inspect your pdf/xml and see what objects are increasing your file size. This would be very helpful, however I work for a company that gives very little freedom in downloading unapproved software. So unless there is an Adobe way to inspect for an object and its impact on size, I am in a tough situation. Thank you for your time.
    https://workspaces.acrobat.com/?d=H06NjDMAiTS79khuQCoKKw

    Remove the embed fonts feature to reduce your file size:
    File > Form Properties > Save Options
    Old version file size went from 1,537kb down to 132kb

  • Is there a way to import a indd CS4 file with its Data Fields names and properties into CC?

    I have to convert numerous files from CS4 to CC. The CS4 files are using external data from a CSV file. When I open the file in CS4 I can enable the preview and see the data from the CSV file. But when I save the file as indd or idml and try to open it in InDesignCC then I can't see the data as preview. I can see the Data fields (text).I think it's because it doesn't recognize the data fields from the CS4 file. If I delete a data field and remap it I will be able to see the preview for the field I just mapped. the other fields remain the unchanged, like they were just text.
    Any help with this topic will be very appreciated. I have about 70 data fields per document and about 100 documents to go through.
    Update: The symbol for a data field, ex: «fullname_2» change size when I delete and remap it. Explanation: When I open the CS4 file in IndesignCC I can't view a preview of the Data field(s) (almost positive because it's plain text). The data fields show like this «fullname_2». But when I delete that and drag a field from the data field list it shows like this <<fullname_2>>. So definitely, CC is not reading the data fields from InDesign CS4.
    P.S.: The fields above («fullname_2» and <<fullname_2>>  are copy and paste from Indesign CC.

    I'm attaching this image so this forum can notice the difference on the Data fields from CS4 and the ones added on CC

  • Weird errors with a DATE field in a certain row

    We have a table with an exp_date field of DATE datatype. One row is giving us mysterious problems.
    If I query the row in sqlplus, the exp_date field displays 18-Jun-04. The same query in Oracle SQL Developer displays 19-Jun-04. The same query in TOAD returns a NULL field, and adding "exp_date IS NULL" to the query returns no rows (since it really isn't NULL!).
    In sqlplus, if I use trunc() or round() on exp_date, it gets bumped up to 19-Jun-04.
    This field for this record is causing some issues in our java classes as well, we're adding some more logging/exception handling to find out exactly what they are.
    Any thoughts?
    FWIW this is on Oracle 10gR2 (10.2.0.2).
    Message was edited by:
    dtseiler

    what happens if you do the following on all three different environments:
    SQL> select to_char(exp_date, 'dd-mon-yyyy hh24:mi:ss') from your_table where your_condition ;
    [pre]

  • Issue with a date field

    Hi,
    I have a pl/sql page that is the output of a select statement with some conditions.
    One of the condition is like:
    AND MyColumn between (:P1_MyDateItem - 7 , :P1_MyDateItem)
    but as soon as I include an addition or substraction (:P1_datefield - 7) , I get ORA-06550: line 18, column 28: PL/SQL: ORA-00932: inconsistent datatypes: expected DATE got NUMBER
    How can I resolve that error?
    Also,
    I am trying to pass the date field to a second page in a hidden field. In a similar scenario as the one described above, how can I manipulate the date using the hidden field. ie. in my testing, I think it kind of converts the "date" into "char' format?? can I also do the same manipulation "Date-7" but this time using a hidden field instead?
    Thanks

    FabioBui wrote:
    but as soon as I include an addition or substraction (:P1_datefield - 7) , I get ORA-06550: line 18, column 28: PL/SQL: ORA-00932: inconsistent datatypes: expected DATE got NUMBER
    How can I resolve that error?Try converting it to a date first
    to_date(:P1_datefield, <date_format>)-7
    I am trying to pass the date field to a second page in a hidden field. In a similar scenario as the one described above, how can I manipulate the date using the hidden field. ie. in my testing, I think it kind of converts the "date" into "char' format?? can I also do the same manipulation "Date-7" but this time using a hidden field instead? Yes, if that's what you want to do. A date field is just a text box, made nicer with the jQuery Date Picker.
    so date picker:
    <input type="text" value="12/14/2011" />
    to a hidden item
    <input type="hidden" value="12/14/2011" />
    only difference being the display type.
    Just remember to convert it to a date in your pl/sql code.

  • Help with a date field script

    Sorry if this is a repeat. I was interrupted and found that my browser had crashed when I came back so I'm not sure if the question got asked.
    I need a script for a date field (mm/dd/yyyy) where the user can only fill in a date that is between 12/31/1899 and the current date (whatever the date when the form is opened). I'm getting better at writing these but I haven't been successful with this one. Any help would be greatly appreciated.
    Thanks!

    I have a feeling I already answered this question some time ago... Anyway, you can use this code as the field's custom validation script:
    var minDate = util.scand("mm/dd/yyyy", "12/31/1899");
    var maxDate = new Date();
    event.rc = true;
    if (event.value) {
        var d = util.scand("mm/dd/yyyy", event.value);
        if (d<minDate || d>maxDate) {
            app.alert("Error! The entered date must be between " + util.printd("mm/dd/yyyy", minDate) + " and " + util.printd("mm/dd/yyyy", maxDate));
            event.rc = false;

  • Is anyone else having problems with Apertures Date fields?

    After experiencing a sysems failure I began restoring my images from backups.  I have had no end of problems with Image dates.  I have come to the determination that Aperture is NOT using either the "Create Date" or "DateTimeOriginal" as the image "Date" or "Date Created" data if other fields have other dates.
    Here is a clip from my image metadata using exiftool:
    File Modification Date/Time     : 2012:09:23 19:53:15-04:00
    File Access Date/Time           : 2013:01:16 11:34:38-05:00
    File Inode Change Date/Time     : 2013:01:16 11:31:32-05:00
    Create Date                          : 2006:02:20 11:51:12.10
    Date/Time Original              : 2006:02:20 16:51:12.10
    Modify Date                          : 2006:02:20 11:51:12.10
    And here is what Aperture utilized on import
    Date:                               9/23/12 7:53:15 PM EDT
    Date Created                         9/23/2012 7:53:15 PM
    So Aperture utlized the File Modification Date/Time as the Create Date despite that the fact that the Create Date field is present and is properly formatted in the original image.
    According to the Aperture mapping table, this shouldn't be happening.
    Now, before someone recommends that I use Aperture's Date Adjust utility - I'm talking about  slightly over 30,000 images.  Editing images one at a time, or in blocks when you don't know what field Aperture is using as the Create Date would require individual inspection of each image followed by manual adjustment of each image.  That approach isn't acceptable.

    Hmm ok, let me restate the issue then, I thought I was clear.  I could have pointed out in my original post however, that only the EXIF and IPTC date fields were displayed from the metadata dump.
    The data set presented in my first post is the EXIF dataset from the file which clearly shows the image was captured by digital camera at
    Create Date                          : 2006:02:20 11:51:12.10
    Date/Time Original              : 2006:02:20 16:51:12.10
    (The delta of 5 hours is the result of Zulu versus local time offset)
    But, when I ingested it into Aperture, the import routine utilized the IPTC field
    File Modification Date/Time     : 2012:09:23 19:53:15-04:00
    which is updated by the OS whenever you move the file around outside of Aperture. (a number of image data fields are updated by the OS - filename for example is another.).  This resulted in the image date fields being stamped in Aperture as:
    Date:                               9/23/12 7:53:15 PM EDT
    Date Created                         9/23/2012 7:53:15 PM
    Which obviously came form the File Modification Date/Time field and not (either) the Create Date or Date/Time Original fields.

  • Problem with displaying Date field in the table.

    Hi All,
    I am trying to display data into a table UI Element. 
    In that data, i have one DATE type field. While displaying data in DATE field, it will display like this "01.02.2009".
    Now my requirement is if i want to modify that DATE field, it will allow to modify "01.02.2009"  to "26.02.2009".
    But while modifying DATE field , I want to show the Calender of that month, in that i  have to select the another date.
    (Like normal Date UI Element will show that calender).
    Can anyone please help me.
    Thanks in Advance!
    Regards,
    Sreelakshmi.

    Hi,
          Go to the context attribute that was mapped to the DATE field of the table and change the perperty INPUT HELP MODE to  AUTOMATIC and it works.
    Regards,
    Manne.

  • Problem with the date field in Table Control

    I have created a table control in my module programming. One of the column in the table control is a date field which is I/O field.
    Now if I enter a value in date field column and hit enter the date field is reset. I dont want the field to get reset and accept valid date field.
    I have set type of the column as DATS and I havent used any dictionary fields. The column is from the internal table in the program.
    Please suggest

    In your PAI, in the LOOP AT <itab> did you
    - check date validity
    - update internal table
    * Sample
    LOOP AT itab.
      FIELD itab-field MODULE checkfield.
      MODULE updateitab.
    ENDLOOP.
    Look also at SAP documentation like [Table Controls|http://help.sap.com/abapdocu/en/ABENTABLE_CONTROL1_ABEXA.htm] or [Table Controls in ABAP Programs|http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac9f35c111d1829f0000e829fbfe/frameset.htm]
    Regards,
    Raymond

  • Help with Updating Data Fields in Merged Document

    I'm working in InDesign CS5 v7
    I have a multipage report, all using one master page for about 80  seperate records. Each page has their own linked graphs/images.
    We  now have need to alter the source data, and while these alterations can be seen in  'Preview mode' on the Master Page, they are not carrying through  into the pages themselves. No amount of 'Update Data Source' clinking changes this,  and the 'Update Content Data Fields' remains greyed out...
    I really don't want to have to remerge the whole document, as I will loose all of the linked graphs and images.
    Can anyone help?

    You've seen the other thread, so I think you already know the answer...

  • Query on a table with indexed date field

    I have a table with a date column which is indexed. If I run a query like "select column1 where date_field='20-JAN-04' for example it is fast and uses index.
    If I run select column1 where date < '20-JAN-04' it is slow and doesnt use the index. I logged a TAR and Oracle told me that this is to be expected as not using the index in this case is the most effiecient way of doing the query.
    Now my concept of an index is like the index of Yellow Pages(telephone directory) for example. In this example if I look for a name that is say "Halfords" or below, I can see all entries for Halfords and all the way to ZZZ in one block.
    I just cant see , in a common sense way why Oracle wont use the index in this type of query.
    George

    Using the concept of a telephone directory is wrong. In a telephone directory you have all information order by the name. However in your table (if it is not an IOT) you don't have all information/rows ordered by your date_field. Rather think at the document "Oracle9i Database Concepts" and it's index.
    Let's say you want to find all indexed words larger then "ISO SQL standard" (ok that doesn't make sense but it is just an example). So would it be faster to read the whole document or to lookup each word in the index and then read the entire page (Oracle block) to find the word.
    It's not allways easy to know in advance if the query will be faster over the index or a full table scan. what you need to do is to well analyze (dbms_stats) the table and it's index, in most cases Oracle chooses the right way. You may also use the hint /*+ index(table_name index_name) */ and will see if it would be faster over the index or not.
    A good document about that subject is:
    http://www.ioug.org/tech/IOUGinDefense.pdf
    HTH
    Maurice

  • SOA 11g DBAdapter Polling using a Sequencing Table with a DATE Field

    Hi.
    I have implemented a polling solution using a sequencing table that references a DATE column. For the most part the poll works correctly, but on occasion, I am not seeing a BPEL process instantiation for various records that get created in my source table.I have also noticed that in this particular case, the DATE field content on one or more source records is exactly the same --> "YYYYMMDDhhmmss".
    I just want to confirm here, that the polling adapter should be able to pick up multiple records from the source table, even though the date field is exactly the same. As well, how should I go about trying to debug this issue, if point #1 is handled by the system. Is there is a specific log or trace file that I can look at. Also, could I be facing a timing issue ?
    Can someone please comment on this.
    Thanks.

    In my table, I don't see a primary key, but only a unique index. I would assume then, that this would be analogous to the primary key capture; noticed that currently this code was only using one column out of two, from the unique index itself.
    Also, is the date content issue that I mentioned above a moot point then, based upon not having the correct primary key/unique key data pointers established ?
    Thanks.

Maybe you are looking for

  • How do I turn off iTunes 7.0 on start-up?

    iTunes starts up when I start or awaken my computer even though I had it turned off. Since it takes more memory with iTunes 7.0 it takes longer for my computer to actually start-up every time now. I want to turn the program on at my discretion and no

  • How to create  Own IDOC

    how to create  our own idoc .. plz help me with  detail steps and explanations... thanks in advance.

  • Pkgadd: ERROR: unable to determine current run-state

    Hello, I'm working with Solaris 10 5.10 sparc. I have successfully created a package with no difficulties. The package only consists of a bash script that is meant to update system files to enable remote logging and configure a server to accept event

  • Help Me with mail Pleasee

    So I'm trying to set up my school account on mail. My schools website says it's a pop3 account so i use the pop and i type in the server and mail.schoolname.edu and my name and password..It doesnt work though it says it is not responding it works on

  • Why am I in collections? I'm a current customer on a family plan.

    I have been an AT&T customer since approximately 2004 and still have the same number I received when I first joined. I merged my account with my partner's number into a family plan in September of 2014. Even though AT&T has notorious network issues,