Validating an attribute based on the value of another while inserting

Hi guys
I need to validate an attribute based on the value of another attribute.
Example:
inside some entity I have the following validation function
public boolean validateAtt1(Number data){
     if (this.getAtt2() < some vlaue)
          return false;
     return true;
this function works fine when I'm updating a record, but when I'm inserting a new record the this.getAtt2 return null, now I don't want to override the validateEntity function I want to override the validate function for att1; so in other words is there a way to reach att2 in the validation function of att1 when I'm inserting a new record, because the this.getAtt2() returns null if I'm inserting a new record.

Using attribute-level setter methods won't work because when the value of a particular attribute is being set, the values of the other attributes might not yet have been set. This explains for example why it does not work when inserting a new record. You therefore have to validate at entity level.
Rather than coding on the validateEntity() method you use a built-in Validator or Method Validator. When recording validators like this, you can provide a separate message for each business rule. If you also have the bundled exception mode enables (which will be the case by default for web applications), then multiple messages can be shown at the same time.
If you have one business rule involving two different attributes, for example a and b, and you must provide different messages based on if a is causing the violation or b, you can do it like this:
- implement one method doing the validation and that will indicate which attribute is causing the violation
- implement two different method validators (with two different messages) that call the method doing the actual validation and return false based on the attribute causing the violation
For more information about implementing business rules in ADF BC, you might have a look at this white paper:
http://www.oracle.com/technology/products/jdev/collateral/papers/10131/businessrulesinadfbctechnicalwp.pdf
Jan Kettenis

Similar Messages

  • How to Visible/Hide an Item based on the value of another Item

    Hi
    I need to visible and hide a textitem based on the value of another item.This form has 3 blocks, and the both item is in the first Master Block.
    My code is:
    if :RECORDTYPE=7 then
         Set_Item_Property('BLOCK.ITEM',VISIBLE,PROPERTY_TRUE);
         Set_Item_Property('BLOCK.ITEM',ENABLED,PROPERTY_TRUE);
    ELSE
         Set_Item_Property('BLOCK.ITEM',VISIBLE,PROPERTY_FALSE);
    Set_Item_Property('BLOCK.ITEM',ENABLED,PROPERTY_FALSE);
    :BLOCK.ITEM:=NULL;
    end if;     
    I wrote the code in the Validate Trigger, but not working when moving Next Record & Previous Record
    Thanks in advance
    Rizly

    Read the 'Propagation of Property Changes' section towards the end of the page for Set_Item_Property in the online help. I'm not sure what you mean by locking automatically but perhaps it's because of this.
    You should also ensure the item you're setting to invisible is not the current item (check :system.cursor_item and go to a different item if necessary).

  • Populate one text field on a form based on the value in another

    I am new to APEX and building my first application.
    When a user enters a value in one field, I would like to run a SQL command and then display a value in another field based on the value in the first field. For instance, if a user enters a part number in one field, when they tab off of the field, I would like to display the name of the part in the part name field.
    Thanks

    Thanks. That put me on the right track. I used that link to find the link http://htmldb.oracle.com/pls/otn/f?p=11933:11:2890374750690437 and then using the two was able to put together a solution.
    I am down to one last issue. I am able to return the name back from the process and display it with an alert statement. Unfortunately, I am unable to display the value on the form.
    I am doing the following.
    <script language="JavaScript1.1" type="text/javascript">
    function f_getCustomerName(id)
    var v_id = id;
    var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=getCustomerName',$v('pFlowStepId'));
    get.addParam('x01',$v('P2_CUSTOMER_ID'));
    gReturn = get.get();
    get = null;
    gReturn = (!gReturn)?'null':gReturn;
    /* The below do not work
    $s('P2_CUSTOMER_NAME',gReturn);
    document.getElementById('P2_CUSTOMER_NAME').value = gReturn;
    document.getElementById('P2_CUSTOMER_NAME').value = 'TEST';
    alert(document.getElementById('P2_CUSTOMER_NAME').value );
    alert(gReturn);
    //-->
    </script>
    Process: getCustomerName
    declare
    l_customer_id customer.customer_id%type;
    l_customer_name customer.customer_name%type;
    begin
    l_customer_id := to_number(wwv_flow.g_x01);
    select customer_name
    into l_customer_name
    from customer
    where customer_id = l_customer_id;
    htp.p(l_customer_name);
    end;

  • Sorting an array based on the value of another array

    Hi
    Ive got 2 arrys... An Integer[]{11,12,23,24,25};
    and another one double[]{60,79,83,54,67};
    i wanna sort the first array based on the values of the second array..
    ie my result should be double[]{83,79,67,60,54} and
    Integer[]={23,12,25,11,24}...........
    is thr any easy method to do tis..

    You should make a class with the int and the double as fields; and have your class implement Comparable to compare on the double the way you want; and just have an array of objects of this class, and sort it.
    Because the corresponding elements in your arrays are essentially linked, so they should be together.
    Edited by: spoon_ on Apr 12, 2008 2:17 AM

  • Display an exception on one keyfigure based on the value of another key fig

    Hello all,
    How to run a exception based on some condition i.e
    i want to highlight the sales(key figure) which r less than the  average sales..
    where sales and average sales r keyfigures...
    i also created a cal key fig which has has value 1 if sale > avg sale...
    i.e How do i display an exception on one keyfigure depending on the value of another keyfigure??
    plz reply its urgent...
    thnx in advance...

    Hello Ajay, did you got an answer for your problem? I'm interested...
    Thx Masen
    Edited by: Masen-Fuad Marei on Nov 25, 2009 6:26 PM

  • How to modify F4 help of one parameter based on the value of another?

    Hi,
    My Query is as follows:
    I have 3 select-options / parameters on the selection screen.
    If I enter some value in the first parameter the values in the second parameter should reflect accordingly.
    For example: The 3 selection-screen parameters are:
    select-options: s_werks for pa0001-werks no intervals,
                          s_btrtl for pa0001-btrtl no intervals,
                          s_kostl for pa0001-kostl no intervals.
    On exceuting the report, say I do a F4 and select '1000' for the first parameter (s_werks).
    Now after selecting the value for the first parameter if I do a F4 on the second parameter (s_btrtl) then it should prompt me with a F4 help containing values only corresponding to '1000' entered in s_werks and not all the values maintainined for btrtl.
    I have tried AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_BTRTL-LOW.
    And then used the FM F4IF_INT_TABLE_VALUE_REQUEST.
    But At Selection-Screen On Value Request the selection screen parameter s_werks does not show any value. It reflects the value only once it reaches Start-of-selection.
    Can anyone please guide me how to go about it?

    hi
    Please do it in this way..
    TABLES: pa0001.
    select-options: s_werks for pa0001-werks no intervals,
    s_btrtl for pa0001-btrtl no intervals,
    s_kostl for pa0001-kostl no intervals.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_BTRTL-LOW.
      PERFORM sub_pop_btrtl .
    *&      Form  sub_pop_btrtl
          text
    -->  p1        text
    <--  p2        text
    form sub_pop_btrtl .
    DATA :  l_wa_dynp TYPE dynpread,
            l_i_dynp TYPE STANDARD TABLE OF dynpread,
            l_wa_temp LIKE LINE OF S_werks.
    REFRESH s_temp[].
      l_wa_dynp-fieldname = 'S_WERKS-LOW'.
      APPEND l_wa_dynp TO l_i_dynp.
    Get the screen values of template
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname               = sy-repid
          dynumb               = sy-dynnr
        TABLES
          dynpfields           = l_i_dynp
        EXCEPTIONS
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          invalid_parameter    = 7
          undefind_error       = 8
          double_conversion    = 9
          stepl_not_found      = 10
          OTHERS               = 11.
      IF sy-subrc <> 0.
    Do Nothing
      ENDIF.
    Put the screen value in the select-options
      READ TABLE l_i_dynp INTO l_wa_dynp INDEX 1.
      l_wa_temp-sign = 'I'.
      l_wa_temp-option = 'EQ'.
      l_wa_temp-low = l_wa_dynp-fieldvalue.
    Now you use l_wa_temp as plant field
    endform.                    " sub_pop_btrtl

  • How do i show a button based on the value of another button (value is greater then 0)

    I'm am building a form in indesign, and just want to add a visual icon next to buttons when they are filled out... check mark next to a drop down list... so the list have values and i want the check mark (button) to show only when the value of the drop list is greater then 0... can this be done?... easily?....
    thank you!

    Hey Gilad D,
    its been a while since i have been back to this project…..
    now i have time to dedicate to this to get it done….
    if you don't mind i really could use a little help..
    i want to start again and give you the full scope of what i am trying to do, i don't have any real hard files yet...
    its pretty simple (in theory)..
    So i don't know what you do for work, but i work in an environment that has some pretty lazy sales people,
    so i want to create a pdf that steps them through a bunch of questions that they have to answer...
    my thought was, lets break this out into sections…
    so section one has three questions, if they answer all three, then they get a checkmark and section 2 appears
    which would have a few questions in it… etc….
    there would be some easy cross referencing and excel type calculations,… and a few, if you answer yes then another field gets auto filled..etc….
    can acrobat handle this?… or am i wasting time thinking it can?...
    i primarily work on mac's but we do have a PC with live cycle...
    thoughts?….
    thank you,
    ely

  • Validate an item based on the value of another

    I have two fields on my application, one that determines the type of record I am creating and another that holds the severity. The severity is only required when a certain type of record is created. So a item level validation item doesn't seem to work since the form is not posted yet and it does not know what type of record it is yet.
    Does anyone have any ideas? Ideally I do not want to post the record to the database first.

    Just to put some closure to this, my work around is:
    Put all the Select List (with Redirect) fields first. All the other select lists dependent on them come after obviously, and then all the normal text fields come last. The App can work like that and still present a logical work flow.
    The issue of cleared fields only shows when creating a record, even though all field sources are with Only if Null....I guess they are going back to their original values of NULL when the redirect takes place. Using Select List (with submit) just does not work - too much fooling around with conditional page processing etc. has to be done.
    So to sum up:
    1. Set all field sources to be filled Only when NULL.
    2. Use Select (or radio) "with redirect" for fields which control the LOVs or conditional showing of other fields
    3. Put all user typed entry fields after the Select/Radios with Redirect fields so you don't lose information typed when the Redirect takes place.
    Bill

  • Conditionally Formatting One Column Based On The Value of Another Column

    I have the following requirement:
    I have 2 columns in a report showing Actual Sales & Budget Sales each year. I am using a bar chart to show the different values for these 2 columns.
    I need to conditionally format the column "Actual Sales" so that if it is less than the "Budget Sales" it will appear in red, and green if "Actual Sales" is greater than "Budget Sales." So in a nutshell,
    CASE WHEN "Actual Sales" < "Budget Sales" THEN
    RED
    ELSE
    GREEN
    END
    Thoughts anyone?

    CASE WHEN (COL1 - COL2) < 0 then Red else Green end
    regards
    John
    http://obiee101.blogspot.com

  • Update a Checkbox based on the value of another Checkbox

    We have a business rule that needs to following to happen.
    If the "Commit" checkbox is checked then the "Forecast" checkbox needs to be checked.
    We would like to handle this through workflow. Here is what we have done so far
    Workflow Rule Condition: FieldValue('<bCommit_ITAG>') = 'Y'
    Action: Field to Update - Field Name* is set to Forecast
    Value is set to: [<Forecast>]='Y'
    Thanks for the help

    Brian,
    What you have written should work, try Value is set to: <Forecast>=Yes.
    This should also be created in the Administration section as its not web services but workflows, you'll get better responses.
    cheers
    Alex

  • How do I display an image in Numbers based on the value of another cell?

    Here is the situation. I have a list of names in one table. I then have a table of pictures of corresponding to each name. I then have a drop down list in a cell with each of the names in it. I would like to be able to click the drop down list, select a name, and then have the corresponding picture be displayed in a cell. How would I go about doing this?
    Late 2013 rMBP with fully up to date software.

    not possible.  I have wanted to do this myself.  You can post feedback to Apple using the menu item "Numbers > Provide Numbers Feedback"

  • Sum Based on The Value of Another Group

    I'm using RS 2005 and trying to accomplish the following:
    Here is the detail data for those customers with negative balance. For example cust2 = -50 and cust3 = -30
    Cust ID    Ord #   Balance
    cust1        1          30
    cust1        2          80
    cust2        1        100
    cust2        2       -150
    cust3        1        100
    cust3        2         70
    cust3        3       -200
    cust4        1       100
    cust4        2         50
    cust5        1       250
    cust5        2         20
    Total (net) balance for cust1 is 110
    Total (net) balance for cust2 is -50 (100 + -150)
    Total (net) balance for cust3 is -30 (100 + 70 + -200)
    Total (net) balance for cust4 is 150
    Total (net) balance for cust5 is 270
    i have to aggregate the customer balance in group A (group by Cust ID)
    For group B, Division - I only want sum the  balance of the customers within that division that have a negative balance (the balance aggregate in group A).
    so the Total for Division (group B) is  -80 (bal of cust2 + bal of cust3)
    in summary, i have to aggregate the balance for each customer, base on the balance of each customer (neg bal only), i aggregate the balance for the Division.  Your help/suggestion is greatly appreciated.

    Hi Bryan,
    First, did you trying to do this at query level or at RS using grouping and expression?
    With query, to get aggregate for each customer, simply do:
    select distinct Cust_ID, TotalBalance = sum(Balance)
    from <your table>
    group by Cust_ID
    To get the aggregate for division, try:
    select Total = sum(case when TotalBalance > 0 then 0 else TotalBalance end)
    from (
    select distinct Cust_ID, TotalBalance = sum(Balance)
    from <your table>
    group by Cust_ID
    ) t1
    ** Didn't see this has been replied.

  • Fields required based on a value in another field

    Hi,
    I am looking to have fields required (Annual Revenues and # of Employees) based on the value of another field (Ownership). Basically, if the value is Public the user is required to enter the Annual Revenue and Employees fields. I thought about using dynamic layouts but the only key field for Accounts is Account Type.
    Thanks,
    Caryn

    Hi Caryn!
    I think it is not possible for making #Employees and Revenues required depending on Ownership(as it is a look up field).. it should be possible if you want to do it on any other criteria other than ownership by just renaming the Account Type, Disable all the values of Account Tyope add new values to Pick List and make it driving picklist upon your requirements..
    If you require Account Type, create a custom picklist "Account-Type" and add the values.

  • Different heading label based on the value!

    i have IR report  ...
    sl no
    street
    Ph
    notes
    this label never
    to show here!
    dynamic label
    (ASIA)
    (EUROPE)
    1
    2 nd st
    96541
    notes 1
    ASIA
    INDIA
    2
    2nd st
    65841
    notes 2
    EUROPE
    UK
    3
    2nd
    5648
    note 3
    EUROPE
    GERMANY
    i have condition when the user logged from region wise,the region value should goes to label in Dynamic label as HEADING! how its possible?
    Thanx,
    Ram.

    Ramani_vadakadu wrote:
    Yes i did the  validation based on the LOV to affect &ITEM_LABEL ! how can use this validation in pre-validation? please login and do the sample one based on the value(real data means my 1st query in thread)!
    https://apex.oracle.com/pls/apex/f?p=29288:1:9453626954797:::::
    Wks:ram_r&d
    user/password: aramani/apex
    I have no idea what you mean. There is no validation involved. Not only did I never mention validation, you are claiming that you "did the validation", yet there is no validation on your page at all. I suspect that you are using the term "validation" in a very different way from its APEX-specific meaning.
    The component that is required in this case is a page computation with a Before Header computation point.

  • Plot a chart dynamically based on the values selected

    Hi All,
    I have some requirement like this i want to plot a chart . The chart should change dynamically based on target_name and date. What type of UI should I use ? I tried using multiselect or shuttle for choosing the target_name and date picker tool for date once i choose all this the chart should appear. Can I have a custom button called submit so once all the values are entered it plots chart ? Please help me out with our ideas.
    Thanks in Advance

    Hi,
    Using the dependent value sets you can govern the values which can be selected based on a specific value selected in a particular segment. Example if Country name is selected in segment 1 then specific states names as per the country selected can be displayed in segment 2.
    As per the requirement described you want to enable different fields based on the value selected in segment1, currently there is no standard mechanism available to enable/disable fields based on a value and you will have to do an extension/customization to meet this requirement.
    Thanks,
    Sanjay

Maybe you are looking for

  • Any way to hide/collapse events by year?

    I switched to a Mac and iLife and love it!  However, after importing some 20 years of photos in to iPhoto I have a very unwieldily long list of events.  In the past I had separate folders for each year, and then folders for each event under them.  Is

  • Popups, focus, and J2SDK 1.4.2

    Hi, I have a program that draws a cartoon of a physical device in a JPanel and monitors mouse position, movement and left-clicks on the cartoon. When the user clicks a particular region of the cartoon, a popup containing a JTextField is displayed and

  • Why can't I save something in Word for Mac?

    When I try to save something to Word for Mac, it says that the HD if full.  It's not.  I've only had my computer for a year and I can't save anything to a flash drive either.  Help, please!

  • Itunes genius error -8753  anyone?

    right after genius finishes the first step (gathering information) and starts sending my information to apple the following error message shows up; genius cant be updated... an unknown error has occured. (-8753) i tried ; -wait and try again (for 4 m

  • Opening MAC CompatibleCD_ROMs on an IMAC

    I have an IMAC that was purchased in November 2007. I have not done any upgrades to the system. We bought some CD_ROM learning games for the kids. The games are MAC/WIN compatible. When I try to open the CD_ROM it says that "the program is not suppor