ASO help with MDX

We have recently upgraded from 9.3.1 to 11.1.1.3, and my MDX formula no longer works. Any help/input would be appreciated.
Original Formula that worked in 9.3.1:
Sum(CrossJoin({[PAT_DAY_NUM]}, {[DAY 1]:[DAY 2]}))
If I write it like this in 11.1.1.3 it works (replacing the : with a ,):
Sum(CrossJoin({[PAT_DAY_NUM]}, {[DAY 1],[DAY 2]}))
As you can see I'm summing across a range of days and I have several nested statements like this depending on the day. Did something change in this release? I can't find anything about this and am working on a fix before we upgrade Production.
Thanks!

Yep, that's the confusion. The statement with the ':' results with nothing, but the statement changed to use a ',' provides the correct value.
Thanks for the reply and I'll keep digging!

Similar Messages

  • Need some help with MDX formula

    Hello, I am not finding any good documentation on MDX formulas, there is a specific one that I need some help with....could someone please elaborate what exactly does this formula mean? thanks.
    (MEASURES.[SIGNEDDATA],
    CLOSINGPERIOD([%TIMEDIM%].
    [%TIMEBASELEVEL%]))

    If new MEASURE gets added to Measure's table , in BPC Client , etools->client Options-> Refresh Dimensions should get the new measure into the CurrentView .IF not try  etools->client Options-> Clear Local application information .
    Formula 2 : 
    (MEASURES.SIGNEDDATA,
    CLOSINGPERIOD(%TIMEDIM%.
    %TIMEBASELEVEL%))
    This formula is used to retrieve AST & LEQ account values.
    If current time member is at monthlevel ,ie  ClosingPeriod of  2011.FEB is  the current member it self ,and would retrieve 2011.FEB value.
    If Current time member is at quarter level then ClosingPeriod of 2011.Q1 is 2011.Mar  ,and would retrieve 2011.MAR value.
    If Current time member is at year level then ClosingPeriod of 2011.TOTAL is 2011.DEC  ,and would retrieve 2011.DEC value.
    Formula 1 :
    MEASURES.SIGNEDDATA
    Irrespective of the level of the Time , MEASURES.SIGNEDDATA would retrieve current Time member value.This formula is used to retrieve INC & EXP account values
    if current time member is at month level,2011.FEB , 2011.FEB value is retrieved.
    if current time member is at quarter level,2011.Q1 , 2011.Q1(JANFEBMAR)  value is retrieved.
    if current time  member is at year level,2011.TOTAL , 2011.TOTAL(JAN,FEB,....,DEC)  value is retrieved.
    Hope this helps.

  • Help with MDX script

    Hi , I am trying to develop an MDX script to clear data from a region/slice in ASO cube. I have to select only certain projects with a similarity in their name. I could not find any key word for that , So I have added a UDA for those projects and used the UDA keyword to group them. The script is below:
    alter database BSC_RPT.BSC_RPT Clear data in CurrentTuple( [Scenario].[Actual], [DataView].[datasource], [Years].[FY11],
    [Version].[Current], [Account].[Accountname] ,(Uda ( [Project], "PLN")))
    This script gives me an error "Syntax error at 'Current Tuple'. Please suggest me how to proceed with this. It would be of a great help if you can help me resolve this issue.
    Thanks,
    Ramy

    969637 wrote:
    Hi , I am trying to develop an MDX script to clear data from a region/slice in ASO cube. I have to select only certain projects with a similarity in their name. I could not find any key word for that , So I have added a UDA for those projects and used the UDA keyword to group them. The script is below:
    alter database BSC_RPT.BSC_RPT Clear data in CurrentTuple( [Scenario].[Actual], [DataView].[datasource], [Years].[FY11],
    [Version].[Current], [Account].[Accountname] ,(Uda ( [Project], "PLN")))
    Since the UDA function can return multiple values, you cant use a tuple for this, you would have to crossjoin the set of members of the UDA with the tuple of the other dimensions. You would also not use the currenttuple just the tuple itself
    something like 'crossjoin ({( [Scenario].[Actual], [DataView].[datasource], [Years].[FY11], [Version].[Current], [Account].[Accountname]),({Uda ( [Project], "PLN")}))'
    Note, I did this offhand the syntax may be a little off ot parens and brackets might be off as well

  • Need help with MDX formula to sum months

    I was able to use Gary C's suggestion to sum daily data for 90 days with the following formula.
    SUM( TAIL( TUPLERANGE(
    ([FY_2006], [01/01]), ([Scenario].CurrentMember,
    [Time].CurrentMember) ), 90 ))
    This formula works great - even when crossing different years in the Scenario dimension.
    I'm now trying to sum the prior 3 months using a similar TupleRange command:
    SUM( TAIL( TUPLERANGE(
    ([FY_2006], [JAN]), ([Scenario].CurrentMember,
    [Time].CurrentMember) ), 3 ))
    I'm running into an issue due to additional parents in the time dimension. January and February of the current year are pulling data from the children of another parent in the Time dimension as opposed to Nov and Dec from prior year.
    My Time dimension is setup as follows:
    Time
    |
    |-Total Year
    | |-Jan
    | | |-01/01
    | | |-01/02...
    | |.
    | |-Feb... Dec (each month has days as children)
    |.
    |.
    |-QTDs
    | |- Various parents and shared children
    |.
    |-Weeks
    | |-FY08_Weeks
    | |.
    | |-FY09_Weeks
    Using the previous TupleRange command, when I retrieve data for Jan it retrieves data from the following members:
    Jan
    FY08_Weeks
    FY09_Weeks
    Any suggestions on how I can write the MDX formula so my 3 Month formula pulls in the correct members? (That is, it should only pull in members from the 'Total Year' parent.)

    In ASO architecture, if you want to aggregate these multiplied values you probably want to do the multiplication prior to loading so the sum of the products rolls up. Right now, you can't have the multiplication done in MDX and then have ASO aggregate. It's mostly a performance concern; you can do the multiplication and aggregation in one formula if you want.<BR><BR>The basic multiplication is just<BR> [Standard Material Per Unit] * [Units Sold]<BR><BR>To aggregate, you need to wrap in additional clauses. I've attached code here so you can see it with indenting- I believe that consistent indenting helps catch a lot of syntax errors.<BR><BR>You will also need to assign the formula to a new member (account or otherwise).<BR><BR>If you only want to see the values at level-0 and you don't want them aggregated, it's very easy:<BR><BR>iif (<BR> [Product].CurrentMember.[LEVEL_NUM] = 0,<BR> [Standard Material Per Unit] * [Units Sold],<BR> MISSING<BR>)<BR><BR><BR>

  • Help with MDX formula

    Hi All,
    I have MDX formula which is validating but not producing result, can you guide me in right direction to fix the issue.
    What i am trying to accomplish is?
         View 1 (Raw)                    View 2 (Adjusted)     
    ACT     FCST     Calc          ACT     FCST     Calc
    X     X     X          X     X     X
    0     0     0          0     X     0
    0     X     X          X     0     0
    X     0     X          0     0     0
    If ACT or FCST is '0' in RAW it has replace everything with '0' in Adjusted. else copy Actual and Forecast values to adjusted.
    "case when is ([Raw],[Actuals]) = '0' or ( [Adjusted],[ Forecast]) = '0' then '0' else ([Actuals] = [Raw],[Actuals]) and [ Forecast] = ([Raw],[Forecast])" this is my formula which is validated but i don't see any result.
    Help will be very mush appreciated.
    Thanks in Advance
    Vic..

    Hi,
    I am not sure which member you are trying to write that formula on. It should be on 'Adjusted' member as that is what you want to calculate. I am not sure how your formula got validated - You can try any of these formula or modify your formula on similar lines and it should work.
    CASE WHEN ([Raw], [Act])= 0 OR ([Raw], [Fcst]) = 0
    THEN
    0
    ELSE
    [Raw]
    END
    IIF ( ([Raw], [Act])= 0 OR ([Raw], [Fcst])= 0 , 0 , [Raw])
    Regards,
    Sunil
    Edited by: sunil k on Jan 17, 2013 2:28 PM

  • Help with MDX

    <p>Hi!  My Time Dimension is as follow.  What is the bestway of writting the MDX formula to get Last year value?  Theformula below works, but there must be a better way of writtingthis.  <img src="i/expressions/face-icon-small-sad.gif" border="0"></p><p> </p><p>Time Periods</p><p>    Year_2005</p><p>        Q1_2005</p><p>            JAN_2005</p><p>            FEB_2005</p><p>            APR_2005</p><p>        Q2_2005</p><p>        ...   </p><p>    Year_2006</p><p>        ...</p><p> </p><p>/*get prior year information*/<br>IIF(Is([Time Periods].CurrentMember,[Time Periods].[Date NotAvailable]),0,<br>IIF(IsGeneration([Time Periods].CurrentMember, 2),<br>/*If the genaration of the Time period is 2, equal to year, get theprior year valueThen*/<br>(Sum(crossjoin({[Value].[Cost Value]}, {RelMemberRange([TimePeriods].CurrentMember,1,0)})) - [Value].[Cost Value])<br>,/*ELSEIF QTR*/<br>IIF(IsGeneration([Time Periods].CurrentMember, 3),<br>(Sum(crossjoin({[Value].[Cost Value]}, {RelMemberRange([TimePeriods].CurrentMember,4,0)})) - (Sum(crossjoin({[Value].[CostValue]}, {RelMemberRange([Time Periods].CurrentMember,3,0)}))))<br>,/*ELSEIF MONTH*/<br>IIF(IsGeneration([Time Periods].CurrentMember, 4),<br>(Sum(crossjoin({[Value].[Cost Value]}, {RelMemberRange([TimePeriods].CurrentMember,12,0)})) - (Sum(crossjoin({[Value].[CostValue]}, {RelMemberRange([Time Periods].CurrentMember,11,0)}))))<br>,/*else*/0<br>/*end if*/<br>)<br><br>/*end if*/<br>)<br>/*END IF*/<br>))</p>

    I'll give it a try, but I'm not sure why you sum() a range and then subtract a more recent piece from that range- sounds equivalent to just taking the prior period's value.<BR><BR>Note that when you really need switch logic, you can use the CASE construct to avoid nested IIFs.<BR><BR>Also, note that two following do the same thing, but one of them may be easier to read and write:<BR><BR>Sum(<BR> crossjoin(<BR> {[Value].[Cost Value]}, <BR> {RelMemberRange([Time Periods].CurrentMember,1,0)}<BR> )<BR>)<BR><BR>Sum(<BR> {RelMemberRange([Time Periods].CurrentMember,1,0)}, <BR> [Value].[Cost Value]<BR>)<BR><BR><BR>With all that said, I think the following would work fine for you.<BR><BR>Check out here for a lot of information, including direct answers to your question too: <a target=_blank class=ftalternatingbarlinklarge href="http://www.amazon.com/gp/product/0471748080/sr=8-3/qid=1140727972/ref=pd_bbs_3/103-7612743-4413436?%5Fencoding=UTF8">(MDX Solutions book at Amazon)</a><BR><BR>HTH<BR><BR><BR>

  • Help with MDX Query Result weirdness

    Hi,
    Feels like I'm posting a question every other day, hope I don't wear out my welcome.
    So I have a working query :
    with
    MEMBER Measures.[EmailCount] as IIF(ISEMPTY([Measures].[Tran Count]), 0 ,[Measures].[Tran Count])
    MEMBER Measures.AdvGroupTotal as
    SUM (EXISTING ([Dim IFA Details].[Parent Key].[Adviser Group] ,
    [Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]) , Measures.[Amount])
    MEMBER [Measures].[Income Range] as
    CASE
    WHEN Measures.AdvGroupTotal <= 10000 THEN '0-10000'
    WHEN Measures.AdvGroupTotal <= 50000 THEN '10001-50000'
    WHEN Measures.AdvGroupTotal <= 100000 THEN '50001-100000'
    WHEN Measures.AdvGroupTotal <= 200000 THEN '100001-200000'
    else '200000-'
    end
    SELECT { [Measures].[Amount] , Measures.[EmailCount], Measures.AdvGroupTotal, measures.[income range]}
    ON COLUMNS,
    [Dim IFA Details].[Parent Key].[Adviser Group].Members * [Dim Date].[Fiscal Quarter].children
    having Measures.AdvGroupTotal > 100
    on rows
    FROM [Income and Emails Cube]
    where
    ([Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]
    Great, gives me back what I expect
    So now I'm thinking, actually let's lose the Adviser Groups and just have it by Fiscal Quarter and Income Range, dropping that I lose my income range and get this:
    I figured its related to Income Range being a measure, so I tried making income range a calculated member of a dimension
    with
    MEMBER Measures.[EmailCount] as IIF(ISEMPTY([Measures].[Tran Count]), 0 ,[Measures].[Tran Count])
    MEMBER Measures.AdvGroupTotal as
    SUM (EXISTING ([Dim IFA Details].[Parent Key].[Adviser Group] ,
    [Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]) , Measures.[Amount])
    MEMBER [Dim IFA Details].[Parent Key].[Income Range] as
    CASE
    WHEN Measures.AdvGroupTotal <= 10000 THEN '0-10000'
    WHEN Measures.AdvGroupTotal <= 50000 THEN '10001-50000'
    WHEN Measures.AdvGroupTotal <= 100000 THEN '50001-100000'
    WHEN Measures.AdvGroupTotal <= 200000 THEN '100001-200000'
    else '200000-'
    end
    SELECT { [Measures].[Amount] , Measures.[EmailCount], Measures.AdvGroupTotal}
    ON COLUMNS,
    ( [Dim Date].[Fiscal Quarter].children, [Dim IFA Details].[Parent Key].[Income Range] )
    on rows
    FROM [Income and Emails Cube]
    where
    ([Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]
    This then came back with some unexpected results:
    The amount and email count are now the Income Range and still didnt get the income grouping I want.
    What am I doing wrong?
    Thanks for reading.
    Regards
    Jon

    Hi JLJ1976,
    According to your description, you have some issue when changing the measure into a dimension member. Right?
    In this scenario, the reason why you get the incorrect result set is you make a measure into dimension member. In your query, the Income Range is based on the Measure AdvGroup Total, and the AdvGroup Total value depends on how your dimension slice the cube.
    If you slice the cube on date members, you will get a much smaller AdvGroup Total value. So the Measure XXX return dynamic values because it always based on dimension slicer. For dimension members, they should be static values appear on axis to slice the cube
    data on a data. So you should make the Income Range into a calculated measure because it's based on a Quarter sliced Measure. Otherwise, it will return null value (in your query, it's the else part result) because you are measuring a measure.
    For more explanation about dimensions and Measures, please refer to links below:
    Measures and Measure Groups
    Introduction to Dimensions (Analysis Services - Multidimensional Data)
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Help with ASO function

    Hi all,
    I need some help with ASO mdx function.
    Avg({Leaves([Employees].Currentmember)}, [Calculated_Field]). This will give me the average for Calculated_Field for all levels of Employees. But i want to add more dimensions like Region and year.
    Please advice how can I achieve this.
    Thanks
    Andy

    you have to use cross join in order to add more dimension members to the formula.This will give you some idea
    Re: Writing formula in Outline??????
    Regards,
    RSG

  • Need help with NULL values in Crosstables

    Hello everybody,
    I need some help with NULL values and crosstables. My issue is the following:
    I have a query (BW - MDX-Query) that gives me turnover measures for each month. In Crystal Reports I choose crosstable to display this whereby I put all month in columns and all turnover-measures in rows. Each month that has a value (measures are not empty) is chown in the crosstables rows. So far so good. The problem occures when there are month that actually have no values (measures are empty). In that case these months are not chown in columns. But I need CR to display these columns and show the value 0. How can I do that?

    Hi Frank,
    Cross tab shows the data based on your column and these column fields are grouped and based on the group it will show your summaries. 
    If there is no data for any of your group it will not display that group.  In this case you will have to create a standard report which should look like cross tab and to get zero values you need to write formulas .
    Example if you want to display Moth wise sales :
    if Month() = 01 Then
    sum() else 0
    Now this formula will check if your month is Jan, then it will sum up the values else it will display zero value. 
    This is possible only through standard report not with Cross Tab.
    Thanks,
    Sastry

  • Help in Mdx query

    Consider below is the dimesion
    Evry project will have one last project id which is projectid only
    Project id  Last ProjectID
    1                   4
    2                   6
    3                  null
    4                  null
    5                  null
    6                  null
    below if the fact
    projectid Amont
    1              100
    2               200
    3                300
    4                 500
    I need calculated measure to get amount of corresponding last project id for each project
    When I use column Project id -> for project id 1 my calc measure  shud give me 500
    I can not calculate it in DSV.
    I need to calculate it with MDX only
    I tried taking last project id member value and pass as string to project id member -- but its not working
    Can any one please help in writing MDX exp for the same

    Hi ,
      Please try the below calculated measure 
    sum(StrToMember(" [Dim Project].[Project ID].&[" + [Dim Project].[Last Project ID].Currentmember.member_caption + "]" ),[Measures].[Amount])
    Best Regards Sorna

  • Misunderstanding querying Essbase data with MDX

    Can someone help with a fundamental misunderstanding of mine when selecting data from Sample.basic with MDX.
    The Essbase Adminstrators guide says:
         "The intersection of one member from one dimension with one member from each of the other
         dimensions represents a data value."
    Yet the following example from the same guide succeeds in returning what seems to be a meaningless value without any context.
    select
    {Jan}
    on columns
    from sample.basic
    Jan
    8024
    Surely any number/value only has meaning when associated with a member from each of the other dimensions?
    And
    Why has Essbase chosen that particular value for Jan as opposed to any other that I can see in source file Calcdat.txt?
    Thanks
    Edited by: user12133311 on 03-Oct-2012 06:12

    Exactly right, as can be seen from an Excel retrieve
            Measures     Product     Market     Scenario
    Jan     8024               
    Any dimensions not specified are retrieved at top of dimension.
    Edited by: dwelden on Oct 3, 2012 8:50 AM

  • ASO - Time Functionality - MDX for Shared Members

    Hi
    I have create an ASO cube with two time hierarchies and I am currently trying to get the WTD To Date Functionality working.
    The hierarchies are as follows
    Hier1: Year->HalfYear->Quarter->Month->Week->Date (Date is stored)
    Hier2: Year->HalfYear->Quarter->Month->Date (Date is shared)
    In Hierarchy 1 the month of Jun contains the following days 27/05 - 30/06 due to the way the weeks fall.
    In Hierarchy 2 the month of Jun contains the following days 01/06 - 30/06 as this shows the actual days in the month of June.
    My problem is, in hierarchy 2, the shared members are taking on the WTD to values of the hierarchy 1 and my MDX is not recalculating for shared members.
    Is it possible to recalculate for shared members?
    Hierarchy1
    Hier1 Value - WTD
    Hierarchy 2
    Hier2 Value - WTD
    Jun-Wk1-27/05/13
    100
    May-27/05/13
    100
    Jun-Wk1-28/05/13
    200
    May-28/05/13
    200
    Jun-Wk1-29/05/13
    300
    May-29/05/13
    300
    Jun-Wk1-30/05/13
    400
    May-30/05/13
    400
    Jun-Wk1-31/05/13
    500
    May-31/05/13
    500
    Jun-Wk1-01/06/13
    600
    Jun-01/06/13
    600 (This should reset back to 100 but instead it is taking on the value from Hierarchy 1 because it is shared)
    Jun-Wk1-02/06/13
    700
    Jun-02/06/13
    700 (This should be the sum of 01/06 +02/06 but instead it is taking the value of Hierarchy 1)
    Below is a sample of the MDX I have
    WHEN IsLeaf([Calendar].[ReportingYear].CurrentMember) AND Count ( Intersect (Descendants([ReportingYear]) ,{ [Calendar].[ReportingYear].CurrentMember  })) > 0
    THEN
    sum((ANCESTOR( [Calendar].[ReportingYear].CurrentMember,1).Firstchild: [Calendar].[ReportingYear].CurrentMember), [View].[Periodic])
    WHEN IsLeaf([Calendar].[CalendarYear].CurrentMember) AND Count ( Intersect (Descendants([CalendarYear]) ,{ [Calendar].[CalendarYear].CurrentMember  })) > 0
    THEN
    /*1*/
    sum((ANCESTOR([Calendar]. [CalendarYear].CurrentMember,1).Firstchild:[Calendar]. [CalendarYear].CurrentMember))
    Thanks
    Michelle

    If you use the IsUda function within an IIF statement then you would have to specify a true part and a false part.IIF (Search condition,true part,false part)

  • ASO Cube with attributes very slow in retrieval

    Hi,
    I have a ASO Cube with 5 base dimensions and 8-9 attributes on the entity dimension. I have only 5-6 measures, which do the averages and counts based on the 40 day period. Howere, the data is loaded at the 15 minute increment
    Entity
    Date - (date-time, lowest level being date)
    TIme - ( 15 minute time for the full 24 hour period, has a attribute assocuated with oit)
    LocationType
    Measures.
    The sample formula is
    IIF(Islevel([Locations].CurrentMember,0), Avg(CrossJoin({[Measure].[Sale]},{[DateDim].CurrentMember.lag(40):[DateDim].CurrentMember})),Missing)
    Is there a way, i can have this calculated as a part of the script? DO you suggest i create a BSO, to do these calculations and pass on the result.
    In OBIEE, the report is to display the followung based on the date input.
    Entity Gen7, Entity Gen 6..... Entity Gen 2, Attr1, Attr2, Attr3, Attr4, Attr5, Attr6, Attr7, Measures

    2 things I would look at
    1st - I don't know how much performance you would get out of this, but I'm not clear why you are using a crossjoin in your MDX, it seems unnecessary and may cause more overhead. The following should work, you could also try using IsLeaf instead and see if that is any faster
    IIF(Isleaf([Locations].CurrentMember),
    Avg({[DateDim].CurrentMember.lag(40):[DateDim].CurrentMember},
    [Measure].[Sale], INCLUDEEMPTY)
    2nd - your problem mostly revolves around the fact that you are running a 40 member sum/avg for every member you are querying. It also sounds like the average is at the Day level, which is not level 0. So for all forty days, ASO also has to calc the results of each of those days. Remember that aggregations only get you so far, you should really think of everything in ASO as dynamic and that is why you can see what you have set up is not going to work that well, it is too calc intensive.
    I don't know how practical this is, but to get this to work fast you would probably need to break out the 15 minute increments below the day level to another dimension so the day level becomes a stored level zero member. The 15 minute increment dimension should also be stored. If at all possible you would want to have an alternate stored hierarchy with the 40 days you want to base the average on. Enable alternate hierarchies in your aggregations, then change your MDX calc to be based on the parent of the 40 day hierarchy divided by 40. That would be fast.
    I suppose you could opt to not break out the 15 minute increments and just have the shared hierarchy made up of the 15 minute increments that are below the 40 days. That would still give you a good stored subtotal that with some query hints you could get optimized.

  • New custom dimension objects with MDX

    Hi all,
    on my OLAP universe is possible to create a new custom dimension objects with MDX sintax?
    For example I need a dimesnion with this descriptions: "ACTIVE"; "INACTIVE", "NULL"
    I need thi description in universe because would like to use this inreport prompt
    then in report I use a variable: if "ACTIVE" then [import1] else if "INACTIVE" then [import2] else [import3]

    BEx: No.
    MSAS: Maybe, but I don't know how.
    Hope that helps!

  • Help with if statement in cursor and for loop to get output

    I have the following cursor and and want to use if else statement to get the output. The cursor is working fine. What i need help with is how to use and if else statement to only get the folderrsn that have not been updated in the last 30 days. If you look at the talbe below my select statement is showing folderrs 291631 was updated only 4 days ago and folderrsn 322160 was also updated 4 days ago.
    I do not want these two to appear in my result set. So i need to use if else so that my result only shows all folderrsn that havenot been updated in the last 30 days.
    Here is my cursor:
    /*Cursor for Email procedure. It is working Shows userid and the string
    You need to update these folders*/
    DECLARE
    a_user varchar2(200) := null;
    v_assigneduser varchar2(20);
    v_folderrsn varchar2(200);
    v_emailaddress varchar2(60);
    v_subject varchar2(200);
    Cursor c IS
    SELECT assigneduser, vu.emailaddress, f.folderrsn, trunc(f.indate) AS "IN DATE",
    MAX (trunc(fpa.attemptdate)) AS "LAST UPDATE",
    trunc(sysdate) - MAX (trunc(fpa.attemptdate)) AS "DAYS PAST"
    --MAX (TRUNC (fpa.attemptdate)) - TRUNC (f.indate) AS "NUMBER OF DAYS"
    FROM folder f, folderprocess fp, validuser vu, folderprocessattempt fpa
    WHERE f.foldertype = 'HJ'
    AND f.statuscode NOT IN (20, 40)
    AND f.folderrsn = fp.folderrsn
    AND fp.processrsn = fpa.processrsn
    AND vu.userid = fp.assigneduser
    AND vu.statuscode = 1
    GROUP BY assigneduser, vu.emailaddress, f.folderrsn, f.indate
    ORDER BY fp.assigneduser;
    BEGIN
    FOR c1 IN c LOOP
    IF (c1.assigneduser = v_assigneduser) THEN
    dbms_output.put_line(' ' || c1.folderrsn);
    else
    dbms_output.put(c1.assigneduser ||': ' || 'Overdue Folders:You need to update these folders: Folderrsn: '||c1.folderrsn);
    END IF;
    a_user := c1.assigneduser;
    v_assigneduser := c1.assigneduser;
    v_folderrsn := c1.folderrsn;
    v_emailaddress := c1.emailaddress;
    v_subject := 'Subject: Project for';
    END LOOP;
    END;
    The reason I have included the folowing table is that I want you to see the output from the select statement. that way you can help me do the if statement in the above cursor so that the result will look like this:
    emailaddress
    Subject: 'Project for ' || V_email || 'not updated in the last 30 days'
    v_folderrsn
    v_folderrsn
    etc
    [email protected]......
    Subject: 'Project for: ' Jim...'not updated in the last 30 days'
    284087
    292709
    [email protected].....
    Subject: 'Project for: ' Kim...'not updated in the last 30 days'
    185083
    190121
    190132
    190133
    190159
    190237
    284109
    286647
    294631
    322922
    [email protected]....
    Subject: 'Project for: Joe...'not updated in the last 30 days'
    183332
    183336
    [email protected]......
    Subject: 'Project for: Sam...'not updated in the last 30 days'
    183876
    183877
    183879
    183880
    183881
    183882
    183883
    183884
    183886
    183887
    183888
    This table is to shwo you the select statement output. I want to eliminnate the two days that that are less than 30 days since the last update in the last column.
    Assigneduser....Email.........Folderrsn...........indate.............maxattemptdate...days past since last update
    JIM.........      jim@ aol.com.... 284087.............     9/28/2006.......10/5/2006...........690
    JIM.........      jim@ aol.com.... 292709.............     3/20/2007.......3/28/2007............516
    KIM.........      kim@ aol.com.... 185083.............     8/31/2004.......2/9/2006.............     928
    KIM...........kim@ aol.com.... 190121.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190132.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190133.............     2/9/2006.........2/9/2006.............928
    KIM...........kim@ aol.com.... 190159.............     2/13/2006.......2/14/2006............923
    KIM...........kim@ aol.com.... 190237.............     2/23/2006.......2/23/2006............914
    KIM...........kim@ aol.com.... 284109.............     9/28/2006.......9/28/2006............697
    KIM...........kim@ aol.com.... 286647.............     11/7/2006.......12/5/2006............629
    KIM...........kim@ aol.com.... 294631.............     4/2/2007.........3/4/2008.............174
    KIM...........kim@ aol.com.... 322922.............     7/29/2008.......7/29/2008............27
    JOE...........joe@ aol.com.... 183332.............     1/28/2004.......4/23/2004............1585
    JOE...........joe@ aol.com.... 183336.............     1/28/2004.......3/9/2004.............1630
    SAM...........sam@ aol.com....183876.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183877.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183879.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183880.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183881.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183882.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183883.............3/5/2004.........3/8/2004.............1631
    SAM...........sam@ aol.com....183884.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183886.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183887.............3/5/2004.........3/8/2004............     1631
    SAM...........sam@ aol.com....183888.............3/5/2004.........3/8/2004............     1631
    PAT...........pat@ aol.com.....291630.............2/23/2007.......7/8/2008............     48
    PAT...........pat@ aol.com.....313990.............2/27/2008.......7/28/2008............28
    NED...........ned@ aol.com.....190681.............4/4/2006........8/10/2006............746
    NED...........ned@ aol.com......95467.............6/14/2006.......11/6/2006............658
    NED...........ned@ aol.com......286688.............11/8/2006.......10/3/2007............327
    NED...........ned@ aol.com.....291631.............2/23/2007.......8/21/2008............4
    NED...........ned@ aol.com.....292111.............3/7/2007.........2/26/2008............181
    NED...........ned@ aol.com.....292410.............3/15/2007.......7/22/2008............34
    NED...........ned@ aol.com.....299410.............6/27/2007.......2/27/2008............180
    NED...........ned@ aol.com.....303790.............9/19/2007.......9/19/2007............341
    NED...........ned@ aol.com.....304268.............9/24/2007.......3/3/2008............     175
    NED...........ned@ aol.com.....308228.............12/6/2007.......12/6/2007............263
    NED...........ned@ aol.com.....316689.............3/19/2008.......3/19/2008............159
    NED...........ned@ aol.com.....316789.............3/20/2008.......3/20/2008............158
    NED...........ned@ aol.com.....317528.............3/25/2008.......3/25/2008............153
    NED...........ned@ aol.com.....321476.............6/4/2008.........6/17/2008............69
    NED...........ned@ aol.com.....322160.............7/3/2008.........8/21/2008............4
    MOE...........moe@ aol.com.....184169.............4/5/2004.......12/5/2006............629
    [email protected]/27/2004.......3/8/2004............1631
    How do I incorporate a if else statement in the above cursor so the two days less than 30 days since last update are not returned. I do not want to send email if the project have been updated within the last 30 days.
    Edited by: user4653174 on Aug 25, 2008 2:40 PM

    analytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
    CASE
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
    Incorporating either of these into your query should assist you in returning the desired results.

Maybe you are looking for

  • Does the Serial Number work for Mac and Windows?

    I Purchased Photoshop Elements 12 it came with a Windows and a Mac Disc.  My Son just got a Mac.  I was wondering if I can install Elements on his Computer using the serial number I received from the Redemption code that I used  for my Windows Laptop

  • Problem Instanciating BO - No default attribute defined for the object type

    Hello Experts, I am instanciating the BO BUS2038 to ZBUS2038 and when I click in u201Cto implementedu201D and follow u201Cto releasedu201D the message No default attribute defined for the object type is appearing! Can anybody help, please?

  • Preview freezes up when opening a pdf

    Preview freezes when I open a pdf. I have to do a force quit to move on. Help

  • What is wrong with my simple class program?

    Ok, I'm writing a simple class called 'Frog', which will keep track of the position enter by a user. The program will ask for the initial position for the frog. It will then ask for how many steps it want the frog to jump. Then it will output the new

  • Applets 4ever

    hi guys, I am making an applet which reads a file from the directory which is kept in the web.Then the user alters the file and sends it back. does anyone knows how to read a file from a server and how to write back? Thanks