BPC Logic with Condition on Record value

Hi all,
how can I apply a logic filtering by record value?
That is, with SELECT or WHEN/IS I can say "apply this logic only to those records where members of a certain dimension have a property with value X", right? What I would like to say is "apply this logic only to those records where members of a certain dimension have another record with value X".
Is that possible?
Thank you very much,
Rafael

Hi Rafael,
You can test on the value of another account before applying logic, below some example code how to achieve this. Don't forget to add this 'test' account to your memberset.
*when account.PROPNAME
*is <>""
    *when get(account=TESTACCOUNT)
    *is > 100
        *rec(account=account.propname)
    *endwhen
*endwhen
*commit
Hope this helps,
Alwin

Similar Messages

  • Creating UserMembersRule with conditions on the value of resource attribute

    Hi all.
    I am trying to create a UserMembersRule to be used for provisioning an Organization. This rule should select users with a given value for an attribute mapped in a distant Resource.
    For instance, it would select all users with "typeTest = test1" in the "Simu1" Resource. Most examples I have seen by now do this for the Waveset resource (querying attributes which are in the IDM Schema, not in distant Resources)
    Form the results I have had, I suppose the first syntax (in which the Rule returns a list of AttributeCondition) doesn't work in this case.
    I will still give you several syntax I tried to do this :
    PLEASE NOTE that I've added "<" characters before each <<s> and <</s> tag, to prevent these from being interpreted by the Forum engine...
    Syntax 1 :
    <Rule authType='UserMembersRule' id='#ID#Rule:CustomTestRule1' name='Custom Test Rule 1' primaryObjectClass='Rule'>
    <block trace='true' name='CustomTestRule1'>
    <list>
    <new class='com.waveset.object.AttributeCondition'>
    *<<s>accounts[Simu1].typeTest<</s>*
    <<s>equals<</s>
    <<s>type1<</s>
    </new>
    </list>
    </block>
    <MemberObjectGroups>
    <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
    </MemberObjectGroups>
    </Rule>
    Syntax 2 :
    <Rule authType='UserMembersRule' id='#ID#Rule:CustomTestRule1' name='Custom Test Rule 1' primaryObjectClass='Rule'>
    <block trace='true' name='CustomTestRule1'>
    <list>
    <new class='com.waveset.object.AttributeCondition'>
    *<<s>typeTest<</s>*<!--Note that typeTest is mapped in Simu1's configuration-->
    <<s>equals<</s>
    <<s>type1<</s>
    <</new>
    </list>
    </block>
    <MemberObjectGroups>
    <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
    </MemberObjectGroups>
    </Rule>
    Syntax 3 :
    <Rule authType='UserMembersRule' id='#ID#Rule:CustomTestRule1' name='Custom Test Rule 1' primaryObjectClass='Rule'>
    <block trace='true' name='CustomTestRule1'>
    <list>
    <new class='com.waveset.object.AttributeCondition'>
    *<<s>waveset.typeTest<</s>*
    <<s>equals<</s>
    <<s>type1<</s>
    </new>
    </list>
    </block>
    <MemberObjectGroups>
    <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
    </MemberObjectGroups>
    </Rule>
    Syntax 4 :
    <Rule authType='UserMembersRule' id='#ID#Rule:CustomTestRule1' name='Custom Test Rule 1' primaryObjectClass='Rule'>
    <block trace='true' name='CustomTestRule1'>
    <list>
    <new class='com.waveset.object.AttributeCondition'>
    *<<s>Simu1.typeTest<</s>*
    <<s>equals<</s>
    <<s>type1<</s>
    </new>
    </list>
    </block>
    <MemberObjectGroups>
    <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
    </MemberObjectGroups>
    </Rule>
    Then, since it didn't work, I tried the second syntax, in which the Rule returns a list of accountIds (in the form of "accountId:Resource") : as the examples on the web and in Waveset's documentation suggested, I queried the Resource with "com.waveset.ui.FormUtil.getResourceObjects".
    Syntax 5 :
    <Rule authType='UserMembersRule' id='#ID#Rule:CustomTestRule2' name='Custom Test Rule 2' primaryObjectClass='Rule'>
    <defvar name='Members'>
    <block trace='true' name='CustomTestRule2'>
    <defvar name='MembersNames'>
    <list/>
    </defvar>
    <dolist name='person'>
    <invoke class='com.waveset.ui.FormUtil' name='getResourceObjects'>
    <ref>context</ref>
    <<s>User<</s>
    <<s>Simu1<</s>
    <map>
    <<s>searchFilter<</s>
    <<s>
    (typeTest=type1)
    <</s>
    </map>
    </invoke>
    <append name='MembersNames'>
    <concat>
    <ref>person.waveset.accountId</ref>
    <<s>:Lighthouse<</s>
    </concat>
    </append>
    </dolist>
    <ref>MembersNames</ref>
    </block>
    </defvar>
    <ref>Members</ref>
    </Rule>
    This doesn't work, the "getResourceObjects" method returns null...
    Then I tried replacing the "searchFilter" option with a "searchAttrsToGet = typeTest" option, but this throws the following exception :
    com.waveset.util.WavesetException: Can't call method getResourceObjects on class com.waveset.ui.FormUtil
    ==> com.waveset.util.WavesetException: Unsupported option 'searchAttrsToGet'.
    However the "searchAttrsToGet" option is listed in the Javadoc of Sun IDM !
    I can't grasp why this doesn't work... Has any of you tried to do something similar, to give me an example ?
    Thanks,
    Alexis
    Edited by: user8989858 on Oct 4, 2010 3:56 AM

    This doesn't work, the "getResourceObjects" method returns null...The method responsible for listing objects in SimulatedResourceAdapter.java looks like this, sorry:
         public ArrayList listObjects(String type, Map options) {
             // ArrayList result = null;
             // return new ArrayList(_objects.keySet());
             return null;
         }

  • How to copy applications using script logic with conditions

    Hi,
    I have two copy data between application A to application B, but only i want to copy the March's Data of Application A. Dimensions are the same in both applications
    I'm going to use this script logic, ¿this script will work?
    *WHEN TIME
    *IS "2009.MAR"
    *DESTINATION_APP=B
    Thanks in advance
    Regards,
    Juan

    Hi all,
    Finally I solved the issue, the problem was that i haven't add this line in the script logic:
    TASK(Execute formulas,USER,%USER%)
    But now i need to pass in the script logic as an input: entity and time. Below is the code I prepare, it has no error but it doesn't work. ¿any idea?
    Thanks in advance
    Regards,
    Juan
    *SSIS PACKAGE *
    'DEBUG(ON)
    PROMPT(RADIOBUTTON,%CHECKLCK%,"Select whether to check work status settings when running logic.",1,{"Yes, check for work status settings before running logic","No, do not check work status settings"},{"1","0"})
    PROMPT(SELECTINPUT,,,"Please select entity and time to copy data from LegalAppNceu to LegalApp",%ENTITY_DIM%%TIME_DIM%)
    TASK(Execute formulas,USER,%USER%)
    TASK(Execute formulas,APPSET,%APPSET%)
    TASK(Execute formulas,APP,%APP%)
    TASK(Execute formulas,LOGICFILE,%APPPATH%..AdminApp%APP%CopyApplication.lgx)TASKTASK(Execute formulas,RUNMODE,1)
    TASK(Execute formulas,LOGICMODE,1)
    TASK(Execute formulas,CHECKLCK,%CHEKCLCK%)
    SCRIPTLOGIC
    *DESTINATION_APP=LEGALAPP
    *SKIP_DIM= COSTCENTER
    *WHEN ENTITY
    *IS "%ENTITY_DIM%"
    *WHEN TIME_DIM
    *IS "%TIME_DIM%"
    *REC(FACTOR=1)
    *ENDWHEN
    *ENDWHEN
    *COMMIT

  • Best logic to insert records with constant set of values.

    hi all,
    i am using Forms [32 Bit] Version 6.0.8.24.1 (Production).
    i have process type 'I' and 'E'.
    if process type = 'I' then i have to insert five records into table.
    "company,job type,serial,process type,value,created by,created on"
    here all columns will be having same value except value column what i have mentioned.
    that means for
    first record the valuecolumn = 'emp code',
    second record value = 'con no',
    third record value = 'weight',
    fourth record value = 'volume'
    fifth record value = 'pack type'
    Right now i am planning to do like
    k= 5--if process = 'I' else k = 6.
    n := 0;
    for 1..n loop
    n := n + 1;
    exit when n = k;
    if n = 1 then
    insert with value = 'emp code'
    elsif n = 2 then
    value = 'con no'
    end if;
    end loop
    n  := 0;
    k := 0;Is this is the best way or i do we have any better logic to do this?
    Please advise.
    Thanks..
    Edited by: GD on Sep 17, 2011 8:59 PM

    I have successfully inserted seven records in one form submit operation by looping through the command object execute method.
    However, the data that is being inserted by the command object is repetition of the first record and the command object is not taking any data from the text boxes for the second record onwards. In this I had used the isert record behavious generated by DW CS4 and modified it to suit my requirement. However, the data inserted in the first row is getting repeated in all the seven rows.
    Please help.
    Also advise if there are any free dreamweaver server side validation extensions available.

  • Issue with fetching a record from IHPA table with PARNR value as condition

    Hi All,
    I am trying to fetch a particular record from IHPA table where i am giving the OBJNR number, PARVW and PARNR as customer no. , But I am not getting any record  but if i will give OBJNR and PARVW it will generate a record with having same PARNR value.
    Example :
    case 1st :-
    when i am passing following values in IHPA table,
    OBJNR  = IE000000000010070910
    PRAVW = BP                 
    PARNR  = 620000562   
    it is not generating any record  
    case 2nd:-
    But if i will pass  
    OBJNR  = IE000000000010070910
    PRAVW = BP
    it will generate a record?(one row) which will include PARNR as same 620000562 along with other value.
    Q1 -  Why it's not generating in case 1st,
    Q2 - How I will resolve this issue ? as i have to link some table as EQUI -
    IHPA -
    VCKUN
    VCNUM ?
          I have written a code for this to join :
         SELECT A~EQUNR
           B~PARVW
           C~CCNUM
           D~CCNUM
           FROM EQUI AS A JOIN IHPA AS B ON AOBJNR = BOBJNR
           INNER JOIN VCKUN AS C ON BPARNR = CKUNNR
           INNER JOIN VCNUM AS D ON CCCNUM = DCCNUM
           APPENDING CORRESPONDING FIELDS OF TABLE IT_OBSO
           WHERE A~EQUNR IN S_EQN.
                 AND PARVW  = 'BP'.
          But it is not generating any record but when i am commenting the PARVW i am getting the mixed record of PARVW as (BP,SP,SH)
    Let me know if any more clarification required.
    Highly appreciate your help
    Thanks & Regards
    Shaw

    Hi Santosh,
    Thanks for your quick response.
    But I am Sorry, I already checked with putting Zero before PARNR.
    The issue is still as it is.
    Thanks
    Shaw

  • Problem with Purchase Info Record Condition Data ( ME11)

    Hi all,
    I am trying post Data for Purchase Info Records with Conditions data.
    I am using a standard Batch Input Method ( LSMW).
    Object 0060
    Method 0000
    Program Name RM06IBI0
    Program Type B Batch Input
    I am able to post data only for the condition type PB00. for other condition types FRC1 & FRA1 not able to post the data ( also session is not giving any error).
    Therefore I am trying out witH BAPI option ( BAPI_PRICES_CONDITIONS),
    when i try to test the BAPI i am getting an error "Record KNUMH = 0000668598,
    VARNUMH = 000000000000000000000000000000: det. data missing ( Structue BAPICONDIT) .
    i am passing below mentioned values to the structue BAPICONDIT
    OPERATION 009
    SD_DOC
    ITM_NUMBER 000000
    COND_NO 0000668598
    COND_COUNT 02
    APPLICATIO M
    COND_TYPE FRC1
    SCALETYPE F
    SCALE_QTY 0.000
    SCALE_VAL 1.000000000
    CURRENCKEY USD
    CURREN_ISO USD
    CALCTYPCON C
    COND_VALUE 2.000000000
    CONDCURR USD
    COND_ISO USD
    COND_P_UNT 1
    COND_UNIT KG
    CONUNITISO KG
    NUMCONVERT 1
    DENOMINATO 1
    BASE_UOM KG
    BASEQTYISO KG
    CONDITIDX 01
    Please Suggest what else needs to be passed to get the BAPI working.
    Regards,
    Sriram

    Hi Phemmy,
    it is possible to create  PO before info record .info record establishes the relationship between vendor and your particular material.
    to answer your 2nd question:
    it is possible to create inforecord automatically during PO creation. in the ME2N screen, in the material tab, put the material code. then go to item details.in the materail data tab, you will get infoupdate  check it.and then inforecord will be created automatically.
    Thanks
    Nisha
    Edited by: nishaprasad on Jan 14, 2010 11:29 AM

  • Current Condition Record value of JVCS not picking while GR posting

    Dear All,
    Tax Procedure being used is TAXINN
    Scheduling Agreements are created before 01.06.2008.
    Condition Record with validity periods for JVCS (A/P CST NonDed-VAT) is as follows,
    01.04.2007 TO 31.05.2008 = 3%
    01.06.2008 TO 31.12.9999 = 2%
    If Goods Receipt is created with Posting Date after 01.06.2008, it is considering the old value i.e. 3%, whereas it should consider current valid value i.e. 2%.
    After posting GR, Inventory and Purchase G/L Accounts are getting posted with 3% value.
    Difference of 1% getting reverted back in those G/L Accounts after posting Invoice for the GR document.
    Can you guide me to let system consider Condition Record value 2% as per GR posting date and Validity Period of Condition Record.
    NOTE: For PO/SA created on/after 01.06.2008, it is considering current value i.e.2%.
    Thanks & Regards,
    Nilesh Mahajan

    hi ,
    system is considering the scheduling aggrement creation date for condition record.
    change the date.
    and run the scenario
    regards,
    sujit

  • Get records number from internal table with condition.

    Internal table itab got more than 1000 records,now i need to get the number of records with condition that itab-field1 = 'XXXX'.
    actully, i got an inefficient logic to count the number in a loop statement. is there better way to implement it?

    hello,
    Every time assigning data into temp table and delete may that may not be much efficient. You can check in loop logic how much time is taken. You can check the below code. here I am trying to check the numbers of plant for for one material.
    In this logic material is the first field. So if there is option to make the required field in to the 1 st position then it will be nice.
    TYPES: BEGIN OF x_count,
            matnr TYPE matnr,
            count TYPE i,
           BEGIN OF x_count.
    DATA: i_marc  TYPE STANDARD TABLE OF marc,
          i_count TYPE STANDARD TABLE OF x_count,
          wa_count TYPE x_count.
    FIELD-SYMBOLS: <wa_marc> TYPE marc.
    SELECT * UP TO 1000 ROWS
      FROM marc
      INTO TABLE i_marc.
    IF sy-subrc = 0.
      SORT i_marc BY matnr.
      LOOP AT i_marc ASSIGNING <wa_marc>.
        wa_count-count = wa_count-count + 1.
        AT END OF matnr.
          wa_count-matnr = <wa_marc>-matnr.
          APPEND wa_count TO i_count.
        ENDAT.
      ENDLOOP.
    ENDIF.
    Thanks
    Subhanakr

  • Logic with Reason rewire lagging during recording...

    Hey everyone,
    I've been working with Logic 8 rewired with reason 4, and have been having issues with logic whilst trying to record MIDI data through my controller. It will pick up uncomplicated, exactly on the beat things fine, but anything more complex that gets absolutely mangled on playback. I don't think it's the computer because I'm working off a brand new iMac in my school's music lab. Is there anything I can do?
    The program really doesn't seem to be lagging "per se" because nothing actually slows down during input; it just seems like it's not catching the notes properly. The stuff I end up with after recording is absolute trash, no semblance of what I was playing whatsoever, and quite unusable. I'll send you a fruitbasket if you can help me.

    This applies to Live users on intel as well.
    http://www.propellerheads.se/
    quote:
    The ReWire 1.7 update brings dramatically improved sample loading times and compatibility with Intel Macs. If you use a PC, this update is for you. If you use a mac, you only need this update if you are not using Reason. For instance, if you use ReWire to hook up Ableton Live and Logic on an Intel Mac you should download this update.
    Note: If you are using Reason 3.0.5, you do not need this update at all.
    Dual 1.8Ghz G5 PB G4 1Ghz LP7.1.1 RME FF800   Mac OS X (10.4.6)   Reaktor 5.1 Reason 3.0.4 Live 5.0.2 Battery 2.1.1 Recycle 2.1 DFH 1.5.3

  • Pricing - Condition record value is differ from condfition value in billing

    Dea All,
    While checking one billing document, PR00 amount is 30 EUR per 1 PC and condition value is 43 USD, if i select the PR00 line item and goto condition records, iam finding the condition record value is 34 EUR per 1 PC...
    I Dont no whta is happending here... Can you please put some light on this..
    Thanks in advance..
    Regards
    Ramakrishna.P

    1: Check PR00 in VK13 , if there are any scales maintained.
    Else
    2: Check PR00 in VK13, and go to Environment changes and check if the price is changed recently or any changes are made which you are not aware of. Also please check the condition type definition of PR00 using T Code V/06 and check how the pricing date is being mainatined.
    Hope this helps
    Sai

  • Is there an FM by which we can get condition record values at header level

    Hi All,
    Please help Is there an FM by which we can get condition record values at header level.
    Thanks,
    Gaurav Mittal

    Hi
    There is no exact FM for this
    Take the Header level condition number from the doc (KNUMV) and pass to the KONV-KNUMV and take the respective Header level amounts(KWERT) from it based on Condition Typse (KSCHL)
    we use VBAK-KNUMV(for SO leve ol)r VBRK-KNUMV(for Billing Doc's) or EKKO-KNUMV (for PO's) to get the record values from KONV
    Regards
    Anji

  • Multi-Line records with Condition?

    Hello, Can somebody help me with this query please?
    Can we have conditional 'Data Merge'? To give an example: I have a CSV file with multi line records referencing to a CUSTOMERID (ie:Parent - Child type relation). So on each page (ie:each CUSTOMERID) I need to print all records for that CUSTOMERID.
    I think we have to use the 'Scripting' option for this, but don't know how to use/run this at "DYNAMIC PRINT".
    Thanks

    Greetings Angela,
    I would suggest that you check the settings in the Multiline Style block for Address Standardization style. There are settings available here for combining address data. Verfiy which ones you have enabled. Also in this same block is a setting for Swap Address Line, which controls where blank lines will be moved for output.
    If you require more detailed information regarding this, I would recommend that you log an incident via the SAP Service Marketplace (service.sap.com), so that support can provide assistance with researching this issue.
    You will need your S-User login information in order to log an incident.
    When creating the incident, make sure to enter the component BOJ-EIM-COR so that your question is directed to the correct support team for << product name>>.  
    Rob Siegele
    Forum Moderator
    Technical Support Engineer 
    AGS Primary Support, Business User
    SAP America

  • Condition has been found with out contition record.

    Hi,
    message 207(VE) is coming when in release invoice.
    Condition has been found with out contition record(207VE)
    please help.
    Thanks,

    Dear,
    In pricing procedure for billing type there is one condition whose condition record has not been found so check that condition in transaction VK11 and check you have maintained any record. If not then maintain one.
    System must tell you the condition type and if it does not then go to analyses in item condition screen and find one.
    Regards,
    Chintan Joshi

  • Selecting missing date range with previous records value

    Hello,
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SET DEFINE OFF;
    create table t(NBR_OF_S number, NBR_OF_C number, S_DATE date);
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (34, 40, TO_DATE('05/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (27, 29, TO_DATE('03/01/2012 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (21, 23, TO_DATE('12/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (19, 20, TO_DATE('10/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (18, 19, TO_DATE('09/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (17, 17, TO_DATE('08/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (16, 16, TO_DATE('06/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (9, 9, TO_DATE('12/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (5, 5, TO_DATE('11/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into  T
       (NBR_OF_S, NBR_OF_C, S_DATE)
    Values
       (2, 2, TO_DATE('01/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    SQL> select * from t order by 3 desc;
      NBR_OF_S   NBR_OF_C S_DATE
            34         40 01-MAY-12
            27         29 01-MAR-12
            21         23 01-DEC-11
            19         20 01-OCT-11
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-JAN-10
    10 rows selected.I want the output like as follows, all those missing date i need to carry on the last one's number
      NBR_OF_S   NBR_OF_C S_DATE
            34         40 01-MAY-12
            27         29 01-APR-12
            27         29 01-MAR-12
            21         23 01-FEB-12
            21         23 01-JAN-12
            21         23 01-DEC-11
            19         20 01-NOV-11
            19         20 01-OCT-11
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUL-11
            16         16 01-JUN-11
             9          9 01-MAY-11
             9          9 01-APR-11
             9          9 01-MAR-11
             9          9 01-FEB-11
             9          9 01-JAN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-OCT-10
             2          2 01-SEP-10
             2          2 01-AUG-10
             2          2 01-JUL-10
             2          2 01-JUN-10
             2          2 01-MAY-10
             2          2 01-APR-10
             2          2 01-MAR-10
             2          2 01-FEB-10
             2          2 01-JAN-10Any help would be greatly appreciate.
    Note: The date value I have created for this sample is monthly, based on the condition the data value I may need to generate weekly also. That's Monthly or weekly either one
    Thanks,

    And what is AMT? You didn't provide such column in your original post. Anyway, MODEL solution based on original post:
    select  nbr_of_s,
            nbr_of_c,
            s_date
      from  t
      model
        partition by(rowid)
        dimension by(1 d)
        measures(
                 nbr_of_s,
                 nbr_of_c,
                 s_date,
                 months_between(lag(s_date) over(order by s_date desc),s_date) cnt
        rules(
              nbr_of_s[for d from 1 to cnt[1] increment 1] = nbr_of_s[1],
              nbr_of_c[for d from 1 to cnt[1] increment 1] = nbr_of_c[1],
                s_date[for d from 1 to cnt[1] increment 1] = add_months(s_date[1],cv(d) - 1)
      order by s_date desc
      NBR_OF_S   NBR_OF_C S_DATE   
            34         40 01-MAY-12
            27         29 01-APR-12
            27         29 01-MAR-12
            21         23 01-FEB-12
            21         23 01-JAN-12
            21         23 01-DEC-11
            19         20 01-NOV-11
            19         20 01-OCT-11
      NBR_OF_S   NBR_OF_C S_DATE   
            18         19 01-SEP-11
            17         17 01-AUG-11
            16         16 01-JUL-11
            16         16 01-JUN-11
             9          9 01-MAY-11
             9          9 01-APR-11
             9          9 01-MAR-11
             9          9 01-FEB-11
      NBR_OF_S   NBR_OF_C S_DATE   
             9          9 01-JAN-11
             9          9 01-DEC-10
             5          5 01-NOV-10
             2          2 01-OCT-10
             2          2 01-SEP-10
             2          2 01-AUG-10
             2          2 01-JUL-10
             2          2 01-JUN-10
      NBR_OF_S   NBR_OF_C S_DATE   
             2          2 01-MAY-10
             2          2 01-APR-10
             2          2 01-MAR-10
             2          2 01-FEB-10
             2          2 01-JAN-10
    29 rows selected.
    SQL> SY.
    Edited by: Solomon Yakobson on Jun 11, 2012 1:34 PM

  • How to prevent duplication on a column with condition

    Hello everyone,
    I need some advice here. At work, we have an Oracle APEX app that allow user to add new records with the automatic increment decision number based on year and group name.
    Says if they add the first record , group name AA, for year 2012, they get decision number AA 1 2013 as their displayed record casein the report page.
    The second record of AA in 2013 will be AA 2 2013.
    If they add about 20 records , it will be AA 20 2013.
    The first record for 2014 will be AA 1 2014.
    However, recently , we get a user complaint about two records from the same group name have the same decision number.
    When I looked into the history table, and find that the time gap between 2 record is just about 0.1 seconds.
    Besides, we have lookup table that allows admin user to update the Start Sequence number with the restraint that it has to be larger than the max number of the current group name of the current year.
    This Start sequence number and group name is stored together in a table.
    And in some other special case,user can add a duplicate decision number for related record. (this is a new function)
    The current procedure logic to add new record on the application are
    _Get max(decision_number) from record table with chosen Group Name and current year.
    _insert into the record table the new entered record with decision number + 1
    _ update sequence number to the just added decision number.
    So rather than utitlising APEX built-in automatic table modification process, I write a procedure that combine all the three process.
    I run some for loop to continuously execute this procedure, and it seems it can autotically generate new unique decision number with time gap about 0.1 second.
    However, when I increase the number of entry to 200, and let two users run 100 each.
    If the time gap is about 0.01 second, Duplicate decision numbers appear.
    What can I do to prevent the duplication ?
    I cannot just apply a unique constraint here even for all three columns with condition, as it can have duplicate value in some special condition. I don't know much about using lock and its impact.
    This is the content of my procedure
    create or replace
    PROCEDURE        add_new_case(
      --ID just use the trigger
      p_case_title IN varchar2,
      p_year IN varchar2,
      p_group_name IN VARCHAR2,
      --decisionnumber here
      p_case_file_number IN VARCHAR2,
      --active
      p_user IN VARCHAR2
    AS
      default_value NUMBER;
        caseCount NUMBER;
      seqNumber NUMBER;
      previousDecisionNumber NUMBER;
    BEGIN
      --execute immediate q'[alter session set nls_date_format='dd/mm/yyyy']';
      SELECT count(*)
            INTO caseCount
            FROM CASE_RECORD
            WHERE GROUP_ABBR = p_group_name
            AND to_number(to_char(create_date, 'yyyy')) = to_number(to_char(date_utils.get_current_date, 'yyyy'));
            SELECT max(decision_number)
            INTO previousDecisionNumber
            FROM CASE_RECORD
            WHERE GROUP_ABBR = p_group_name
            AND to_number(to_char(create_date, 'yyyy')) = to_number(to_char(date_utils.get_current_date, 'yyyy'));
            IF p_group_name IS NULL
            THEN seqNumber := 0;
            ELSE   
            SELECT seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVATION = p_group_name;
            END IF;
        IF caseCount > 0 THEN
               default_value := greatest(seqNumber, previousdecisionnumber)+1;
        ELSE
               default_value := 1;
        END IF; 
      INSERT INTO CASE_RECORD(case_title, decision_year, GROUP_ABBR, decision_number, case_file_number, active_yn, created_by, create_date)
      VALUES(p_case_title, p_year, p_group_name, default_value, p_case_file_number, 'Y', p_user, sysdate );
      --Need to update sequence here also
      UPDATE GROUP_LOOKUP
      SET SEQ_NUMBER = default_value
      WHERE ABBREVATION = p_group_name;
      COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
        logger.error(p_message_text => SQLERRM
                    ,p_message_code => SQLCODE
                    ,p_stack_trace  => dbms_utility.format_error_backtrace
        RAISE;
    END;
    Many thanks in advance,
    Ann

    Why not using a sequence for populating the decision_number column ?
    Sequence values are guaranteed to be unique so there's no need to lock anything.
    You'll inevitably have gaps and no different groups will have the same decision_number in common.
    Having to deal with consecutive numbers fixations you can proceed as
    with
    case_record as
    (select 2012 decision_year,'AA' group_abbr,1 decision_number from dual union all
    select 2012,'BB',2 from dual union all
    select 2012,'AA',21 from dual union all
    select 2012,'AA',22 from dual union all
    select 2012,'BB',25 from dual union all
    select 2013,'CC',33 from dual union all
    select 2013,'CC',34 from dual union all
    select 2013,'CC',36 from dual union all
    select 2013,'BB',37 from dual union all
    select 2013,'AA',38 from dual union all
    select 2013,'AA',39 from dual union all
    select 2013,'BB',41 from dual union all
    select 2013,'AA',42 from dual union all
    select 2013,'AA',43 from dual union all
    select 2013,'BB',45 from dual
    select decision_year,
           group_abbr,
           row_number() over (partition by decision_year,group_abbr order by decision_number) decision_number,
           decision_number sequence_number -- not shown (noone needs to know you're using a sequence)
      from case_record
    order by decision_year,group_abbr,decision_number
    DECISION_YEAR
    GROUP_ABBR
    DECISION_NUMBER
    SEQUENCE_NUMBER
    2012
    AA
    1
    1
    2012
    AA
    2
    21
    2012
    AA
    3
    22
    2012
    BB
    1
    2
    2012
    BB
    2
    25
    2013
    AA
    1
    38
    2013
    AA
    2
    39
    2013
    AA
    3
    42
    2013
    AA
    4
    43
    2013
    BB
    1
    37
    2013
    BB
    2
    41
    2013
    BB
    3
    45
    2013
    CC
    1
    33
    2013
    CC
    2
    34
    2013
    CC
    3
    36
    for retrieval (assuming decision_year,group_abbr,decision_number as being the key):
    select decision_year,group_abbr,decision_number -- the rest of columns
      from (select decision_year,
                   group_abbr,
    -- the rest of columns
                   row_number() over (partition by decision_year,group_abbr order by decision_number) decision_number
              from case_record
             where decision_year = :decision_year
               and group_abbr = :group_abbr
    where decision_number = :decision_number
    DECISION_YEAR
    GROUP_ABBR
    DECISION_NUMBER
    2013
    AA
    4
    if that's acceptable
    Regards
    Etbin

Maybe you are looking for

  • Minisap installation problem on windows 7

    Hello all... I am new to the software field and I want to learn sap. I bought the book ABAP OBJECTS by Horst & Keller, which came with 2 cds. I was unable to complete the installation because of the following error.. info: INSTGUI.EXE Protocol versio

  • Macbook Pro 2012 model

    Ok so the new Macbook Pros were revealed last night, and here's my opinion on them. They're beautiful! I love the fact their ultra HD (Retina display), they're lighter than the 2010/2011 models, they have not one, not two but three USB ports, and I t

  • Required Input fields in ADF form asterix alignment

    Hi All, I have a login form with two fields username and password which are both mandatory I want to display it like this Username * | | Password * | | when I choose required in the Property window it shows up like this * Username | | * Password | |

  • Can i transfer pictures with file name from mac to iphone

    i am going on a buying trip and i want to download pictures of items to be ordered with their corresponding file names (not the IMG---) so that i dont need to lug my laptop around. is it possible, and where can i view pictures with their file name. i

  • Access of network for first time only

    Hi there, I have encountered some problems whenever my J2ME application wants to connect to the servlet via the HttpConnection. When i test on the real device, this alert message "Do you wish to access to the network " will always prompt me whenever