REC statement question

Hello,
I have written this rec statement
*WHEN
REC(EXPRESSION=%VALUE%LOOKUP)
*ENDWHEN
the only thing is I need to multiply it by -1. How do I add the reverse sign of this result to the REC statement. or how do i add that in the statement?
Thanks.

Hi,
You can do this in a number of ways, the way i would do it is as follows:
REC(FACTOR=-1LOOKUP)
Tom

Similar Messages

  • BPC Script Logic Multi-dimension REC Statement

    Hi All BPC Experts,
    The way that our data in the dimensions is setup, members in one dimension have properties that "point" to members in other dimensions.
    In this case when I write the REC statement, whilst I'm just doing arithmetic on P_ACCT, when I write the final value, I also need to specifiy the members for the dimensions CUSTOMER, ENTITY, MINE, DESTINATION.
    In the example below I hve hardcoded the CONTRACT and TIME dimension members, but going forward, this logic will be appllied to a number of CONTRACTS and TIMES so the members of the other dimensions need to be retrieved dynamically.
    *XDIM_MEMBERSET P_ACCT = CAPACITY_REV,CAPACITY_RATE,FINAL_VOLUME
    *XDIM_MEMBERSET CATEGORY=FORECAST
    *XDIM_MEMBERSET P_DATASRC=Input
    *XDIM_MEMBERSET CONTRACT=0005000001_10
    *XDIM_MEMBERSET TIME=2009.JUL
    *WHEN P_ACCT
          *IS CAPACITY_RATE
             *BEGIN
                REC(EXPRESSION=(%VALUE%[P_ACCT].[FINAL_VOLUME]),
                         CUSTOMER = CONTRACT.CUSTOMER,
                         DESTINATION = CONTRACT.DESTINATION_ID,
                         ENTITY = CONTRACT.HAUL_PC,
                         MINE = CONTRACT.MINE_ID,
                         P_ACCT = "CAPACITY_REV")
             *END
    *ENDWHEN
    *COMMIT
    My Question is twofold:
    - Can anyone see any problems with the above code, ie is this a valid way of writing the REC statement?
    - Can anyone suggest another way of writing this code?
    Best regards
    Mark Rodrigues

    Just repostoing the logic as "Code"
    *XDIM_MEMBERSET P_ACCT = CAPACITY_REV,CAPACITY_RATE,FINAL_VOLUME
    *XDIM_MEMBERSET CATEGORY=FORECAST
    *XDIM_MEMBERSET P_DATASRC=Input
    *XDIM_MEMBERSET CONTRACT=0005000001_10
    *XDIM_MEMBERSET TIME=2009.JUL
    *WHEN P_ACCT
      *IS CAPACITY_RATE
        *BEGIN
            REC(EXPRESSION=(%VALUE%P_ACCT.FINAL_VOLUME),
                                            CUSTOMER = CONTRACT.CUSTOMER,
                                            DESTINATION = CONTRACT.DESTINATION_ID,
                                            ENTITY = CONTRACT.HAUL_PC,
                                            MINE = CONTRACT.MINE_ID,
                                            P_ACCT = "CAPACITY_REV")
        *END
      *ENDWHEN
    *COMMIT

  • Script Logic: Using a property in MDX *REC statement (BPC NW)

    Hi,
    Is it possible to use a Property in an MDX statement without using  *LOOKUP() function? I have script successfully working but it takes 15 minutes to execute and would like to speed it up.
    I understand that [DIMENSION].[MEMBER].Property is not valid syntax, and do not believe NW has any other functions to resolve the issue, except *LOOKUP which takes a long time.
    Specific Example is below:
    I have a piece of script that successfully splits JV Expense by customers. A Profit Share planning driver determines the percentage that each customer is entitled to. Typically this will be 100%, but could be 50% between two customers.
    The PROFIT SHARE planning drivers records, and PARTNER_INCOME transactional records are below:
    ACCOUNT
    ENTITY
    PARTNER
    SIGNED DATA
    PROFIT_SHARE
    UK_001
    PARTNER_A
    0.5
    PROFIT_SHARE
    UK_001
    PARTNER_B
    0.5
    PROFIT_SHARE
    UK_002_PLANNING_DRIVERS
    PARTNER_B
    1.00
    PARTNER_INCOME
    UK_001
    NO_PARTNER
    $5,000
    PARTNER_INCOME
    UK_002
    NO_PARTNER
    $5,000
    UK_001 has two partners that are each entitled to 50% of the $5,000 NET PROFIT.
    For UK_002, one one single Partner is entitled to 100% of the $5,000 NET PROFIT.
    Using script logic, you can scope the Profit Share account (PROFIT_SHARE) - , and use a *REC statement to multiply this by the driver. It would look like:
    *XDIM_MEMBERSET ACCOUNT = PROFIT_SHARE
    *WHEN ACCOUNT
    IS *
    *REC (EXPRESSION = %VALUE% * ([ACCOUNT].[PROFIT_SHARE],[PARTNER].[NO_PARTNER]), ACCOUNT = PARTNER_PROFIT_SHARE)
    *ENDWHEN
    This wouldn't be a problem if the Planning Driver is always stored on the same Entity that the Income is stored on, but for UK_002, the planning driver is stored on another Entity - which is stored in a the PLAN_DRIVER_REF property of the entity. It should use UK_002_PLAN_DRIVERS
    ID (Entity)
    PLAN_DRIVER_REF
    UK_001
    UK_002
    UK_002_PLAN_DRIVERS
    UK_002_PLANNING_DRIVERS
    In this scenario, we need to switch out the Entity used in the MDX, however I do not believe you can use a property in MDX - can anyone confirm?
    I have currently implemented the *LOOKUP functionality to loop through, changing each *LOOKUP partner for each loop.
    Lookup:
    *LOOKUP PLANNING_JV_US
    *FOR %LOOP_ASLS% = %ASL_LOOKUP_LOOP_VARIABLE%        
      *DIM LOOK_%LOOP_PARTNERS%:ACCOUNT = "PROFIT_SHARE"
      *DIM LOOK_%LOOP_PARTNERS%:PARTNER= %LOOP_PARTNERS%
    *NEXT
    *DIM ENTITY = ENTITY.PLAN_DRIVER_REF                   //   Use PLAN_DRIVER_REF Property of Entity
    *ENDLOOKUP
    Scope and *REC:
    *XDIM_MEMBERSET ACCOUNT = PROFIT_SHARE
    *WHEN ACCOUNT
    IS *
    *FOR %LOOP_PARTNERS% = %PARTNER_LOOKUP_LOOP_VARIABLE%      // 1000 Partners
    *REC(EXPRESSION = %VALUE% * LOOKUP(LOOK_%LOOP_PARTNERS%), PARTNER= %LOOP_PARTNERS%, ACCOUNT = TCOJVSHAR_CALC, AUDIT_ID = PP_EXPENSE_BY_PARTNER)
    *NEXT
    *ENDWHEN
    The problem with the above, is that because the Lookup is being generated for every single Partner, there are significant numbers of loops.
    Does anyone know of another way this can be implemented in Script Logic? Otherwise we'll need to explore BAdI route.
    Thanks,
    Nick

    Hi Nick,
    Use property in LOOKUP - will dramatically speed up the calculation without FOR/NEXT.
    Vadim

  • Dynamic tuple expression in *REC statement

    Hi there,
    I think I know the answer to this already, but here goes...
    I need to use a tuple expression in a *REC statement (in place of the old-fashioned GET) but I want it to be dynamic, so at least one of the tuple members changes at runtime.
    To use the basic example from SAP Help, but amended slightly, let's say this is the standard expression:
    *XDIM_MEMBERSET P_ACCT = CE0004010,CE0652000
    *WHEN P_ACCT
    *IS "CE0004010"
    *REC(EXPRESSION=%VALUE%/([P_ACCT].[CE0652000],[P_ACTIVITY].[LABPRD],[P_ENTITY].[E123]), P_ACCT="CE0661000")
    *ENDWHENBut what if the P_ENTITY member should be dynamic, depending on the ENTITY member the user selects in the DM package? What I WANT to do is something like this:
    *XDIM_MEMBERSET P_ACCT = CE0004010,CE0652000
    *WHEN P_ACCT
    *IS "CE0004010"
    *REC(EXPRESSION=%VALUE%/([P_ACCT].[CE0652000],[P_ACTIVITY].[LABPRD],[P_ENTITY].[%ENTITY_SET%]), P_ACCT="CE0661000")
    *ENDWHEN
    ...but it doesn't work. Is this even possible? And if so, what am I doing wrong?
    Thanks very much,
    Jason
    PS. I'm already using a lookup to pull out a tax% in the same script, so I can't use it for this as well...

    Some theory:
    You have some scope at the script start (defined by user selection in DM prompt)
    For each dimension you have variable %SOMEDIM_SET% containing initial script scope. If you change scope of some dimension using *XDIM_MEMBERSET SOMEDIM=MEM1,... you can always later restore original scope with *XDIM_MEMBERSET SOMEDIM=%SOMEDIM_SET%
    WHEN/ENDWHEN will loop records with base members of the scope before WHEN. %VALUE% is a current record value.
    You can use tuple references to other members in EXPRESSION=... Dimensions not defined in tuple will have the same base member as current record. In tuple you can also use parent members.
    You can use LOOKUP as a replacement of FLD to get member from the property of the member in current record. LOOKUP can get data from current model or other model.
    Vadim

  • Using properties in a *REC statement

    Hi
    I want to copy the result of a cost center allocation from the source cost center profit center to the destination cost center profit center.  We use a property on the cost center dimension to define the profit center of the cost center.
    I first use *RUN ALLOCATION to generate the cost center allocation results but I then need to copy the results to the right profit center.  I have written the following code to do this which validates successfully:
    *WHEN ACCOUNT
    *IS A10000
      *REC(PROFITCENTER=COSTCENTER.PROFITCENTER)
    *ENDWHEN
    However when I run it I receive the following error message:
    'RUN_LOGIC Property value not found'
    Does anybody know whether it is possible to use properties in *REC statements and if so how I should write the logic?
    Kind Regards
    Wayne

    Hi,
    Try following code. However you should be sure that all the profitcenter property members of costcenter exist in profitcenter dimension members. For example if you have a member of costcenter like na_cc and if property profitcenter of this member is blank, this code doesnt work. So you have to add a XDIM_MEMBERSET.
    XDIM_MEMBERSET COSTCENTER <,> NA_CC or
    XDIM_MEMBERSET COSTCENTER = BAS(CC)
    *WHEN ACCOUNT
    *IS A10000
    *REC(FACTOR=1, PROFITCENTER=COSTCENTER.PROFITCENTER)
    *ENDWHEN
    Hope this helps.

  • Reg: Script Logic - REC Statement Variable usage

    hi friends
    Pl find enclosed the following code:
    *WHEN TIME               
    *IS TMVL(-1,2011.04)               
    *WHEN ACCOUNT               
    *IS "EXP01"               
    *REC(EXPRESSION = [TIME].[2011.04]-%VALUE%,TIME = 2011.04,ACCOUNT = EXP01A)               
    *ENDWHEN               
    *ENDWHEN               
    The above code is working fine and result is extracted but i have hardcoded , ACCOUNT=EXP01A;
    My Query is follows:
    I have used
    *WHEN ACCOUNT               
    *IS "EXP01"
    In REC i want to use concatenation of "A" To account like EXP01&"A"
    i know accunt & i want to concatenate "A" and use in REC statement like assign to variable
    var1="EXP01" & "A" and use var1 in REC
    *REC(EXPRESSION = [TIME].[2011.04]-%VALUE%,TIME = 2011.04,ACCOUNT = var1)
    i am not sure the syntax (Whether we need to put in strings)
    Also if EXP02 then var1="EXP02"&"A" and so on
    In fact i want to make this for all members in Account Dimenstion as generalised.
    Pl. verify and suggest best possibility
    Thanx & Rgds
    Srinath

    Hi Krishna
    *XDIM_MEMBERSET ACCOUNT AS %ACC% = EXP01
    *WHEN ACCOUNT
    *IS %ACC%
    REC(EXPRESSION = %VALUE%2,TIME = 2011.04,ACCOUNT = %ACC%A)
    *ENDWHEN
    Is it required to add EXP01A as below?
    XDIM_MEMBERSET ACCOUNT AS %ACC% = EXP01, EXP01A
    Also In Generalized code you have mentioned:
    Instead of Hard Coding EXP01, EXP02 can i have hierarchy of all EXP , so that if any new account added in dimension, there will be no change in script logic. Pl. can you share how to use the same.
    If above code needs to be generalised, *FOR *NEXT can be used .
    *XDIM_MEMBERSET ACCOUNT AS %ACC_LIST% = EXP01,EXP02,EXP03,EXP04
    *FOR %ACC_MBR% = %ACC_LIST%
    *WHEN ACCOUNT
    *IS %ACC_MBR%
    REC(EXPRESSION = %VALUE%2,TIME = 2011.04,ACCOUNT = %ACC_MBR%A)
    *ENDWHEN
    *NEXT
    Rgds
    Srinath

  • Script Logic - REC Statement

    Hi,
    Can we use dimension property value in REC statement?
    *REC(EXPRESSION = %value%/[TIME].CURRENTMEMBER.PROPERTIES("ACCTHRS"),ACCT_PROJECT="FTE_DIRECT_BASE")
    WHEN I PROCESS THE SCRIPT LOGIC I AM GETTING AN ERROR "INVALID LINE IN LOGIC SECTION: *REC........"
    THANKS

    Hi,
    In this case, you can use LOOKUP. For instance,
    *LOOKUP XXX
    *DIM AAA:TIME=TIME.ACCTHRS
    *ENDLOOKUP
    *REC(EXPRESSION = %value%/LOOKUP(AAA),ACCT_PROJECT="FTE_DIRECT_BASE")
    Hope this helps.
    Regards,
    YH Seo
    ====================================================================================================
    Hi,
    Can we use dimension property value in REC statement?
    *REC(EXPRESSION = %value%/TIME.CURRENTMEMBER.PROPERTIES("ACCTHRS"),ACCT_PROJECT="FTE_DIRECT_BASE")
    WHEN I PROCESS THE SCRIPT LOGIC I AM GETTING AN ERROR "INVALID LINE IN LOGIC SECTION: *REC........"
    THANKS

  • Concatenating a property in a REC statement

    In a *REC statement I need to append a property value to a string to define the Account and have tried several iterations around the following without success:
    *REC(EXPRESSION=%VALUE%,ACCOUNT=1210_ENTITY.ACCTSUFFIX)
    Where the Entity.AcctSuffix property may contain ABC, so the result I would expect would be 1210_ABC
    I thought I had seen a similar thread in the past but cannot locate it, so my apologies if I'm duplicating a previous discussion
    Any suggestions/guidance would be appreciated.

    I have exactly the same situation working for me  where I need to map data from a monthly to a weekly application, where I say:
    *REC(TIMEDIM=TIMEDIM.YEAR.WMYTARGETWEEK
    In this case MYTARGETWEEK is generated by a *SELECT used in a *FOR statement resulting in a weeknumber. and the ".W" are putted correctly in between.
    so the result is a timemember like 2008.W52. But in this case the property is also the first part of the membername. So trying to relabel the account and testing the logic the other way around like Alwin suggests might be worth trying.
    -Joost

  • REC Statement with IIF

    Hi experts,
    We are using SAP BPC 7.5 SP08. I have written a script logic wherein, i am dynamically populating the opening balance(CPLCLPTCOO) to the next month
    *FOR %TIM_MEM%="2011.AUG","2011.SEP","2011.OCT","2011.NOV","2011.DEC","2012.JAN","2012.FEB","2012.MAR","2012.APR","2012.MAY","2012.JUN","2012.JUL"
    *XDIM_MEMBERSET TIME =%TIM_MEM%
    *WHEN P_ACCT2
    *IS CPLCLPTCOSA
    *REC(EXPRESSION=[P_ACCT2].[CPLCLPTCOO]+[P_ACCT2].[CPLCLPTCOTOTP]-[P_ACCT2].[CPLCLPTCOTOTOF],P_ACCT2="CPLCLPTCOO",TIME=TIME.NEXT)
    *ENDWHEN
    *COMMIT
    *NEXT
    This code is working fine. However the problem comes when the user does not give any value in the input schedule for the member  CPLCLPTCOSA in one month but gives it for subsequent months. For this i tried modifying the scipt logic as
    *FOR %TIM_MEM%="2011.AUG","2011.SEP","2011.OCT","2011.NOV","2011.DEC","2012.JAN","2012.FEB","2012.MAR","2012.APR","2012.MAY","2012.JUN","2012.JUL"
    *XDIM_MEMBERSET TIME =%TIM_MEM%
    *REC(EXPRESSION=IIF([P_ACCT2].[CPLCLPTCOSA]=0,[P_ACCT2].[CPLCLPTCOO][P_ACCT2].[CPLCLPTCOTOTP]-[P_ACCT2].[CPLCLPTCOTOTOF],[P_ACCT2].[CPLCLPTCOO][P_ACCT2].[CPLCLPTCOTOTP]-[P_ACCT2].[CPLCLPTCOTOTOF]),P_ACCT2="CPLCLPTCOO",TIME=TIME.NEXT)
    *COMMIT
    *NEXT
    However, this code doesnot work as it is giving a validation error "Invalid dimemnsion name "[P_ACCT2].[CPLCLPTCOSA" in application PLANNING"
    Can you please help me out on how i can include an IIF statement in a REC statement.
    Thanks in advance
    Edited by: Appu Del on Dec 30, 2011 4:36 PM

    place *WHEN_REF_DATA = MASTER_DATA at the beginning .Try this statement with 1 st code . Do not  try with  2 ed code . it has lot of syntax errors.
    *WHEN_REF_DATA = MASTER_DATA
    *FOR %TIM_MEM%="2011.AUG","2011.SEP","2011.OCT","2011.NOV","2011.DEC","2012.JAN","2012.FEB","2012.MAR","2012.APR","2012.MAY","2012.JUN","2012.JUL"
    *XDIM_MEMBERSET TIME =%TIM_MEM%
    *WHEN P_ACCT2
    *IS CPLCLPTCOSA
    *REC(EXPRESSION= ([P_ACCT2].[CPLCLPTCOSA]>0 )*([P_ACCT2].[CPLCLPTCOO]+[P_ACCT2].[CPLCLPTCOTOTP]-[P_ACCT2].[CPLCLPTCOTOTOF]) +  ([P_ACCT2].[CPLCLPTCOSA]<0 )* (calculation if there is no value in CPLCLPTCOSA)  ,P_ACCT2="CPLCLPTCOO",TIME=TIME.NEXT)
    *ENDWHEN
    *COMMIT
    *NEXT
    Hope this helps.

  • Set dynamic member to dimension in *REC statement

    BPC Experts,
    Please refer to the below script logic . In this i wanted to pass the dynamic value to the BPC dimension. For the INPUT auditidm , i want to update different AUDITID value based on the dynamic selection in BPC . But the below script logic is throwing warning message and the dynamic value to the auditid is not considered, instead it uses the variable name itself while generating the records. I m using BPC 10 version SP Level 12.
    *XDIM_MEMBERSET CATEGORY = %CATEGORY_SET%
    *XDIM_MEMBERSET TIME = %TIME_SET%
    *XDIM_MEMBERSET ACCOUNT = %ACCOUNT_SET%
    *XDIM_MEMBERSET AUDITIDM= INPUT
    *WHEN AUDITIDM
    *IS *
    *REC(EXPRESSION = %VALUE% * ($PER_INPUT$/100), AUDITIDM = $HLA_INPUT$ )
    *ENDWHEN
    *COMMIT
    PROMPT(SELECT,,,,"CATEGORY,ACCOUNT,TIME,")
    PROMPT(TEXT, %PER_INPUT%, "Input Percentage",,)
    PROMPT(COMBOBOX, %HLA_INPUT%, "Select HLA AudiitID from the list",0,"HLA_01",{"HLA_02","HLA_03","HLA_04"},)
    INFO(%EQU%,=)
    INFO(%TAB%,;)
    TASK(/CPMB/FX_RESTATMENT_LOGIC,SUSER,%USER%)
    TASK(/CPMB/FX_RESTATMENT_LOGIC,SAPPSET,%APPSET%)
    TASK(/CPMB/FX_RESTATMENT_LOGIC,SAPP,%APP%)
    TASK(/CPMB/FX_RESTATMENT_LOGIC,SELECTION,%SELECTION%)
    TASK(/CPMB/FX_RESTATMENT_LOGIC,REPLACEPARAM,PER_INPUT%EQU%%PER_INPUT%%TAB%,AUDITIDM%EQU%%HLA_INPUT%)
    TASK(/CPMB/FX_RESTATMENT_LOGIC,LOGICFILENAME,HLA.LGF)
    After the run package, warning messages shows
    ENDWHEN ACCUMULATION: 1  RECORDS ARE GENERATED.
    Invalid Members [AUDITIDM]=%HLA_INPUT%
    How to pass dynamic value to the REC statement ? Please provide your inputs

    TASK(/CPMB/FX_RESTATMENT_LOGIC,REPLACEPARAM,PER_INPUT%EQU%%PER_INPUT%
    %TAB%,AUDITIDM%EQU%%HLA_INPUT%) -> you have given comma after %TAB% remove that and use HLA_INPUT not AUDITIDM
    Correct:
    TASK(/CPMB/FX_RESTATMENT_LOGIC,REPLACEPARAM,PER_INPUT%EQU%%PER_INPUT%
    %TAB%HLA_INPUT%EQU%%HLA_INPUT%)
    Also remove inverted comma in combo box.
    Correct:
    PROMPT(COMBOBOX, %HLA_INPUT%, "Select HLA AudiitID from the list",0,HLA_01,{HLA_01,HLA_02,HLA_03,HLA_04},)
    Hope this helps..

  • " *COMMIT "  statement - Question

    *XDIM_MEMBERSET P_ACCT = CE0004010
    *XDIM_MEMBERSET TIME = 2006.DEC ,2006.Nov,2006.OCT
    [#CE0661000]  = 500
    *COMMIT
    In the above logic, how many records will get updated?
    I am guessing  the above logic will update 3 records(based on teh time dimension) , is that correct?

    Dear Sapki6,
    Sorry I did not clear your script logic. If you want to create a new record into BPC table, please you have to use *REC() statement and combine with *COMMIT() statement. *COMMIT() statement is used to write down a data into tables and maybe you want to view a new record, please you do not put *COMMIT() statement in your script and BPC will write down in memory. So, you can see log of data for a new record which BPC created it.
    Kind Regards,
    Wandi Sutandi

  • Concatenate property with two other dimension values in REC statement

    Greetings,
    I am attempting to concatenate a member property with two member values to create a this dimension member ID in a REC statement, as in the example:
                      *REC(FACTOR=1, COSTCENTER = PROFITCENTER.PCID + %DEPARTMENT% + %COMPANY%)
    So the COSTCENTER member is the concatenation of the PCID property of the current PROFTCENTER member and the ID of the current DEPARTMENT member and the ID of the current COMPANY member.
    I appreciate your help.
    Regards,
    Craig
    P.S. This syntax works fine in the Microsoft version
    Edited by: Craig Tennant on Oct 27, 2010 9:58 AM

    Gersh,
    I have tried:
    *REC(FACTOR=1, COSTCENTER = [PROFITCENTER].PCID %DEPARTMENT%) //PROFITCENTER has brackets around it and there is a space between the two.
    When I validate and save it tells me "Attribute PCID%DEPARTMENT% does not exist in dimension PROFITCENTER"
    *REC(FACTOR=1, COSTCENTER = [PROFITCENTER].PCID_%DEPARTMENT%) //PROFITCENTER has brackets and there is an underscore between the two.
    When I valiudate and save it tells me "Attribute PCID_%DEPARTMENT% does not exist in dimension PROFITCENTER"
    *REC(FACTOR=1, COSTCENTER = [PROFITCENTER].PCID [DEPARTMENT].ID) //PROFITCENTER and DEPARTMENT have brackets around them and there is a space between the two.
    When I validate and save it tells me "Member [PROFTCENTER].PCID[ does not exist"
    *REC(FACTOR=1, COSTCENTER = [PROFITCENTER].PCID_[DEPARTMENT].ID) //PROFITCENTER and DEPARTMENT have brackets around them and there is an underscore between the two.
    When I validate and save it tells me "Member [PROFTCENTER].PCID[_ does not exist"
    Again I appreciate your help and insight
    Cheers,
    Craig

  • SQL statement question

    I'm trying compare two table in Oracle and with a firstname and
    lastname
    matches fill-in a pager pin number.
    This is the sql statement I'm running
    update addressbook2 set pin =
    (select pin from phonebook where
    phonebook.firstname=addressbook2.firstname
    and
    phonebook.lastname=addressbook2.lastname)
    where addressbook2.firstname IN (select firstname from phonebook)
    and addressbook2.lastname IN (select lastname from phonebook)
    but I get an error message saying:
    ORA-01427: single-row subquery returns more than one row
    My question is can I update the table even when there are
    duplicates in the tables. The query runs perfect when both
    tables are unique.
    Thank you for any help.
    MN
    null

    I presume you are trying to update the pin of only those people
    in the addressbook table that also exist in the phonebook table.
    The following will work:
    update addressbook a
    set a.pin = (
    select f.pin from phonebook f
    where f.fname = a.fname
    and f.lname = a.lname
    ie remove the last two lines from your DML statement.. be aware
    that you are using a denormalised design (pin is not normalised
    on the primary key) and the use of first and last names as a
    method of identifying people is not a good idea (does 'smith' =
    'smyth'?)
    MN (guest) wrote:
    : I'm trying compare two table in Oracle and with a firstname and
    : lastname
    : matches fill-in a pager pin number.
    : This is the sql statement I'm running
    : update addressbook2 set pin =
    : (select pin from phonebook where
    : phonebook.firstname=addressbook2.firstname
    : and
    : phonebook.lastname=addressbook2.lastname)
    : where addressbook2.firstname IN (select firstname from
    phonebook)
    : and addressbook2.lastname IN (select lastname from phonebook)
    : but I get an error message saying:
    : ORA-01427: single-row subquery returns more than one row
    : My question is can I update the table even when there are
    : duplicates in the tables. The query runs perfect when both
    : tables are unique.
    : Thank you for any help.
    : MN
    null

  • View State question - changing states and custom states

    Hi all,
    I'm working on an application that lets a user register for an event. Each event has associated child information: conferences, tickets, etc. associated with it. What I'm trying to do is create some sort of checkbox list so that, when a user clicks on an event to add it to his registration, the associated child information appears in the display so he can choose all this information at once. I have the list working and I've been trying to use a custom ItemRenderer to pop in the extra info for the user to select when he clicks on an event. The problem I'm having is that, when the user goes to click on a child to add it to his registration, my state is changing back from "selected" to "normal" and the child information disappears. So I guess I have two questions. One, am I even remotely on the right track here? If not, can someone suggest a better approach? Two, if this is the right approach, how do I solve the "disappearing child" problem? I tried creating a custom state that would set everything to visible, but I can't seem to figure out how to get into it...I tried just putting a click event on it and just doing an Alert.show(currentState) to see if I was even getting into my custom state, but I just kept switching between "normal" and "selected."
    Code:
    ItemRenderer:
    <s:ItemRenderer name="eventItemRenderer"
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    focusEnabled="false" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:registrationapi="services.registrationapi.*">
    <fx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    //this gets my data to populate the dropDown list when the parent event is selected
    protected function checkbox1_clickHandler(event:MouseEvent, selectedEventCode:String):void
    showPrimaryConferences = true;
    getEventConferencesResult.token = registrationAPI.getEventConferences(selectedEventCode.name);
    protected function comboBox_creationCompleteHandler(event:FlexEvent):void
    getEventConferencesResult.token = registrationAPI.getEventConferences(data.EventCode);
    ]]>
    </fx:Script>
    <s:states>
    <s:State name="normal"/>
    <s:State name="hovered"/>
    <s:State name="selected"/>
    </s:states>
    <s:Rect top="0" left="0" right="0" bottom="0">
    <s:fill>
    <s:SolidColor id="backgroundColor" color="0xFFFFFF" />
    </s:fill>
    </s:Rect>
    <!-- checkmark -->
    <s:Path data="M 3.5 6.5 l 2 2 l 6 -7" includeIn="selected" right="2" verticalCenter="1">
    <s:stroke>
    <s:SolidColorStroke weight="2" caps="square" color="0x000000" />
    </s:stroke>
    </s:Path>
    <fx:Declarations>
    <s:CallResponder id="getEventConferencesResult"/>
    <registrationapi:RegistrationAPI id="registrationAPI" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
    </fx:Declarations>
    <s:VGroup left="3" right="10" top="3" bottom="3">
    <s:CheckBox name="{data.EventCode}" label="{data.EventTitle}" id="selectedEventCode" fontWeight="bold" click="checkbox1_clickHandler(event, selectedEventCode.name)" />
    <s:Label text="{data.EventTitle}" id="selectedEventCodeLabel" fontWeight.selected="bold"  />
    </s:VGroup>
    </s:ItemRenderer>
    Thanks in advance for any suggestions!
    ~ amanda

    I simplified the problem to it's essence and came up with this:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal"
        creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                [Bindable]
                public var lProvider:ArrayCollection;
                private function init():void
                    var la:Array = [{label: "Conference", checked: true},
                                    {label: "Tickets", checked: false}];
                    lProvider = new ArrayCollection(la);
            ]]>
        </mx:Script>
        <mx:List id="cList" width="200" dataProvider="{lProvider}" itemClick="lProvider.refresh()">
            <mx:itemRenderer>
                <mx:Component>
                    <mx:HBox width="100%">
                        <mx:CheckBox selected="{data.checked}" click="data.checked = event.target.selected"/>
                        <mx:Label text="{data.label}"/>
                    </mx:HBox>
                </mx:Component>
            </mx:itemRenderer>
        </mx:List>
        <mx:VBox width="600">
            <mx:Panel title="Conference component" width="100%" height="200"
                    visible="{lProvider.getItemAt(0).checked}"
                    includeInLayout="{lProvider.getItemAt(0).checked}"/>
            <mx:Panel title="Ticket component" width="100%" height="200"
                    visible="{lProvider.getItemAt(1).checked}"
                    includeInLayout="{lProvider.getItemAt(1).checked}"/>
        </mx:VBox>
    </mx:Application>
    Does this help?
    Dany

  • Access 2003: sql statement question

    Dear all,
    i'm trying to get the following code to work without success:
    String com = "SELECT Instrument.Index FROM Instrument WHERE Instrument.NextCalDate < #5/24/2007#";
    s.execute(com);
    I get the following error: Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Instrument.NextCalDate < #5/24/2007#'.
    It is because of the <. If i change the < by an = it works fine. The annoying thing is that i've been browsing the forum and some date related questions regarding java/access were explained by giving example code that had the exact same syntax as the code i'm using, so with the use of the < character without using escape characters or whatever. These postings however date from 2004 or something, so what has changed?
    I'm using latest JDK, Access 2003 and am connecting via ODBC running on an XP Pro machine.
    Help is very much appreciated. Thanks from The Netherlands
    Message was edited by:
    bassiedude

    I suspect one thing that changed was that those other examples were using a previous version of MS Access.
    Other than that I can only suggest that you use a prepared statement rather than attempting to the MS Access specific syntax.

Maybe you are looking for

  • Vendor payment through APP with other than my bank currency

    Hi I have one question: I have to make payment in USD to vendor, but my bank currency is EUR. How to do it from Automated Payment Program. Pls. provide with configuration in APP + Vendor Master also. Regards, Vadiraj

  • Problem in Currency Conversion of Labour costs

    Hi All,            In my system i have some MOs where object currency and controlling area currency are different .. Example : Our Controlling area currency in USD and MO is created in EUR .., Now when we select object currency and controlling area c

  • AS2 Drag and Drop - Completion Response

    I am making a drag and drop alphabet learning game. There are 27 Movie Clips (letters) in total that are able to be dragged.  I've made it so that 12 of the Movie Clips will drop in a specific DropZone, while the rest will just snap back to their ori

  • How do you watch Adobe TV on a Mac?

    Hi, It may be obvious, but I must be missing something.  My software is up to date.  When I go to watch something on Adobe TV, nothing happens. Thank you for your help.

  • Hotsync Produces 3 Calendars

    While trying to iSync my datebook with iCal, I think I did something wrong because I now have three different calendars.  My desktop datebook is the one I work with.  The conduit setting only has Backup, Install, iSync, Media, Memo, Memo Pad, Note Pa