Record selection based on month in 1 years worth of data.

Hello,
I have a table that has 1 years worth of data up until the current month (June 07 to June 08).  I'd like to create a record selection that displays a range of months worth of data, say November 07 to February 08.
The requirement is that the parameter be only in month format, ie. user selects November and February, no years.
The problem I'm finding is that I can't do a number range where the start is greater than the end, Start=11 End=2. A date range doesn't seem to be an option either.  Do I need to do a couple of parameters with a formula?
Thanks in advance for your suggestions,
Murray

Hey Murray,
If Start>End then
      Year(Start) = Year(End) - 1
...at least, that's the idea. 
so, if Start is "Dec" then it's assigned the number 12,
and if End is "Jan" then it's assigned the number 1.
so
if Start (12) > End (1) then
         the year for Start is 1 year less than the year for End.
Of course, you have the static parameter with "Jan", "Feb", etc.
and the Case statement to evaluate the incoming parameter value.
Is that what you mean?
The Panda
...and yes, I think you need a formula with a couple parameters
Edited by: pandabear on Jun 25, 2008 3:54 PM

Similar Messages

  • Populate a years worth of dates into the calander

    hi all
    i am a member of a sailing club and with the start of the season a couple of month away i was wondering if there is an app or quick method of entering the dates and time of the races in to the calander.  i could put them in one at a time but that would take nearly as long as doing the races.
    thanks
    Solved!
    Go to Solution.

    Well you could try and sync your phone calendar with something like Outlook, as for the Playbook, there is no calendar yet, it is to be part of the new OS2 that is coming sometime this month
    Using the Playbook and the Z10 and the Z30 and loving them
    Martin

  • Retrieving remaning months of current year from current month

    Hi,
    I would like te retrieve the remaining months of current year from current date.
    I can I achieve this?
    For example today is 23 july 2012.
    Then I would like to have:
    August
    September
    October
    November
    December
    Thanks,
    Diana

    Something like this:
    with generate_months as (select to_char(add_months(trunc(sysdate, 'mm'), level -1), 'fmMonth', 'nls_date_language=english') months, level lvl
                             from   dual
                             connect by level <= months_between(add_months(trunc(sysdate, 'yyyy'), 12), trunc(sysdate, 'mm')))
    select months
    from   generate_months
    where  lvl != 1;
    MONTHS  
    August  
    September
    October 
    November
    December Edited by: Boneist on 23-Jul-2012 16:42
    Fixed the query so that it wouldn't show any months when sysdate is in December.
    Also, this is a duplicate of retrieving remaning months of current year from current month (shame I didn't spot that before adding my solution! Oh well...)

  • Selecting records based on month and year parameters

    Hi. I have a sql 2008 r2 stored procedure which needs modifying to return the data based on a start / end month and year.
    It's a large SP so I'll summarise - It accepts four parameters:
    @StartMonth NVARCHAR(10)
    @StartYear NVARCHAR(4)
    @EndMonth NVARCHAR(10)
    @EndYear NVARCHAR(4)
    The current WHERE clause is:
    WHERE ta.TimeByDay BETWEEN '01' + '-' + ltrim(LEFT(@StartMonth, 3)) + '-' + @StartYear
    AND convert(nvarchar,datediff(day, ta.TimeByDay, dateadd(month, 1, ta.TimeByDay))) + '-' + ltrim(LEFT(@EndMonth, 3)) + '-' + @EndYear
    Example of input parameters:
    @StartMonth = N'January',
    @StartYear = N'2014',
    @EndMonth = N'February',
    @EndYear = N'2014',
    Result:
    The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.
    (1 row(s) affected)
    However it executes correctly if we do either of the following:
    1) Run the SQL direct in QA and type in January and February rather than passing in the Start/End Month parameters
    2) As you can see we use the following datediff call to get the number of days per month. IF I replace this with '28', or '31' for example the query also runs (oddly number 1 above then also runs by executing the SP):
    convert(nvarchar,datediff(day, ta.TimeByDay, dateadd(month, 1, ta.TimeByDay)))
    How do I update the WHERE clause to return records between a start/end month and year?
    I'm a day on this so any help appreciated.
    Thanks

    create function NthDayOfMonth (@year int, @month smallint, @weekday varchar(15), @nth smallint)
    returns datetime
    as
    begin
    declare @the_date datetime, @c_date datetime, @cth smallint
    set @cth = 0
    set @c_date = convert(varchar,@year)+'-'+convert(varchar,@month)+'-01'
    while month(@c_date) = @month
    begin
    if datename(weekday,@c_date) = @weekday set @cth = @cth + 1
    if @cth = @nth and datename(weekday,@c_date) = @weekday set @the_date = @c_date
    set @c_date = dateadd(day,1,@c_date)
    end
    return @the_date
    end
    go
    create function Dates(@date datetime)
    returns @table table
    now datetime,
    today datetime,
    Month_start datetime,
    Month_end datetime,
    Prev_Month_Start datetime,
    Prev_Month_End datetime,
    Week_Start datetime,
    Week_End datetime,
    Prev_Week_Start datetime,
    Prev_Week_End datetime,
    Quarter_Start datetime,
    Quarter_End datetime,
    Prev_Quarter_Start datetime,
    Prev_Quarter_End datetime,
    Year_Start datetime,
    Year_End datetime,
    Prev_Year_Start datetime,
    Prev_Year_End datetime,
    Month_End_TS datetime,
    Prev_Month_End_TS datetime,
    Week_End_TS datetime,
    Prev_Week_End_TS datetime,
    Quarter_End_TS datetime,
    Prev_Quarter_End_TS datetime,
    Year_End_TS datetime,
    Prev_Year_End_TS datetime,
    Year smallint,
    Month smallint,
    Day smallint,
    Month_Name varchar(15),
    Day_Name varchar(15),
    WD smallint
    as
    begin
    if @date IS NULL set @date = getdate()
    insert into @table
    select
    @date as now,
    convert(datetime,convert(varchar,@date,101)) as today,
    dateadd(day,0-day(@date)+1,convert(datetime,convert(varchar,@date,101))) as Month_Start,
    dateadd(day,-1,dateadd(month,1,dateadd(day,0-day(@date)+1,convert(datetime,convert(varchar,@date,101))))) as Month_end,
    dateadd(month,-1,dateadd(day,0-day(@date)+1,convert(datetime,convert(varchar,@date,101)))) as Prev_Month_start,
    dateadd(day,-1-day(@date)+1,convert(datetime,convert(varchar,@date,101))) as Prev_Month_End,
    dateadd(day,1-datepart(dw,@date),convert(datetime,convert(varchar,@date,101))) as Week_Start,
    dateadd(day,7-datepart(dw,@date),convert(datetime,convert(varchar,@date,101))) as Week_End,
    dateadd(day,-6-datepart(dw,@date),convert(datetime,convert(varchar,@date,101))) as Prev_Week_Start,
    dateadd(day,0-datepart(dw,@date),convert(datetime,convert(varchar,@date,101))) as Prev_Week_End,
    convert(datetime,convert(varchar,year(@date)) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,@date)-1)*3)+1),2)+'-01') as quarter_start,
    dateadd(day,-1,dateadd(quarter,1,convert(datetime,convert(varchar,year(@date)) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,@date)-1)*3)+1),2)+'-01'))) as quarter_end,
    convert(datetime,convert(varchar,year(dateadd(quarter,-1,@date))) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,dateadd(quarter,-1,@date))-1)*3)+1),2)+'-01') as prev_quarter_start,
    dateadd(day,-1,dateadd(quarter,1,convert(datetime,convert(varchar,year(dateadd(quarter,-1,@date))) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,dateadd(quarter,-1,@date))-1)*3)+1),2)+'-01'))) as prev_quarter_end,
    dateadd(day,1-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101))) as Year_Start,
    dateadd(year,1,dateadd(day,0-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101)))) as Year_End,
    dateadd(year,-1,dateadd(day,1-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101)))) as Prev_Year_Start,
    dateadd(year,-1,dateadd(year,1,dateadd(day,0-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101))))) as Prev_Year_End,
    dateadd(ms,-3,dateadd(day,0,dateadd(month,1,dateadd(day,0-day(@date)+1,convert(datetime,convert(varchar,@date,101)))))) as Month_End_Ts,
    dateadd(ms,-3,dateadd(day,-1-day(@date)+2,convert(datetime,convert(varchar,@date,101)))) as Prev_Month_End_TS,
    dateadd(ms,-3,dateadd(day,8-datepart(dw,@date),convert(datetime,convert(varchar,@date,101)))) as Week_End_TS,
    dateadd(ms,-3,dateadd(day,1-datepart(dw,@date),convert(datetime,convert(varchar,@date,101)))) as Prev_Week_End_TS,
    dateadd(ms,-3,dateadd(day,0,dateadd(quarter,1,convert(datetime,convert(varchar,year(@date)) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,@date)-1)*3)+1),2)+'-01')))) as quarter_end_TS,
    dateadd(ms,-3,dateadd(day,0,dateadd(quarter,1,convert(datetime,convert(varchar,year(dateadd(quarter,-1,@date))) +'-'+ right('0'+convert(varchar,((datepart(QUARTER,dateadd(quarter,-1,@date))-1)*3)+1),2)+'-01')))) as prev_quarter_end_TS,
    dateadd(ms,-3,dateadd(year,1,dateadd(day,1-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101))))) as Year_End_TS,
    dateadd(ms,-3,dateadd(day,1-day(@date),dateadd(month,1-month(@date),convert(varchar,@date,101)))) as Prev_Year_End_TS,
    Year(@date) as Year,
    Month(@date) as Month,
    Day(@Date) as Day,
    datename(month,@Date) as Month_Name,
    datename(WEEKDAY,@date) as Day_Name,
    datepart(weekday,@date) as WD
    return
    end
    go
    create function Holidays(@year smallint)
    returns @table table
    date datetime,
    type varchar(10),
    name varchar(25)
    as
    begin
    insert into @table
    select convert(datetime,convert(varchar,@year)+'-01-01') as date,'Holiday' as type ,'New Years Day' as name UNION ALL
    select dbo.NthDayOfMonth(@year,2, 'Monday',3),'Holiday','Family Day' UNION ALL
    select dateadd(d,0-case when datepart(weekday,convert(varchar,@year)+'-05-25') in (1,2) then 5+datepart(weekday,convert(varchar,@year)+'-05-25') else datepart(weekday,convert(varchar,@year)+'-05-25')-1 end, convert(varchar,@year)+'-05-25') ,'Holiday','Victoria Day' UNION ALL
    select convert(varchar,@year)+'-01-07' ,'Holiday','Canada Day' UNION ALL
    select dbo.NthDayOfMonth(@year,8, 'Monday',1),'Holiday','Civic Holiday' UNION ALL
    select dbo.NthDayOfMonth(@year,9, 'Monday',1),'Holiday','Labour Day' UNION ALL
    select dbo.NthDayofMonth(@year,10,'Monday',2),'Holiday','Thanksgiving' UNION ALL
    select convert(varchar,@year)+'-11-11' ,'Holiday','Rememberance Day'UNION ALL
    select convert(varchar,@year)+'-12-25' ,'Holiday','Christmas Day' UNION ALL
    select convert(varchar,@year)+'-12-26' ,'Holiday','Boxing Day'
    update @table
    set date =
    case when name != 'Boxing Day' and datepart(weekday,date) = 7 then dateadd(day,2,date)
    when name != 'Boxing Day' and datepart(weekday,date) = 1 then dateadd(day,1,date)
    when name = 'Boxing Day' and datepart(weekday,date) = 7 then dateadd(day,2,date)
    when name = 'Boxing Day' and datepart(weekday,date) = 1 then dateadd(day,2,date)
    when name = 'Boxing Day' and datepart(weekday,date) = 2 then dateadd(day,1,date)
    else date
    end
    return
    end
    go
    Using these functions (in place of a calendar table) you could do something like this:
    DECLARE @forumTable TABLE (sales MONEY, saleDate DATE)
    INSERT INTO @forumTable (sales, saleDate)
    VALUES
    (123.45, '2014-01-05'),(678.90, '2014-01-06'),(111.21, '2014-01-07'),(314.15, '2014-01-08'),(161.71, '2014-01-09'),
    (819.20, '2014-02-05'),(212.22, '2014-02-06'),(324.25, '2014-02-07'),(262.72, '2014-02-08'),(829.30, '2014-02-09')
    SELECT SUM(f.sales), d.month_end
    FROM @forumTable f
    CROSS APPLY sandbox.dbo.dates(f.saleDate) d
    GROUP BY d.month_end

  • Last day of each month in a year based on a Input date?

    Hi all,
    I have a request from a customer who wants to have a yearly report created in BEx Query Designer which starts in January up to December and they want to have a Month To Date (MDT) and Year to Date (YTD) calculation of a key figure. This report will only show one year at the time based on the date the user give as input at the Variable Screen.
    This key figure should be calculated by using the last date of each month for input when performing the MTD and YTD calculation and summarizations.
    Example:
    January: 31.01.2008  Key Figure = 1000. MTD = 1000 and YTD = 1000
    February: 29.02.2008  Key Figure = 2500. MTD = (2500-1000) 1500 and YTD = 2500
    March: 31.03.2008  Key Figure = 6000. MTD =(6000-2500)=3500 and YTD = 6000
    Etcu2026.
    This means that I have to have a lot of hidden Key figures which gets restricted on the different month end dates and formulas to calculate the different MTD and YTD results for the months as the year progresses.
    The way I have solved it now is that I have a Customer Exit which gives me the Last day of last year (Exp: 31.12.2007) based on input date and use a Offset on the last day of last year date to get the different last dates of each month.
    Since we have a leap year (one extra day in February) this year, the offset to calculate the end month dates will be different for 2007 and next year (2009). This solution is not very flexible, and it will not give the correct MTD and YTD if the customer wants to go back to 2007 and off course next year (2009).
    One solution is to create 12 Customer Exits that gives me the different month end dates (January-December), and also takes in account leap year for February for the different years. These Exits will be based on the Input date the Customers put in at the variable screen.
    I would rather want to avoid making 12 new customer exits and want your advice and expertise to find out if this is possible in any other way (maybe with only 1 customer exit) to get the last date of each month based on an input date.
    Thanks for all your advices on beforehand.
    Regards
    Oddmar Lid

    Hi,
    Thanks for you replay and documentation, but it doesn't give me excatly the functionality I'm after. The only MTD calculation code the document provides is the calculation of the following functionality:
    "Month to Date (MTD) u2013 From the 1st of month to u201CKey Dateu201D - for current year." This doesn't give the the functionality I want, which is to retrieve a given vaule for a Key Figure for the last dates of the months in a year to calculate MTD and YTD.
    This way I have created the query is to have multiple hidden Key Figures that calculates the MTD and YTD.
    In Columns in Query Designer it will look something like this:
    Selection: MTD January--> Date = 31.01.2008, Key Figure (Always Show)
    Selection: YTD January --> Date= 31.01.2008, Key Figure (Always Show)
    Selection: MTD February --> Date= 29.02.2008, Key Figure (Always Hide)
    Formula: MTD February --> MTD February - MTD January (Always Show)
    Selection YTD February --> Date = 29.02.2008, Key Figure (Always Show)
    And so on....
    This is off course a simplified version, but it shows the core of the solution. What I want to achive here is that the dates used to get the Key Figures (last date of a month) is calculated as flexible as possible, so that the users can go back and forth in time without worrying about the leap year problem and so on. I have now used an offset from the last date of last year and this is good for all the normal years, but when it is a leap year the query will use wrong dates to get the key figure vaule for the last date of each month.
    Any ideas on how to achieve this without creating 12 different Customer Exit variables (one for each end date of each month)?
    Thanks
    Regards
    Oddmar Lid

  • I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. years each month.

    I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. year each month. I need to create a spreedsheet using the the Acutlas from the year-to-date and from last year-to-date, but need to report each month.

    Hi Tony,
    Answering your question would be easier given a screen shot of the source table and one of what you want the summary table to look like.
    Is the data you want for each month in a single cell o the source table, or does the summary table need to collect February's data (for example) from several cells and do some math with those numbers before presenting them on the summary table?
    Regards,
    Barry

  • Can i get month, quarterly, half yearly, yearly wise sales report basing on

    hi,
    sap gurus,
    good evening to all,
    how can i get month, quarterly, half yearly, yearly wise sales report basing on division and material.
    is there any std transaction code for that.
    customization is requried for that.
    regards,
    balaji.t
    09990019711

    Standard SAP SD Reports:=
    Statistic Group:
    Purpose u2013 To capture data for Standard Reports, we require to activate Statistic Group as under:
    --> Item category (Configuration)
    --> Sales document type (Configuration)
    --> Customer (Maintain in Master data)
    --> Material (Maintain in Master data)
    When you generate statistics in the logistics information system, the system uses the combination of specified statistics groups to determine the appropriate update sequence. The update sequence in turn determines for exactly which fields the statistics are generated.
    Configuration:
    IMG --> Logistics Information System (LIS) --> Logistics Data Warehouse --> Updating --> Updating Control --> Settings: Sales --> Statistics Groups -->
    1. Maintain Statistics Groups for Customers
    2. Maintain Statistics Groups for Material
    3. Maintain Statistics Groups for Sales Documents
    4. Assign Statistics Groups for Each Sales Document Type
    5. Assign Statistics Groups for each Sales Document Item Type .....
    All Standard Reports which are available are as under:
    SAP Easy Access: Information Systems -> Logistics -> Sales and distribution ->
    1. Customer -> Incoming orders / Returns / Sales / Credit memos / Sales activities / Customer master / Conditions / Credit Master Sheet
    2. Material -> Incoming orders / Returns / Sales / Credit memos / Material master / ...
    3. Sales organization -> Sales organization / Sales office / Sales employee
    4. Shipping point -> Deliveries / Returns
    5. SD documents -> Orders / Deliveries / Billing documents ...
    & so on.
    Regards,
    Rajesh banka

  • Select Expert Record. Last 6 months and week start date on Monday

    Hello,
    i am trying to use the select expert record to grab the last 6 months worth of data. I require the week start day to be a monday and end on a sunday.
    Can someone please provide some advice the best way to do this
    kind regards
    david

    Hello Abhilash,
    Once again thanks for your reply.
    Yes this is correct, when it goes back 6 months i need it to skip the days prior and begin on a monday as we are reporting on a mon-sunday basis.
    I have tried your formula Date field >= dateadd('m',-6,currentdate) and it seems to grab 6 months of data, but the group weeks are not grouping from Monday to Sunday...
    kind regards
    david
    Edited by: davitali on Dec 2, 2011 9:35 AM

  • Returning all the days in selected Month in a Year using Report Builder

    I am working Report Builder with SharePoint List Data Source. Report builder has to parameters Month and Year. If i select month as March and year as 2014 the report have to display
    March 1 2014 Saturday
    March 2 2014 Sunday
    March 3 2014 Monday
    March 31 2014 Monday
    Can any one help on this, do i have to write this in Dataset Property query, Report Builder Properties or calling any function.....!
    Appreciate if any example query. Thank you

    Hi SPBee,
    If the all fields are already returned by dataset with SharePoint List Data Source, we can directly add filters in your dataset to achieve your requirement.
    Expression: [Month]
    Operator: In
    Value: [@Month]
    Expression: [Year]
    Operator: In
    Value: [@Year]
    If you want to create a report that display the data as you post, we can create a function in SQL Server Management Studio as below:
    IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME ='CalendarTable1' AND ROUTINE_SCHEMA = 'dbo' AND ROUTINE_TYPE='FUNCTION')
    DROP FUNCTION dbo.CalendarTable1
    GO
    CREATE FUNCTION dbo.CalendarTable1
    @StartDate datetime,
    @EndDate datetime,
    @WeekDaysOnly bit = 0,
    @MonthStart bit=0
    RETURNS @CALENDAR TABLE
    Date datetime,
    [Monthname] varchar(20),
    [Dayname] varchar(20),
    [Day] int
    AS
    BEGIN
    ;With Calendar_CTE (Date,[Monthname],[Dayname],[Day])
    AS
    SELECT @StartDate,datename(Month,@StartDate),  DATENAME(dw,@StartDate), DATEPART(day,@StartDate)
    UNION ALL
    SELECT DATEADD(dd,1,Date),datename(month,DATEADD(dd,1,Date)),  DATENAME(dw,DATEADD(dd,1,Date)) ,
    DATEPART(day,DATEADD(dd,1,Date))
    FROM Calendar_CTE
    WHERE DATEADD(dd,1,Date) < = @EndDate
    INSERT INTO @CALENDAR
    SELECT Date,[monthname],[Dayname],[Day]
    FROM Calendar_CTE
    RETURN
    END
    Create two parameters start and end with Date/Time type in the report, then use the query like below in the dataset:
    SELECT * from dbo.CalendarTable1 (@start,@end,0,0)
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Returning  'Day' value based on month and year parameters

    Hi,
    Is there a code that would return an end of the month  Day value based on month and year parameters?
    For example if my parameters yield 9 or September for a month value and 08 or 2008 for the year value, can a formula generate a value of 30 (the last day of the given month in the specific year)?
    This way the formula would pick up the different last day of the month in February for the leap years.
    Thank you.
    Vic

    1. Open the formula workshop.
    2. From the Repository Custom Functions, under Crystal and then Date, RIGHT click on cdlastdayofmonth, click on ADD TO REPORT.
    3. Create a new formula, in the formula workshop, under FUNCTIONS, go down the list till you see "CUSTOM FUNCTIONS", expand that till you see cdlastdayofmonth.
    4. In your formula, type cdlastdayofmonth(currentdate)
    5. Save and close and display the formula in your report, you should see 11/30/2008.
    If you want just the day then modify the formula to:
    totext(day(cdlastdayofmonth(currentdate)),0,'','');
    since you have parameters for month and year, do this:
    totext(day(cdlastdayofmonth(date({?year},{?month},01))),0,'','');
    to give you the last day of the month.

  • CAML query to get itemcount from sharepoint list based on Month/Year

    Hi,
     I have a SharePoint list with date field. Now I wan't to get item count for each month in Fiscal Year using SP Services. Hence, need a CAML query to get item count . Any suggestions will be appreciated.
    Thanks in Advance.

    When you have your month, you'll need to calculate the first day and last day of the month and convert them to the ISO using to ISOString.
    startDate.toISOString();
    endDate.toISOString();
    function searchList(startDate, endDate) {
        var nURL = "/_vti_bin/lists.asmx";
        var soapEnv = "<?xml version=\"1.0\" encoding=\"utf-8\"?> \
                                 <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
                                  xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
                                  xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">
                                  <soap:Body> \
                                  <GetListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">
                                  <listName>{YourList}</listName> \
                                  <viewFields></viewFields> \
                                  <query><Query><Where><And><Geq><FieldRef Name='DateField'
    /><Value Type='DateTime'>" + startDate +"</Value></Geq><Leq><FieldRef Name='DateField'><Value Type='Datetime'>"+endDate+"</Leq></And></Where></Query></query> \
                                  <queryOptions><QueryOptions><ViewAttributes Scope='Recursive'/></QueryOptions></queryOptions>
                                  </GetListItems> \
                                      </soap:Body> \
                                  </soap:Envelope>";
        $.ajax({
            url: nURL,
            beforeSend: function(xhr) {
                xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListItems");
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processResults,
            contentType: "text/xml; charset=utf-8"
    function processResults(xData, status)
      var i;
       result = $(xData.responseText).find("z\\:row, row");
        if (result == undefined) {
            result = $(xData.responseXML).find("z\\:row, row");
        $(result).each(function(i, data) {
        //Magic   
          i++; 
        return i;
    Brandon James SharePoint Developer/Administrator

  • FM to get previous fiscal month/year and calendar month/year for a date.

    Hi All,
    I am having a requirement to extract some data based on either the previous fiscal month/year or the previous calendar month/year. There is no company code input to find the fiscal/calendar month/year.
    At selection screen, user can select either fiscal or calendar selection.
    Based on the selection, the data will be extracted.
    For the system date, we need to calculate previous fiscal month/year or previous calendar month/year and populate the calculated data back to the selection-screen.
    Can you one of you please suggest an FM to find previous fiscal month/year and previous calendar month/year.
    Thanks in Advance,
    Regards
    Gowthami

    Hi Gowthami,
    You can use following function module to calculate previous / next day or month or year.
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    =
            sign      = '-'
            years     =
          importing
            calc_date = .
    Here, you can give '-' to sign, if you want previous day / month / year.
    Here, you can give '+' to sign, if you want next day / month / year.
    And depending upon your requirement, you can pass suitable value to days / month / year.
    e.g. To calcualte last month,
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    = 1
            sign      = '-'
            years     =
          importing
            calc_date = wv_prev_month.
    so it will give '23-01-2008' . Then convert it in the required format as per your requirement using string function concatenate.
    Hope this help you.
    Regards,
    Anil

  • Retreive all records that fall in month by passing date

    This is more of an sql question. Is it possible to create a query that selects all records based for the month up to the day given in an sql Date without having to pass two separate dates(starting day of month and day of month to select up to)?
    public void getRecords(java.sql.Date aDate) {
    Something like:
    SELECT *
    FROM <table>
    WHERE <records in month up to> aDate
    return records;
    }

    This is going to be server specific, and I am going to give you MSSQL syntax.
    select * from mytable where datepart(m,mydate)=datepart(m,getdate()) and datepart(yy,mydate)=datepart(yy,getdate())
    I haven't tested this, but it should work.
    Please note that query is going to require a table scan. every record is going to have to be lloked at to see if it matches. If you have a lot of records, look for a better way.

  • The Record select is excluding rows

    The following record select formula, is not showing rows which we want to see. The user passes a month and year param and then we show the not sold
    for that month year as well as the previous month.
    However, we do want to show rows that did not sell for the entire year and even years back. This formula is only showing the rows that had some sales in the past 2years. It's better use for management to see all items not selling also years back to the last sale.
    if {?Month}=1 then
        (({SUMPRT.IQA01} =0  and {SUMPRT.IQYER#} = {?Year}) and ({SUMPRT.IQA12} =0  and {SUMPRT.IQYER#} = {?Year}-1))
    else if {?Month}=2 then
        ({SUMPRT.IQA01} =0 and {SUMPRT.IQA02} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=3 then
        ({SUMPRT.IQA02} =0 and {SUMPRT.IQA03} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=4 then
        ({SUMPRT.IQA03} =0 and {SUMPRT.IQA04} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=5 then
        ({SUMPRT.IQA04} =0 and {SUMPRT.IQA05} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=6 then
        ({SUMPRT.IQA05} =0 and {SUMPRT.IQA06} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=7 then
        ({SUMPRT.IQA06} =0 and {SUMPRT.IQA07} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=8 then
        ({SUMPRT.IQA07} =0 and {SUMPRT.IQA08} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=9 then
        ({SUMPRT.IQA08} =0 and {SUMPRT.IQA09} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=10 then
        ({SUMPRT.IQA09} =0 and {SUMPRT.IQA10} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=11 then
        ({SUMPRT.IQA10} =0 and {SUMPRT.IQA11} =0 ) and {SUMPRT.IQYER#} = {?Year}
    else if {?Month}=12 then
        ({SUMPRT.IQA11} =0 and {SUMPRT.IQA12} =0 ) and {SUMPRT.IQYER#} = {?Year}

    hi Paul,
    if you've got a situation where your query is not bringing back all combinations of the records that you want, and no combination of table joins (e.g. left outer or right outer) and record filter syntax gives you the results you need, then you may want to start thinking about creating a command object or stored procedure that produces / brings back those records.
    so, if your database does not include a value for product A sold in january 2014, then you may need to manufacture that record.
    this particular blog post will show you 3 different methods of bringing back product & month combinations.
    i hope this helps,
    jamie

Maybe you are looking for

  • Mail and Safari now fail to open following software update

    After running software update for my Macbook running 10.4.11, I restarted and tried to open Safari but the app crashed and sent an error report to apple. So, I then tried opening mail. Same thing happened. I then tried removing the preferences direct

  • Mac starts up from sleep on its own

    Every few months, my iMac will start up from sleep mode on its own. Why does it do this, and is it something to be worried about? I am  not touching the mouse or keyboard or using any remotely connected devices when this occurs. Thanks!

  • Exporting using Adobe Media Encoder broken

    I am trying to export a Premiere Pro CS4 sequence to a Microsoft DV AVI file.  The sequence includes a After Effects composition.  I was able to export an AVI from this same sequence one time before, but I'm getting the following error now: - Source

  • HELP, HELP, HELP, Problems using GridBagLayout with BorderLayout

    I have a BorderLayout for my application. I created a JPanel that has the following items added to it: 1)Button 2)VisualComponent 3)ControllerComponent The JPanel is then added to the WEST Pane of the BorderLayout. My problem is that I can not get my

  • Differnt problems after switching to Apple ID

    After being forced to switch my AOL account to an Apple account, I lost the remaining on my gift card.Now, when I enter the code, iTunes tells me that card has already been redeemed. But I had over $10 left on it!! And when I go into my account detai