Validation form column against the value of another Table

Hello

I'm new to this forum, so please bear with me a bit!  I only have a small amount of writing PL/SQL experience, and I've never written Javascript or JQuery before.  I am an Oracle DBA and I coding experience C and PERL, so I have a strong technical background.  But I need some advice on the best way to approach a problem.

I have an application of data base in Oracle Apex (version 4.2) with a tabular form on a table: Let's say that #1 with the conditions of licence 1 a, 1 b, and1C.  I have to make sure that the value entered in col B is not greater than the value of a column in another table (for example table #2 pass 2 (a).  From a conceptual point of view, the amount of money available is in the #2 table, and my tabular form lines are an act of spending money (such as orders or invoices), so I have to make sure that we spend more that we have.  Who is?

Does anyone have tips for the best way to do it?  I'm figuring that the biggest problem here is perhaps to account for people who enter multiple lines in the form of tables at the same time, right?  So, if a person is entered 3/invoices, I need a total to ensure that they do not have spend more than we have in the #2 table.

I really appreciate your help!

Best regards

Laurie Baublitz

Ah, I was not totally with you on this charge then. My validation works overall, but it totals the amount for each line, regardless of the task. Okay - who was not totally my solution but more a demonstration of the technique that you can use to validate your tabular presentation in this way.

You could solve this issue with a safe collection, or with a table plsql where you add an entry for each task name and keep the amount stored in there.

Anyway, it would be better for you to spend a little time on playback on the plsql collections or collections apex!

Remember, this is a sample and you will need to take stock of it. The best solutions are those where you need to experiment with 8)

DECLARE
  TYPE tt_taskamount IS TABLE OF NUMBER INDEX BY VARCHAR2(20);
  t_taskamount tt_taskamount;

  l_task VARCHAR2(20);
  l_amount NUMBER;
  l_max NUMBER;
BEGIN
  -- F02 is the taskname
  -- F03 is the amount
  -- adapt to your situation!
  FOR i IN 1..apex_application.g_f02.count
  LOOP
    l_task := apex_application.g_f02(i);
    l_amount := apex_application.g_f03(i);
    IF NOT t_taskamount.exists(l_task) THEN
      t_taskamount(l_task) := l_amount;
    ELSE
      t_taskamount(l_task) := t_taskamount(l_task) + l_amount;
    END IF;

    -- it's not the best idea to perform a select each time and could be
    -- done better but for the sake of the example it's fine
    -- not too bad either if the rowcount is small.
    SELECT maxamount
      INTO l_max
      FROM table2
     WHERE taskname = l_task;

    IF t_taskamount(l_task) > l_max THEN
      -- returning will stop further processing and throw an error message as soon as a budget has been overrun
      -- it might or might not be required behaviour but that's up to you
      RETURN 'The max amount ('||l_max||') for task ' || l_task ||' has been exceeded. Reduce the total amount on associated tasks!';
    END IF;
  END LOOP;
END;

Tags: Database

