Count Function on Date Field in Discoverer

Hey folks,
How would someone like to educate a novice on how to perform a count function on a date field? I am writing a Discoverer report and have a requirement to display counts of the number of records that have a modified date of > 30 days and > 60 days. I am trying to use the 2nd count function as such: COUNT(modified_date < (SYSDATE - 30)). I keep getting the "error in function" message. I have tried it with CURRENT_DATE as well and get the same error.
Any help would be greatly appreciated.
Thanks much,
Schuyler

Hi
You can't use logical expression in a function like this:
COUNT(modified_date < (SYSDATE - 30))
instead of this use CASE expression:
COUNT(case when modified_date < (SYSDATE - 30) then 1 else 0 end)
Ott Karesz
http://www.trendo-kft.hu

Similar Messages

  • Line chart to plot count of 2 date fields against calendar month

    Post Author: springle
    CA Forum: Charts and Graphs
    I would like to create a line chart with 2 lines.  I would like the x axis to be a calendar month.  I would like the y axis to be the count of a date field for that month.  I would like 2 lines, one the the count of applications recieved in a month and the other to be the number of shipments in a month.  I can make a chart to plot one or the other but not both on one chart.So in summary I want of a count of date1 and a count of date2 by calendar month in one line chart.Thanks in advance,Scott

    Post Author: springle
    CA Forum: Charts and Graphs
    Thanks for the reply but I am afraid this does not solve my problem.  Your proposal make the month count of Date1 records in the fields and the count of Date2 in the month of date1 I am try to graph...In the month of Jan: 56 apps and 49 deliveriesIn the month of Feb: 76 apps and 79 deliveriesIn the month of Feb: 86 apps and 69 deliveriesThe change on date cannot be either app date or del date.  It needs to be independent from a calendar timeline. Scott 

  • Count function within date/time

    Using Crystal Reports X, I need to calculate how many people are in a building at any given hour over rolling 24 hour periods. Each person entering is recorded by dd/mm/yyyy hh:mm:ss and the same method is used when they leave thus each person has a time span in the building. I know the date/time of leaving is critical to this in terms of whether it's populated or is null but I'm getting caught on the calculation in between. The two date/time fields should allow their presence in the building to be recorded and counted each hour. The critical point will come at midnight where the DateDiff function will need to apply. Does anyone have a solution that doesn't involve multiple formulae or stored procedures?

    Assuming your base data is some sort of log, with one record for an entry and one for an exit, this is really quite simple.  No DateDiff needed! 
    Pull all of the logs for the time frame that you want to report, then keep track of the ins and outs with a formula something like (basic syntax):
    global inBuilding as number
    if {table.action} = "IN" then
      inBuilding = inBuilding + 1
    else
      inBuilding = inBuilding - 1  ' assuming action is only IN or OUT
    end if
    formula = ''
    Place this on the detail format.  Group your records by hour, and on the group footer, place this:
    global inBuilding as number
    formula = inBuilding
    Which will show the number of people in the building at the end of that hour.
    There are two issues with this, both of which can be gotten around:
    1) The number of people in the building at the start of the reporting period is not taken into account.  For that, you might want to create a summary table by hour (a datetime; or at midnight by date) and the number of people in the building, then add that into your data.  (Or you could go through all of the records from the beginning of time, but in a few years, that'll be really, really slow!)
    2)  It does not necessarily show every hour of every day (if there are no log entries for the hour).  In order to do that, you'd need to have a "master calendar" type table that does have every hour of every day (don't forget about Daylight Savings Time!) and use that on the left side of an Left outer Join to your other data.
    HTH,
    Carl

  • How to use MAX() function with date field

    Hi Frzz,
    I have created a Graphical calculation view in which i have multiple records for each employee with different dates. But my requirement is to take the records which have maximum date.
    I have converted the date into Integer and applied the MAX() function. But still am getting multiple records.
    Is there is any other way we can achieve this requirement in Graphical Calculation view??  Your suggestion will really help me.
    Thank  you.
    Krishna.

    Hmm... what have you tried out so far?
    Look, I took the effort and created a little example, just for you
    Assume we have a table that contains the logon dates of users.
    Every line contains the logon date and some info on the user.
    Very much like a not-normalized log file could look like.
    Now, the output we want is: one line per user with the most current logon time.
    Not too difficult:
    1. Have a aggregation node that gives you the distinct user details - one line for every user:
    2. Have another aggregation node that gives you the last (MAX) logon date per user:
    Finally you do a 1:1 join on the USER_ID and map the result to the output.
    Easy as pie
    - Lars

  • Calendar Functionality for a date field in HTML of  a ITS service

    Hi
    I am working with SRM EBP module we want to add date help(with calendar function) to existign date fields in Shopping cart and PO screens . I found some HTML and Javascripts in SYSTEM and BBPGLOBAL services (named as calendar)but not sure which ones to use if anyone used date functionality or even have access to Standard SAP ITS screens that already have date field with calendar fuctionality can you help???????????????
    Thanks in Advance

    Hi
    Let me first thank you for the quick response and timely help you provided calendar popup works great but one minor issue i am not able to click on the date entry and bring the field back into the field not sure if this funcitonality is in show_calendar.
    I would really appreciate if you get time to look at below i am almost there with your help......thanks again
    Here are the steps I did
    I have a HTML page  SAPLBBP_SC_UI_ITS screen 300 in SRM module , I created a new HTML page (zcalendar.html) in the same internet service BBPSC01 as suggested and I included in my HTML page SAPLBBP_SC_UI_ITS screen 300 and also I added below code to add a icon and a href call to the show_calendar function.
    Code works great I get the popup but when I double click on the date it is not selecting the date into the field back .
    Any thoughts??????
    <!-- Start ghantavine -->
    `include (~service="bbpsc01", ~name="zcalendar.html")`
    <!-- End ghantavine -->
    <!--    10/24/05 ghantavine--delivary date  -->
    `TR()`
        `if (GS_SCR_BASIC_I-DELIV_DATE.visible)`    
         `TR()`                                    
           `if (gs_scr_basic_i-deliv_date.disabled)`
              `TD(class="label", nowrap="x",
    active="")``TXT_BASIC_I-DELIV_DATE.label` 
              `TD(class="label", nowrap="x", active="")``gs_scr_basic_i-deliv_date.value`
            `else`  
                `TD(class="label", nowrap="x", active="")`<label
    for="`GS_SCR_BASIC_I-DELIV_DATE.name`">`TXT_BASIC_I-DELIV_DATE.label`</label>     
                `TD(class="data",  nowrap="x")`  
                <input type="text" id="GS_SCR_BASIC_I-DELIV_DATE"
    name="GS_SCR_BASIC_I-DELIV_DATE"  value="`GS_SCR_BASIC_I-DELIV_DATE.value`"
    maxlength="010" size="008">          
           <a href=http://mail.yahoo.com/config/login?/"_javascript:show_calendar();">
           <img id="anchor1" src="`mimeurl(~service="bbpglobal",
    ~name="images/button/f4.gif", ~language="", ~theme="99")`" />
           </a>
             `end`
          `TR()` `Lines()`
        `end`
    <!--      10/24/05 ghantavine--delivary date    -->
    below is the showcalendar code
    Hi , u save this as a html file and call this show_calendar fn  from Onclick button of your Calendar image .
    //  For generating the calendar
    var weekend = [0,6];
    var weekendColor = "#e0e0e0";
    var fontface = "Verdana";
    var fontsize = 2;
    var gNow = new Date();
    var ggWinCal;
    isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
    isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
    Calendar.Months = ["January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December"];
    // Non-Leap year Month days..
    Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    // Leap year Month days..
    Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    function Calendar(p_item, p_WinCal, p_month, p_year, p_format) {
         if ((p_month == null) && (p_year == null))     return;
         if (p_WinCal == null)
              this.gWinCal = ggWinCal;
         else
              this.gWinCal = p_WinCal;
         if (p_month == null) {
              this.gMonthName = null;
              this.gMonth = null;
              this.gYearly = true;
         } else {
              this.gMonthName = Calendar.get_month(p_month);
              this.gMonth = new Number(p_month);
              this.gYearly = false;
         this.gYear = p_year;
         this.gFormat = p_format;
         this.gBGColor = "white";
         this.gFGColor = "black";
         this.gTextColor = "black";
         this.gHeaderColor = "black";
         this.gReturnItem = p_item;
    Calendar.get_month = Calendar_get_month;
    Calendar.get_daysofmonth = Calendar_get_daysofmonth;
    Calendar.calc_month_year = Calendar_calc_month_year;
    Calendar.print = Calendar_print;
    function Calendar_get_month(monthNo) {
         return Calendar.Months[monthNo];
    function Calendar_get_daysofmonth(monthNo, p_year) {
         Check for leap year ..
         1.Years evenly divisible by four are normally leap years, except for...
         2.Years also evenly divisible by 100 are not leap years, except for...
         3.Years also evenly divisible by 400 are leap years.
         if ((p_year % 4) == 0) {
              if ((p_year % 100) == 0 && (p_year % 400) != 0)
                   return Calendar.DOMonth[monthNo];
              return Calendar.lDOMonth[monthNo];
         } else
              return Calendar.DOMonth[monthNo];
    function Calendar_calc_month_year(p_Month, p_Year, incr) {
         Will return an 1-D array with 1st element being the calculated month
         and second being the calculated year
         after applying the month increment/decrement as specified by 'incr' parameter.
         'incr' will normally have 1/-1 to navigate thru the months.
         var ret_arr = new Array();
         if (incr == -1) {
              // B A C K W A R D
              if (p_Month == 0) {
                   ret_arr[0] = 11;
                   ret_arr[1] = parseInt(p_Year) - 1;
              else {
                   ret_arr[0] = parseInt(p_Month) - 1;
                   ret_arr[1] = parseInt(p_Year);
         } else if (incr == 1) {
              // F O R W A R D
              if (p_Month == 11) {
                   ret_arr[0] = 0;
                   ret_arr[1] = parseInt(p_Year) + 1;
              else {
                   ret_arr[0] = parseInt(p_Month) + 1;
                   ret_arr[1] = parseInt(p_Year);
         return ret_arr;
    function Calendar_print() {
         ggWinCal.print();
    function Calendar_calc_month_year(p_Month, p_Year, incr) {
         Will return an 1-D array with 1st element being the calculated month
         and second being the calculated year
         after applying the month increment/decrement as specified by 'incr' parameter.
         'incr' will normally have 1/-1 to navigate thru the months.
         var ret_arr = new Array();
         if (incr == -1) {
              // B A C K W A R D
              if (p_Month == 0) {
                   ret_arr[0] = 11;
                   ret_arr[1] = parseInt(p_Year) - 1;
              else {
                   ret_arr[0] = parseInt(p_Month) - 1;
                   ret_arr[1] = parseInt(p_Year);
         } else if (incr == 1) {
              // F O R W A R D
              if (p_Month == 11) {
                   ret_arr[0] = 0;
                   ret_arr[1] = parseInt(p_Year) + 1;
              else {
                   ret_arr[0] = parseInt(p_Month) + 1;
                   ret_arr[1] = parseInt(p_Year);
         return ret_arr;
    // This is for compatibility with Navigator 3, we have to create and discard one object before the prototype object exists.
    new Calendar();
    Calendar.prototype.getMonthlyCalendarCode = function() {
         var vCode = "";
         var vHeader_Code = "";
         var vData_Code = "";
         // Begin Table Drawing code here..
         vCode = vCode + "<TABLE BORDER=1 BGCOLOR=\"" + this.gBGColor + "\">";
         vHeader_Code = this.cal_header();
         vData_Code = this.cal_data();
         vCode = vCode + vHeader_Code + vData_Code;
         vCode = vCode + "</TABLE>";
         return vCode;
    Calendar.prototype.show = function() {
         var vCode = "";
         this.gWinCal.document.open();
         // Setup the page...
         this.wwrite("<html>");
         this.wwrite("<head><title>Calendar</title>");
         this.wwrite("</head>");
         this.wwrite("<body " +
              "link=\"" + this.gLinkColor + "\" " +
              "vlink=\"" + this.gLinkColor + "\" " +
              "alink=\"" + this.gLinkColor + "\" " +
              "text=\"" + this.gTextColor + "\">");
         this.wwriteA("<FONT FACE='" + fontface + "' SIZE=2><B>");
         this.wwriteA(this.gMonthName + " " + this.gYear);
         this.wwriteA("</B><BR>");
         // Show navigation buttons
         var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
         var prevMM = prevMMYYYY[0];
         var prevYYYY = prevMMYYYY[1];
         var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
         var nextMM = nextMMYYYY[0];
         var nextYYYY = nextMMYYYY[1];
         this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "'" +
              ");" +
              "\"><<<\/A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "'" +
              ");" +
              "\"><<\/A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "'" +
              ");" +
              "\">><\/A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)+1) + "', '" + this.gFormat + "'" +
              ");" +
              "\">>><\/A>]</TD></TR></TABLE><BR>");
         // Get the complete calendar code for the month..
         vCode = this.getMonthlyCalendarCode();
         this.wwrite(vCode);
         this.wwrite("</font></body></html>");
         this.gWinCal.document.close();
    Calendar.prototype.showY = function() {
         var vCode = "";
         var i;
         var vr, vc, vx, vy;          // Row, Column, X-coord, Y-coord
         var vxf = 285;               // X-Factor
         var vyf = 200;               // Y-Factor
         var vxm = 10;               // X-margin
         var vym;                    // Y-margin
         if (isIE)     vym = 75;
         else if (isNav)     vym = 25;
         this.gWinCal.document.open();
         this.wwrite("<html>");
         this.wwrite("<head><title>Calendar</title>");
         this.wwrite("<style type='text/css'>\n<!--");
         for (i=0; i<12; i++) {
              vc = i % 3;
              if (i>=0 && i<= 2)     vr = 0;
              if (i>=3 && i<= 5)     vr = 1;
              if (i>=6 && i<= 8)     vr = 2;
              if (i>=9 && i<= 11)     vr = 3;
              vx = parseInt(vxf * vc) + vxm;
              vy = parseInt(vyf * vr) + vym;
              this.wwrite(".lclass" + i + " {position:absolute;top:" + vy + ";left:" + vx + ";}");
         this.wwrite("-->\n</style>");
         this.wwrite("</head>");
         this.wwrite("<body " +
              "link=\"" + this.gLinkColor + "\" " +
              "vlink=\"" + this.gLinkColor + "\" " +
              "alink=\"" + this.gLinkColor + "\" " +
              "text=\"" + this.gTextColor + "\">");
         this.wwrite("<FONT FACE='" + fontface + "' SIZE=2><B>");
         this.wwrite("Year : " + this.gYear);
         this.wwrite("</B><BR>");
         // Show navigation buttons
         var prevYYYY = parseInt(this.gYear) - 1;
         var nextYYYY = parseInt(this.gYear) + 1;
         this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', null, '" + prevYYYY + "', '" + this.gFormat + "'" +
              ");" +
              "\" alt='Prev Year'><<<\/A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', null, '" + nextYYYY + "', '" + this.gFormat + "'" +
              ");" +
              "\">>><\/A>]</TD></TR></TABLE><BR>");
         // Get the complete calendar code for each month..
         var j;
         for (i=11; i>=0; i--) {
              if (isIE)
                   this.wwrite("<DIV ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
              else if (isNav)
                   this.wwrite("<LAYER ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
              this.gMonth = i;
              this.gMonthName = Calendar.get_month(this.gMonth);
              vCode = this.getMonthlyCalendarCode();
              this.wwrite(this.gMonthName + "/" + this.gYear + "<BR>");
              this.wwrite(vCode);
              if (isIE)
                   this.wwrite("</DIV>");
              else if (isNav)
                   this.wwrite("</LAYER>");
         this.wwrite("</font><BR></body></html>");
         this.gWinCal.document.close();
    Calendar.prototype.wwrite = function(wtext) {
         this.gWinCal.document.writeln(wtext);
    Calendar.prototype.wwriteA = function(wtext) {
         this.gWinCal.document.write(wtext);
    Calendar.prototype.cal_header = function() {
         var vCode = "";
         vCode = vCode + "<TR>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sun</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Mon</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Tue</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Wed</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Thu</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Fri</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='16%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sat</B></FONT></TD>";
         vCode = vCode + "</TR>";
         return vCode;
    Calendar.prototype.cal_data = function() {
         var vDate = new Date();
         vDate.setDate(1);
         vDate.setMonth(this.gMonth);
         vDate.setFullYear(this.gYear);
         var vFirstDay=vDate.getDay();
         var vDay=1;
         var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
         var vOnLastDay=0;
         var vCode = "";
         Get day for the 1st of the requested month/year..
         Place as many blank cells before the 1st day of the month as necessary.
         vCode = vCode + "<TR>";
         for (i=0; i<vFirstDay; i++) {
              vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(i) + "><FONT SIZE='2' FACE='" + fontface + "'> </FONT></TD>";
         // Write rest of the 1st week
         for (j=vFirstDay; j<7; j++) {
              vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" +
                   "<A HREF='#' " +
                        "onClick=\"self.opener.document." + this.gReturnItem + ".value='" +
                        this.format_data(vDay) +
                        "';window.close();\">" +
                        this.format_day(vDay) +
                   "</A>" +
                   "</FONT></TD>";
              vDay=vDay + 1;
         vCode = vCode + "</TR>";
         // Write the rest of the weeks
         for (k=2; k<7; k++) {
              vCode = vCode + "<TR>";
              for (j=0; j<7; j++) {
                   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" +
                        "<A HREF='#' " +
                             "onClick=\"self.opener.document." + this.gReturnItem + ".value='" +
                             this.format_data(vDay) +
                             "';window.close();\">" +
                        this.format_day(vDay) +
                        "</A>" +
                        "</FONT></TD>";
                   vDay=vDay + 1;
                   if (vDay > vLastDay) {
                        vOnLastDay = 1;
                        break;
              if (j == 6)
                   vCode = vCode + "</TR>";
              if (vOnLastDay == 1)
                   break;
         // Fill up the rest of last week with proper blanks, so that we get proper square blocks
         for (m=1; m<(7-j); m++) {
              if (this.gYearly)
                   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) +
                   "><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'> </FONT></TD>";
              else
                   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) +
                   "><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'>" + m + "</FONT></TD>";
         return vCode;
    Calendar.prototype.format_day = function(vday) {
         var vNowDay = gNow.getDate();
         var vNowMonth = gNow.getMonth();
         var vNowYear = gNow.getFullYear();
         if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
              return ("<FONT COLOR=\"RED\"><B>" + vday + "</B></FONT>");
         else
              return (vday);
    Calendar.prototype.write_weekend_string = function(vday) {
         var i;
         // Return special formatting for the weekend day.
         for (i=0; i<weekend.length; i++) {
              if (vday == weekend<i>)
                   return (" BGCOLOR=\"" + weekendColor + "\"");
         return "";
    Calendar.prototype.format_data = function(p_day) {
         var vData;
         var vMonth = 1 + this.gMonth;
         vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;
         var vMon = Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();
         var vFMon = Calendar.get_month(this.gMonth).toUpperCase();
         var vY4 = new String(this.gYear);
         var vY2 = new String(this.gYear.substr(2,2));
         var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;
    /*     switch (this.gFormat) {
              case "MM\/DD\/YYYY" :
                   vData = vMonth + "\/" + vDD + "\/" + vY4;
                   break;
              case "MM\/DD\/YY" :
                   vData = vMonth + "\/" + vDD + "\/" + vY2;
                   break;
              case "MM-DD-YYYY" :
                   vData = vMonth + "-" + vDD + "-" + vY4;
                   break;
              case "MM-DD-YY" :
                   vData = vMonth + "-" + vDD + "-" + vY2;
                   break;
              case "DD\/MON\/YYYY" :
                   vData = vDD + "\/" + vMon + "\/" + vY4;
                   break;
              case "DD\/MON\/YY" :
                   vData = vDD + "\/" + vMon + "\/" + vY2;
                   break;
              case "DD-MON-YYYY" :
                   vData = vDD + "-" + vMon + "-" + vY4;
                   break;
              case "DD-MON-YY" :
                   vData = vDD + "-" + vMon + "-" + vY2;
                   break;
              case "DD\/MONTH\/YYYY" :
                   vData = vDD + "\/" + vFMon + "\/" + vY4;
                   break;
              case "DD\/MONTH\/YY" :
                   vData = vDD + "\/" + vFMon + "\/" + vY2;
                   break;
              case "DD-MONTH-YYYY" :
                   vData = vDD + "-" + vFMon + "-" + vY4;
                   break;
              case "DD-MONTH-YY" :
                   vData = vDD + "-" + vFMon + "-" + vY2;
                   break;
              case "DD\/MM\/YYYY" :
                   vData = vDD + "\/" + vMonth + "\/" + vY4;
                   break;
              case "DD\/MM\/YY" :
                   vData = vDD + "\/" + vMonth + "\/" + vY2;
                   break;
              case "DD-MM-YYYY" :
                   vData = vDD + "-" + vMonth + "-" + vY4;
                   break;
              case "DD-MM-YY" :
                   vData = vDD + "-" + vMonth + "-" + vY2;
                   break;
              default :
                   vData = vMonth + "\/" + vDD + "\/" + vY4;
    vData = vY4vMonthvDD ;
    //vData = vDD"."vMonth"."vY4;
         return vData;
    function Build(p_item, p_month, p_year, p_format) {
         var p_WinCal = ggWinCal;
         gCal = new Calendar(p_item, p_WinCal, p_month, p_year, p_format);
         // Customize your Calendar here..
         gCal.gBGColor="white";
         gCal.gLinkColor="black";
         gCal.gTextColor="black";
         gCal.gHeaderColor="darkgreen";
         // Choose appropriate show function
         if (gCal.gYearly)     gCal.showY();
         else     gCal.show();
    function show_calendar() {
              p_month : 0-11 for Jan-Dec; 12 for All Months.
              p_year     : 4-digit year
              p_format: Date format (mm/dd/yyyy, dd/mm/yy, ...)
              p_item     : Return Item.
         p_item = arguments[0];
         if (arguments[1] == null)
              p_month = new String(gNow.getMonth());
         else
              p_month = arguments[1];
         if (arguments[2] == "" || arguments[2] == null)
              p_year = new String(gNow.getFullYear().toString());
         else
              p_year = arguments[2];
         if (arguments[3] == null)
              p_format = "MM/DD/YYYY";
         else
              p_format = arguments[3];
         vWinCal = window.open("", "Calendar",
              "width=300,height=250,status=no,resizable=no,top=100,left=100");
         vWinCal.opener = self;
         ggWinCal = vWinCal;
         Build(p_item, p_month, p_year, p_format);
    Yearly Calendar Code Starts here
    function show_yearly_calendar(p_item, p_year, p_format) {
         // Load the defaults..
         if (p_year == null || p_year == "")
              p_year = new String(gNow.getFullYear().toString());
         if (p_format == null || p_format == "")
              p_format = "MM/DD/YYYY";
         var vWinCal = window.open("", "Calendar", "scrollbars=yes");
         vWinCal.opener = self;
         ggWinCal = vWinCal;
         Build(p_item, null, p_year, p_format);

  • Planning function to change date field value in layout

    Hello experts,
                          I have 1 BPS layout with 2 date fields ( Start date, End date ). With a filter conditions, set of data comes in BPS layout on execution and 2 date fields also contain some value...I want to change values of these 2 dates...both the date fields are char infoobjects..in BPS layout, in planning function I got only 1 function ( Repost function ) to change the value of char infoobject based on some condition. but date field value is not the status field...i want to enter new date instead of old date..if i right exit function in that also i can change only keyfigs values..so please help me to solve this problem..
    Thanks & Regards,
    Priyanka Joshi

    Hi Priyanka,
    As of now master data planning is not so flexibly supported.
    Still u can refer the below link which is enhancement of standard Repost function,and can be used to change master data.
    [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10d2b273-0e12-2c10-fab3-a34bde559f92]
    As far as my knowledge goes u cannot directly input date in rows.
    regards,
    Rajendra

  • MaxLength="10" Character Count Limit in a Data Field

    Hello,
    Below is the syntax I'm using trying to get a data field ( MyField ) in my panel to have a maximum allowance of 10 characters.
    This syntax is not doing anything to limit the count. Do you know what I have wrong in the line below?
    <xmp_property name="MyField" category="external" label="$$$/Custom/Property/MyField Input_Label= My Field:" type="text" maxLength="10" ui:width="50%" ui:mru="true"/>

    Hi Jacob,
    here a short example with char and string.
    DATA: ST TYPE STRING.
    DATA: CH(250).
    START-OF-SELECTION.
      ST = 'I am a String with an % Character'.
      SEARCH ST FOR '%'.
      WRITE: / SY-SUBRC, sy-fdpos.
      CH = 'I am a Char with an % Character'.
      SEARCH CH FOR '%'.
      WRITE: / SY-SUBRC, sy-fdpos.
    Regards, Dieter

  • NCo 3.02 crashes when invoking functions that return a date field

    I'm using NCo 3.02 (.NET 4 target framework) with Visual Studio 2010.
    When I invoke a function that returns date fields (like BAPI_SALESORDER_GETLIST) NCo crashes with the following message:
    SAP.Middleware.Connector.RfcTypeConversionException: Cannot convert DOCDATE....
    Below is the code I'm using:
    Dim customer_orderAPI As IRfcFunction = ecc.Repository.CreateFunction("BAPISALESORDER_GETLIST")
    customer_orderAPI.SetValue("CUSTOMER_NUMBER", "0000020000")
    customer_orderAPI.SetValue("SALES_ORGANIZATION", "ARCO")
    customer_orderAPI.SetParameterActive("MATERIAL", False)
    customer_orderAPI.SetParameterActive("DOCUMENT_DATE", False)
    customer_orderAPI.SetParameterActive("DOCUMENT_DATE_TO", False)
    customer_orderAPI.SetParameterActive("PURCHASE_ORDER", False)
    customer_orderAPI.SetParameterActive("TRANSACTION_GROUP", False)
    customer_orderAPI.SetParameterActive("PURCHASE_ORDER_NUMBER", False)
    customer_orderAPI.SetParameterActive("MATERIAL_EVG", False)
    customer_orderAPI.Invoke(_ecc)                ' >>>>  I receive the error in this line
    Dim table As IRfcTable = customer_orderAPI.GetTable("SALES_ORDERS")
    Dim returnCode As String = customer_orderAPI.GetStructure("RETURN").GetString("TYPE")
    If (returnCode.Equals("E") Or returnCode.Equals("A")) Then
    Console.WriteLine(customer_orderAPI.GetStructure("RETURN").GetString("MESSAGE"))
    Else
    Console.WriteLine("*********** SUCCESS **********")
    Console.WriteLine("Number of orders is .", table.RowCount)
    End If
    Does anyone know what is the issue and how to fix it?

    I'm using NCo 3.02 (.NET 4 target framework) with Visual Studio 2010.
    When I invoke a function that returns date fields (like BAPI_SALESORDER_GETLIST) NCo crashes with the following message:
    SAP.Middleware.Connector.RfcTypeConversionException: Cannot convert DOCDATE....
    Below is the code I'm using:
    Dim customer_orderAPI As IRfcFunction = ecc.Repository.CreateFunction("BAPISALESORDER_GETLIST")
    customer_orderAPI.SetValue("CUSTOMER_NUMBER", "0000020000")
    customer_orderAPI.SetValue("SALES_ORGANIZATION", "ARCO")
    customer_orderAPI.SetParameterActive("MATERIAL", False)
    customer_orderAPI.SetParameterActive("DOCUMENT_DATE", False)
    customer_orderAPI.SetParameterActive("DOCUMENT_DATE_TO", False)
    customer_orderAPI.SetParameterActive("PURCHASE_ORDER", False)
    customer_orderAPI.SetParameterActive("TRANSACTION_GROUP", False)
    customer_orderAPI.SetParameterActive("PURCHASE_ORDER_NUMBER", False)
    customer_orderAPI.SetParameterActive("MATERIAL_EVG", False)
    customer_orderAPI.Invoke(_ecc)                ' >>>>  I receive the error in this line
    Dim table As IRfcTable = customer_orderAPI.GetTable("SALES_ORDERS")
    Dim returnCode As String = customer_orderAPI.GetStructure("RETURN").GetString("TYPE")
    If (returnCode.Equals("E") Or returnCode.Equals("A")) Then
    Console.WriteLine(customer_orderAPI.GetStructure("RETURN").GetString("MESSAGE"))
    Else
    Console.WriteLine("*********** SUCCESS **********")
    Console.WriteLine("Number of orders is .", table.RowCount)
    End If
    Does anyone know what is the issue and how to fix it?

  • Count records based on detail row containing a null date field

    i need to count the no of rows where a date field is null and print the result in each group footer. the formula isnull works well in details section  but not when I create a running total to count records where evaluate condition is based on a formula and when i test isnull(field) ?
    works in detail section:
    Global NumberVar numOpen;
    if (IsNull({db.DateField}))
    then numOpen := numOpen + 1;
    does not work in group footer?
    IsNull({db.DateField})

    Abhilash Kumar wrote:
    Well, what database are you reporting off and how did you insert a NULL value to the date column?
    In my case, I have worked with Oracle, Access, and now SQL.,
    and have used several different versions of Crysal (but never XI)
    I/we don't put anything into the date...  the field is simply empty and I use 
    IsNull({datefield})
    also for numbers (&currency)
    IsNull({numberfield})
    For text fields I now use
    IsNull({textfield}) or {textfield} not equal ""
    as SQL is a little funny about the empty text fields. Sometimes one works and sometimes the other so I use both.
    Debi

  • Price reference date field is not editable in ML81N copy function

    Hello Everyone,
    When we create a Service entry sheet via the copy function in ML81N, we notice that the Price Reference date field (ESSR-LBLDT) is display only.   Is there anyway we can make this an optional (editable) field.   We tried looking in the configuration for the screen layout but could not find anything that would change this.
    Thanks,
    Hoonaid

    Hello Basrai,
    The service entry sheet (SES) is always posted with teh PO price. No new price determination is carried out in the SES.
    That's why the field ESSR-LBLDT cannot be changed in ML81N.
    You can make use of the user exit EXIT_SAPLMLSR_010 to change this behaviour. See the function module documentation for more info.
    Regards,
    Purnima.

  • Discoverer 2000 : Problem in sorting date field on report

    Hello,
    I am not able to sort on date field on report
    it is giving error as
    ( illegal operation).

    Thanks Savitha.
    I found one more way of making that code work, just want to share this.
    If we add the following statement, the same code works without having to add the time part along with date.
    "DBMS_XMLSave.setdateformat(updctx, 'yyyy-MM-dd');"
    note the format is case sensitive. Instead of MM, if you give 'mm' it won't work, it uses java format.

  • Need to Programmatically Set IRR Filter on Date Field Due to APEX 4.1 Bug

    There may be another work around but, here is the problem that we are encountering...
    We have a huge table that is partitioned on a DATE field and an IRR that reports on this table. By default, we want to show the most recent 3 days of data. There is a built-in filter for "is in the last 3 Days." Sounds Great! Unfortunately APEX generates the code using TIMESTAMP rather than DATE functions. As a result of this, the query does not perform partition pruning and, as a consequence, it is doing a full table scan which takes forever. Note the use of the "LOCALTIMESTAMP" function in the query that is generated by APEX for this filter:
    SELECT   "BUSINESS_DATE",
             COUNT ( * ) OVER () AS apxws_row_cnt
      FROM   (SELECT   *
                FROM   (SELECT   *
                          FROM   position_delta_his p) r
               WHERE   ("BUSINESS_DATE" BETWEEN *LOCALTIMESTAMP*
                                                - NUMTOYMINTERVAL (:APXWS_EXPR_1,
                                                                   'year')
                                            AND  *LOCALTIMESTAMP*)) r
    WHERE   ROWNUM <= TO_NUMBER (:APXWS_MAX_ROW_CNT)If, instead, APEX used the SYSDATE function, as the underlying column is a DATE, this returns instantly, after partition pruning.
    SELECT   "BUSINESS_DATE",
             COUNT ( * ) OVER () AS apxws_row_cnt
      FROM   (SELECT   *
                FROM   (SELECT   *
                          FROM   position_delta_his p) r
               WHERE   ("BUSINESS_DATE" BETWEEN *SYSDATE*
                                                - NUMTOYMINTERVAL (:APXWS_EXPR_1,
                                                                   'year')
                                            AND  *SYSDATE*)) r
    WHERE   ROWNUM <= TO_NUMBER (:APXWS_MAX_ROW_CNT)
    The bug is that APEX should base the underlying function on the data type of the filtered column.
    As a work around, if we create a filter where BUSINESS_DATE >= '4/13/2012' (three business days ago), again, this returns instantaneously. The issue is that we can only set this filter by using the APEX GUI. We need to be able to:
    1. Determine the date for 3 business days ago
    2. Set this as the default filter.
    I tried creating a BEFORE HEADER PL/SQL page process but, it does not appear to be having any effect. Here is that code:
    DECLARE
        ldt_Filter DATE;
        CURSOR lcsr_GetMaxBusinessDate IS
            SELECT Max(BUSINESS_DATE)
            FROM POSITION_DELTA_HIS;
        DAYS_AGO CONSTANT NUMBER := 3;       
    BEGIN
        APEX_UTIL.IR_CLEAR( :APP_PAGE_ID );
        OPEN lcsr_GetMaxBusinessDate;
        FETCH lcsr_GetMaxBusinessDate INTO ldt_Filter;
        CLOSE lcsr_GetMaxBusinessDate;
        ldt_Filter := ( Trunc( ldt_Filter ) - 3 );
        APEX_UTIL.IR_FILTER( p_page_id       => :APP_PAGE_ID,
                             p_report_column => 'BUSINESS_DATE',
                             p_operator_abbr =>'GTE',
                             p_filter_value  => TO_CHAR( ldt_Filter, 'YYYYMMDDHH24MISS' ) );
    END;Can anyone tell me:
    1. How to set this filter programmatically (also needs to be displayed on the page so the user can see the current filter...as if it were created via the GUI) ***OR***
    2. Some other work around for this issue..
    Thanks,
    -Joe

    Actually, now that I look further, I don't think it is going to work to simply set the filter programmatically. The end user can still click the column heading where they are only given the choice of the LOCALTIMESTAMP based filters. If they pick one, the page is going to be out to lunch for them.
    We really need some other fix. We really need a way to actually address the underlying issue.
    -Joe

  • Bizare date field behavior in an Oracle database.

    I have this bizare data problem quering an oracle date field.
    Look at these two result sets.
    Missing Two records.:
    COUNTY_CD
    CONAME
    FILE_DATE
    TRANSMISSIONS
    RECORDS
    NO_ERROR_RECORDS
    ERROR_RECORDS
    TOTAL_ERRORS
    03   
    AMADOR                    
    07-NOV-11            
    10                
    405               
    396               
    9                 
    9                 
    10   
    FRESNO                    
    07-NOV-11            
    1                 
    204               
    200               
    4                 
    4                 
    16   
    KINGS                     
    07-NOV-11            
    3                 
    1296              
    1110              
    186               
    194               
    20   
    MADERA                    
    07-NOV-11            
    1                 
    552               
    535               
    17                
    17                
    51   
    SUTTER                    
    07-NOV-11            
    1                 
    43                
    5                 
    38                
    38                
    WHERE
            r.file_date BETWEEN TO_DATE('2011-11-07 00:00:00','YYYY-MM-DD HH24:MI:SS')
                            AND TO_DATE('2011-11-07 15:00:00','YYYY-MM-DD HH24:MI:SS')
    All Expected records
    COUNTY_CD
    CONAME
    FILE_DATE
    TRANSMISSIONS
    RECORDS
    NO_ERROR_RECORDS
    ERROR_RECORDS
    TOTAL_RECORDS
    03   
    AMADOR                    
    07-NOV-11            
    10                
    405               
    396               
    9                 
    9                 
    10   
    FRESNO                    
    07-NOV-11            
    1                 
    204               
    200               
    4                 
    4                 
    16   
    KINGS                     
    07-NOV-11            
    3                 
    1296              
    1110              
    186               
    194               
    20   
    MADERA                    
    07-NOV-11            
    1                 
    552               
    535               
    17                
    17                
    50   
    STANISLAUS                
    07-NOV-11            
    2                 
    17002             
    7165              
    9837              
    10028             
    51   
    SUTTER                    
    07-NOV-11            
    1                 
    43                
    5                 
    38                
    38                
    WHERE
            r.file_date BETWEEN TO_DATE('2011-11-07 00:00:00','YYYY-MM-DD HH24:MI:SS')
                            AND TO_DATE('2011-11-07 15:59:59','YYYY-MM-DD HH24:MI:SS')
    Can anybody tell me why looking for recrods by the FILE_DATE field that has no time portion, it is a 'DATE' data type field, would produce different results based on different time parameters passed into the WHERE clause?  This has me really confused and I just can not figure out why this behavior changes which makes me leary to trust a work around solution of just apending random time data to the where clause.
    Below it the entire SQL query from the origanal source.
    SELECT
    r.county_cd,
    c.coname,
    COUNT(unique r.file_name) AS transmissions,
    count(r.use_no) AS records,
    count(r.use_no) - count(e.use_no) AS no_error_records,
    count(e.use_no) AS error_records,
    sum(e.errors) AS total_errors
    FROM
    raw_pur r INNER JOIN
    pur_lookup l
    ON (r.use_no = l.use_no AND r.year = l.seq_year) LEFT OUTER JOIN
    SELECT
    year,
    use_no,
    count(use_no) AS errors
    FROM
    errors
    WHERE
    NOT (error_code = 17 OR error_code = 20 OR error_code = 72 OR error_code = 52 OR
    (error_code = 12 AND error_type = 'POSSIBLE') OR
    (error_code = 69 AND error_type = 'POSSIBLE') OR
    (error_code = 37 AND error_type = 'POSSIBLE') OR
    (error_code = 39 AND error_type = 'POSSIBLE'))
    GROUP BY
    year,
    use_no
    ) e ON (r.year = e.year AND r.use_no = e.use_no) INNER JOIN
    county c
    ON (r.county_cd = c.county_cd)
    WHERE
    r.file_date BETWEEN <cfqueryparam value="#form.fromDate#" cfsqltype="cf_sql_date">
    AND <cfqueryparam value="#form.toDate#" cfsqltype="cf_sql_date">
    GROUP BY
    r.county_cd,
    c.coname
    ORDER BY
    r.county_cd

    Thanks guys.  The errant records in question do indeed have time portions to the values in the FILE_DATE field, though they are not supposed to and all the other records do not.
    Thanks for the suggestion to use the to_char function to suss out the actual, full values. 
    It is always so useful to have helpful IDEs (Oracle SQL Developer in my case) that hide information from you.  I was using this to look at the field expecting to find time data, but was not seeing it.  I guess SQL developer is formatting the date-time value for me since this is a date field.  How helpful in a debugging situation.
    Now to figure out why these records are in the database in this way in the first place.  Because they are not supposed to be.
    Again, thanks for the help.
    Ian

  • Sql count function in order by clause

    Post Author: krypton
    CA Forum: Data Connectivity and SQL
    Hi Guys
    Can i ask a quick question. I am trying to retrieve data remotely from a SQL Server via crystal reports.
    Within the Database Expert I have entered a SQL query to retrive the number of (call center) support calls raised by our customers:-
    Select `Primary_Company`, COUNT(`Calls`)From  `SPRT_Issue` GROUP BY  `Primary_Company`ORDER BY  COUNT(`Calls`) desc
    The customer's column is called 'Primary Company' and the calls they raise are in the 'Calls' column. the above is a normal sql query.
    However Crystal fails to run the query and generates an error message :-
    Failed to open a rowset. Details: 420: Driver&#93; Expected lexical element not found: <identifier>
    I dont understand why it wont run. In the ORDER BY clause if i replace field 'Calls' by the field 'Primary Company' then it works.
    I think the problem is that it wont accept the count function in the order by clause. which is what i want it to do i.e display the calls in descending order by each customer.
    Could someone tell me if there is a way around it.
    Thanks
    Krypton

    Post Author: krypton
    CA Forum: Data Connectivity and SQL
    Thanks Lynn
    I tried your suggestion. But there is one probelm.
    When i sort the data in descending order using the count(calls) field, the data is returned but the customer's name appears multiple times along with their calls raised.
    E.g, if customer Mark raised multiple calls i.e. 2, 5, and 10 calls, then the report will show
    Mark   2
    Mark  5
    Mark 10
    But is there a way to aggregate all the calls for mark and show them only once:
    such as Mark   17
    Thanks

  • Count() function with selective criteria?

    I'm struggling with what I would expect to be a fundamental reporting concept in CR.
    Suppose I have the following EMPLOYEE table:
    u2022 EMPLOYEE.ID
    u2022 EMPLOYEE.GENDER_CODE
    u2022 EMPLOYEE.MANAGER_FLAG
    I need to generate a statistical summary report containing the following:
    u2022 Total number of Employees
    u2022 Number of Male Employees
    u2022 Number of Management Employees
    This would be easy if I could just use a Count() function in the Function Workshop which
    contained selective criteria.  For example:  Count ({EMPLOYEE.GENDER_CODE} = 'M')
    But I can't figure out how to do this without getting a CR error message.
    Record Selection doesn't work, because I need the whole data set.
    Group Selection with Summaries doesn't work, because the gender and management
    attributes are not mutually exclusive.
    One solution that seems awkward to me is to create additional SQL commands in the
    Database Expert using COUNT(*) and WHERE criteria to get the number of Males
    and number of Managers.  But I have to believe that there is a better way.  Plus this
    approach causes problems elsewhere in my report.
    Am I missing something?
    Thanks,
    Bill

    Thanks Raghavendra!
    The good news is that I was able to create a "1 or 0" formula and then sum the resulting values.
    The bad news is that I'm only able to get this to work for part of my report.
    I am joining two tables.  As an example COMPANY and EMPLOYEE.
    I can use "1 or 0" formulas on all of the employee statistics.
    But I cannot do the same for company statistics, because the number of company records being assigned a 1 is being inflated by the join between the two tables.
    I have achieved a successful result by using Running Total Fields at the end of the report.
    But I want to place these summary statistics at the begining of my report.  (Such as Total Companies in the Western Region.)
    I tried to use "COMPANY.NAME = previous(COMPANY.NAME)" logic in my function, but then I was not allowed to summarize it.
    Any ideas?
    Thanks,
    Bill

Maybe you are looking for

  • Scroll One Page at a Time

    Using InDesign CS5 version 7, on a mac OS10.6.8 I would like to be able to scroll through a document one page at a time using my mouse scroll wheel. In some other programs there is a setting to scroll "continuously" or "by pages" - in the latter, eac

  • How do I correct General Printer error 0X610000f6 for a HP Officejet 6500

    The printer keeps throwing this erro message out.  How can I correct it.

  • Download Adobe LiveCycle Designer ES 9.0

    I got below error message while click on Edit in Adobe Pro XI. After some research I found that the form was created using "Adobe LiveCycle Designer ES 9.0" application ( File-->Properties ). Now I started to download LiveCycle to modify this form bu

  • Schema validation in WL 9.1

    I am using WL 9.1 and i get the following errors while validating the schema [webddr] XMLParser - file:///C:/dev/artfrank_Core_4_2_int/WFX_Core/core/stagi ng/resource/auth-service-war/WEB-INF/weblogic.xml (L2,C61): Document root elemen t "weblogic-we

  • Read char from text file

    I am trying to read in questions, possible answers and the correct answer from a text file. The text file looks like this 1. what is blah blah blah? a. something b. something else c. none of the above b where the last line of the file is a character