Similar Questions

  • Select column based on values in another table names.

    I would like to generate a sql statement based on the values in a table. For example, I would start "Select division from tableA".

    In the above example, 'division' would be a value of a column in TableB. Perhaps to looking like this.

    Table B

    The ColumnName of primary key
    -----
    -----
    Division of 1234
    Division of 3456
    Department of 7890

    I don't want back 'Division' of table B, based on the primary key = 1234 and then generate the SQL above.

    Any ideas?

    TIA

    It can be done through a PL/SQL block or the stored procedure.
    Below is a PL/SQL block to give you an idea:

    declare   NewColumnName varchar2(50);  SqlString     Varchar2(200);begin  select ColumnName into NewColumnName from TableB where PrimaryKey = 1234;  sqlString := 'select ' || NewColumnName || ' from TableA';  execute immediate sqlString;end;
    
  • Add column if the value in another column

    How can I add a column as column name 'YES_OR_NO.

    SELECT VALUE_ID IN THE TABLE TABLE_NAME

    VALUE_ID
    ---
    1
    2
    3
    4
    5

    Now, I want to create another column in the sql query called YES_OR_NO and that if there is a value in VALUE_ID then column YES_OR_NO must say 'YES' if there is no value in the column VALUE_ID of this line YES_OR_NO must say 'NO '.

    or just a way for her also to work would be to show this new column or not if a value in another column of table_name_2 (this would be ideal)
    If new column yes_or_no and fill by a Yes or a no if a value is found in another table

    Assuming that you are on a version that supports the CASE expression:

    SELECT VALUE_ID
          , case when VALUE_ID is null then 'NO' else 'YES' end as YES_NO
    FROM TABLE_NAME
    
  • Filter a column with the value of another

    Hello. Hope someone can help with this... On my search page, I want to use the value of the first list/drop-down menu to filter the values of the second list/menu. I use PHP and DW 8.0.2.

    Example: The first column has each of the 50 States. second column has 3 000 counties. If a user selects New Jersey, I want to just 21 NJ counties to appear as options in the second menu downwards rather than 3 000 counties.

    First Recordset works very well for the States. But in my second recordset, I say 'select distinct County of the said County WHERE AS var1'... and var1 is $recordset1 [County]. But the 2 column is empty. How can I actively pass the value of the first column in the second while the user is still on the same page?

    Sandman

    >>
    Assuming that your table has a field named "State":
    «select County of States WHERE state = "var1""
    >>

    You can use this solution when the first menu page 1 and the second menu on page 2 (IE passing the value of a query on page 2), but as assumingly, you need to have this functionality within a single page, basic need based on a javascript solution 'drop-down menus of dynamic load' to load the menu2 - options "in situs.

    There is an extension for Dreamweaver stand alone for this on the site of Tecnorama , that also wants to work without the relationships between the tables, in other words, with the data in a table, which matches your scenario.

  • How to create a table with a column that is the value in another table?

    Hi all,

    It's my first post n I changed my ODI of DATASTAGE platform. Help me friends n I know basic steps in 11 ODI version which I was training in my company. I hope to have your support and can do everything an action ODI related documents.

    My question is...

    Table T1 > > > > > > > > > >

    service id / / / attr.name / / / attr.value

    S1 / / / product_code / / / P1

    S1 / / / provider / / / pro1

    S2 / / / product_code / / / P2

    S3 / / / provider / / / pro3

    Table T2 > > > > > > > > > > > > > > >

    ID / / / product_code / / / provider

    S1 / / / p1 / / / pro1

    S2 / / / p2 / / / nullvalue

    S3 / / / nullvalue / / / pro3


    I have a table T1 since I should show the table T2 is released. Can we say everything on how to write a logic and steps to follow.

    Thanks in advance.

    Published by: 854662 on April 26, 2011 01:59

    Hello

    U go.

    1 the interface:

    "Put a filter in your 1 on attr.name = array ' PRODUCT_CODE.

    In the map target TABLE2
    SERVICE_ID = TABLE1. SERVICE_ID
    PRODUCT_CODE = TABLE1. ATTR_VALUE

    Use SQL IKM append control

    Interface 2:

    "Put a filter in your 1 on attr.name = array ' PROVIDER '.

    In the map target TABLE2
    SERVICE_ID = TABLE1. SERVICE_ID
    PROVIDER = TABLE1. ATTR_VALUE

    Do SERVICE_ID as KEY (when you click the column target in properties, you can see KEY under properties of the target column) and use the incremental update of the IKM Oracle.

    PS: I assume that Oracle as the source and target.

    And you can refer to the documentation,

    https://Apex.Oracle.com/pls/Apex/f?p=44785:24:4413167952886630:no:24:P24_CONTENT_ID, P24_PREV_PAGE:5185, 29

    http://odiexperts.com/

    And of course this OTN.

    Thank you
    Guru

  • can I use: separation by a comma to compare the values with another table

    Hi ALL, I am using oracle 10g, can someone help me with this query
    WITH t AS
         (SELECT 20 ID, 'ABC,DEF,GHI' VALUE
            FROM DUAL),
         x AS
         (SELECT 20 ID, 'ABC' VALUE
            FROM DUAL
          UNION ALL
          SELECT 20, 'DEF'
            FROM DUAL
          UNION ALL
          SELECT 20, 'GHI'
            FROM DUAL)
    SELECT x.ID, x.VALUE
      FROM x, t
     WHERE x.VALUE IN (t.value);
    
    o/p required
    -------------------
    20  ABC
    20  DEF
    20 GHI
    I know I can't use t.valeur in TO would adopt. so I tried to use it in the paragraph, but it did not work.
    ''''|| Replace (T.valeur, ",", "", "') |" '

    Published by: DeepakDevarapalli on December 15, 2009 19:27

    Hello

    Here's a way to do it:

    SELECT      x.ID
    ,      x.VALUE
    FROM      x
    JOIN     t     ON      ',' || t.value || ','
              LIKE     '%,' || x.value || ',%'
    ;
    

    Extra commas are necessary to avoid the problem of 'mother is in chemotherapy,' when a single value can be one substring of another. If this is impossible (as in your case, where all values are exactly 3 characters) then you don't have them.

  • I've created a form that uses the value field text to fill the text of another field.  Does not take into account changes

    I've created a form that uses the value field text to fill the text of another field.  However, if I need to change the text, the second field does not update this change.  Instead of reset the form each time, is the Javascript code to update the fields if they have been modified?

    For example I Text1 and Text2.

    When I type in Hello in Text1 I see Hello in Text2.

    Later, if I decide to change to Goodbye Text1, Text2 remains Hello.

    The shape of the hoe can recognize this change?

    Thank you

    Edit: I think I have misunderstood the situation.

    If you want to both fields have the same value, just to give them the same name.

  • How do I delete an article based on the value of another field


    I have a pdf form that I added to the text fields. My challenge is that of the financial section of the form, if the value of a specific field is empty or null, I blank block of signature financial review.  I've been trying to find a way to cover the area of signature with a white box or have a text box with signature block text appear or disappear depending on whether the value is zero or empty.

    If seen many answers on how to make the field itself disappear based on value, but I did find something that causes another field or shape appear or disappear depending on the value of another field.

    Please try the following script,

    var signid = true;

    If (this.getField("finan").value! = 0) signid = true;

    of another signid = false;

    If (SignID) this.getField("signaturefield").display = display.visible;

    else this.getField("signaturefield").display = display.hidden;

    Please let me know if it solves the problem.

  • Deactivating a page element based on the value of another element on the page

    Hello
    I have a page element I want to turn off if the value of another article (drop-down list item) is set to a specific value. I followed the example in the book 'Pro Oracle APEX"(p.320) in this regard. He ordered me to do this in the HTML form element attributes for the element section:
    OnChange = "htmldb_item_change (this); html_DisableOnValue (This, 'Closed', 'P3_PRIORITY', 'P3_ASSIGNED_TO'); »

    It works very well. It disables the element I want to disable. HOWEVER, it does not neutralize the article unless the element with the onchange attribute is changed.

    How can I add features to disable the second element, even if the first element does not change, but contains the value 'Closed' when the user of the first load of the page?

    Thanks for your help and your insight!
    -Reid

    Hello Reid,

    The easiest way would be to (also) a Condition only read the item that you want to disable.

    Greetings,
    Roel

    http://roelhartman.blogspot.com/

  • The default value based on the field from another table to a custom object

    I'm trying to set the default value to a field in the custom object to the value of a field of account. I tried the syntax 50 ways different and just don't get the case. The label for the account field displays the form of s/n, the integration of the tag is ltDBA_ACCT and it appears in the fx reports area as Account.Text_22.

    The field of custom object that I am triying update is also called s/n, which was originally the required field 'NAME '. The name of the table, account, should it be included? Do I need a function to the field?

    I've updated the external ID using the line with syntex < ID > ID (at least higher ID) so I know that it is possible to define a default value, but s / < n >, < ltDBA_ACCT >, 'account '. "" S/n "and so on are simply not working.

    If anyone knows how to get into what I would be really grateful for the help.

    OK, so if you default a field to the value of another object, you must use the JoinFieldValue function. I think you understand that, based on your original post, but I want to be sure you do.

    Then this won't work by default if the folder is created from the object that you want to join the because a default works in record creation and the ID must be available so that it works correctly. It will not work if you choose the record of the related object after that registration of the custom object is created. You can set the default after, but that does not meet your requirements.

    The syntax of the default are the following: JoinFieldValue (ref_record_type, foreign_key, field_name).

    In your case, ref_record_type is '', foreign_key is [] and field_name is ''. The best way is to determine what is the name of the field to create a new workflow for the account and use the Workflow Rule Condition expression builder to choose your field ("DBA") in the list. The value returned by the expression builder must be placed in the field_name variable in the function JoinFieldValue (minus the parentheses and quotes).

    Give it a shot and let me know how you do.
    Thom

  • return the value in another field

    Hi all. first I don't want anyone to laugh this is my 1st week with the 10g xe with application express 3.2
    in any case, I have a question
    I have 2 fields in a form that gets information from an another table (customers table) the first field is the name of the customer. which is easy I make a list of selection and display the value of the customer name and return the ID of the customer
    now I have another field in the form which is the region of the customer. I would like to be automatically generated from the table to the customer based on its ID, we chose earlier and I don't want it to be editable manually by the user.

    Please wait more stupid questions in the next 24 hours: D

    Mr. brainwash.

    Change your selection list to select using submit. This way when the value changes the page submit and information will be updated. Second, go to the properties of the item to your customer area and change the Source used to always substitute, the Source of the element of SQL query and finally in the value of the Source element, use a query that looks like this:

    SELECT region             -- region field
      FROM customers          -- your customers table
     WHERE id = :P150_CUST_ID -- this would be the bind variable for your select list.
    

    See you soon,.

    Janet Tyson

  • How can I use highlighting conditional to assign a cell using the value of another cell

    I would use conditional highlighting on a cell based on the value of another cell.

    For example:

    If K2 is 1, then I would than A4 Green

    Any suggestions?

    Hi louis,.

    This approach is to add a cell to compare your target for:

    Highlight the rule in this case:

    Quinn

  • How to automatically complete a transitional according to the value of another attribute when attribute line is questioned in the VO?

    Hello world

    The task seems simple enough, but I have not found a way to populate an attribute transitional according to the value of another attribute when the line is queried. What is the best way to achieve this?

    Thank you.

    James

    Use VORowImpl, if you have any transient attributes defined in the view object, whose value is derived from other attributes of the line, you can override the GET method and add logic there

    Please note that this class represents a row in the results collection in a display object.

  • Some columns of the values of the selected line returns NULL in the table of the adf.

    Hello..

    My version of jdev 11.1.1.5.0

    I have a vision with some columns. This view is mapped to a table of adf with some of the displayed columns. My task is to get the column values selected line (including the values of the column not displayed).
    But I'm certain values such as null, although there are values present when I run the query from the view.
    My code:
    DCIteratorBinding tableVO = ADFUtils.findIterator ("myVO");
    ViewObject voTableData = tableVO.getViewObject ();
    Line rowSelected = voTableData.getCurrentRow ();


    + / / codeto display column and the values +.
    int x = 0;
    * for (the names of the objects: rowSelected.getAttributeNames ()) {*}

    * for (int i = x; i < rowSelected.getAttributeValues () .length; i ++) {*}
    * System.out.println (x + "." + name + "=" + rowSelected.getAttribute (i)); *
    break;
    *}*
    x ++ ;
    continue;
    *}*


    MY table:
    * < af:table value = "#{bindings.myVO.collectionModel}" *.
    * var = "row" rows = "#{bindings.myVO.rangeSize}" *.
    * EmptyText = "#{Bindings.myVO.Viewable?" "{'No data to display.': 'Access Denied.'}". *
    * fetchSize = "#{Bindings.myVO.rangeSize}" *.
    * rowBandingInterval = "0."
    * filterModel = "#{Bindings.myVO.queryDescriptor}" *.
    * queryListener = "#{Bindings.myVO.processQuery}" *.
    * filterVisible = "true" varStatus = "vs."
    * selectionListener = "#{myBean.method_onRowSelect}" *.
    * rowSelection = "single" id = "t1" styleClass = "AFStretchWidth."
    "* partialTriggers =": sbcClose: sbcOpen: socWarehouse. "
    * inlineStyle = "height: 217px;" / > *.


    Thank you

    Question: the attributes are not null in the DB?
    The attributes are part of the past of the query select?
    And they are part of the binding of the tree?

    Timo

  • Change the Label element based on the value of another element

    Hi guys,.

    I need to put a label of point (A) based on the value of another article (B). I did the following:
    I created a dynamic action.
    When B changes:
    1. present the value of B
    Article 2-updated
    Is element A label: myitem & b.

    Any ideas?

    Best regards
    Fateh

    His work! Check it out now

    Just do it

    $('#mylabel').children('label').children('span').text($v('P1_A'));
    

    Published by: VC on June 9, 2012 11:21

Maybe you are looking for

  • Xperia z happens?

    Xperia z happens?

  • Channel scan does not.

    Hi all I am a string "a, b: c - d» A little need is to get a, b, c and d strings separately using "channel scan". I tried the format string "%s, % s: %s s. But the analysis of string does not work. string 1 = a, b: c - d; Channel 2, channel 3, Channe

  • Download the embedded image of hotmail

    Hello I can't view images embedded in an email from hotmail more (there now a white white box with a red x in the corner) and I did not change any settings. It is not a paper clip at the top, with the ability to download, as usual.  Do you know how I

  • IBM Websphere followed in Foglight

    Hi all We got a new requirement for Websphere App Server monitoring. It requires an agent manager of Java EE deployment that is created after the installation of the cartridge of Java on the server. In websphere, we have four profiles viz: admin offi

  • where can I get a copy of the dolby home theater 7 windows

    where can I get a copy of Dolby home theater windows 7