question [10g] Simple on the selection of a column in the same record as the value min

I have the sample data to illustrate my question:
CREATE TABLE     t_1
(     c_a     VARCHAR2(1)
,     c_b     NUMBER(2)
,     c_c     DATE
);

INSERT INTO     t_1
VALUES('A',1,SYSDATE);
INSERT INTO     t_1
VALUES('A',2,SYSDATE+1);
INSERT INTO     t_1
VALUES('A',3,SYSDATE+2);
INSERT INTO     t_1
VALUES('A',4,SYSDATE+3);
INSERT INTO     t_1
VALUES('B',3,SYSDATE+6);
INSERT INTO     t_1
VALUES('B',4,SYSDATE+7);
INSERT INTO     t_1
VALUES('B',5,SYSDATE+8);
I have the following query, which lets me select the ikram value that corresponds to the minimum value of c_b grouped by are. In other words, my goal is: for each value in are, I want the ikram value that corresponds to the minimum value of c_b.
SELECT     t1.c_a
,     t1.c_c
FROM     t_1 t1
,     (
     SELECT      c_a
     ,      MIN(c_b)     AS min_c_b
     FROM      t_1
     GROUP BY c_a
     ) t2
WHERE     t1.c_a     = t2.c_a
AND     t1.c_b     = t2.min_c_b
;
This query works, but I wonder if there is a better way to do it. Something without a subquery? I can't get to what anyone else... It's just a bit tedious with my real data, as there are probably 10 columns of data instead of 3 has. (1 single minimum value but still).

Use the KEEP FIRST / LAST function, grouping, that is to say:

with t_1 as (select 'A' c_a, 1 c_b, sysdate c_c from dual union all
             select 'A' c_a, 2 c_b, sysdate + 1 c_c from dual union all
             select 'A' c_a, 3 c_b, sysdate + 2 c_c from dual union all
             select 'A' c_a, 4 c_b, sysdate + 3 c_c from dual union all
             select 'B' c_a, 3 c_b, sysdate + 6 c_c from dual union all
             select 'B' c_a, 4 c_b, sysdate + 7 c_c from dual union all
             select 'B' c_a, 5 c_b, sysdate + 8 c_c from dual)
-- end of mimicking your t_1 table, see SQL below:
select c_a, min(c_c) keep (dense_rank first order by c_b) c_c
from   t_1
group by c_a;

C_A C_C
--- -------------------
A   21/07/2011 16:41:46
B   27/07/2011 16:41:46

NB. the min (ç_ç) is to choose what the lowest value of the ikram should there be more than one row returned for the first c_b. You can max (ç_ç) instead, according to your needs. (If are, c_b is unique, you can use either.)

Tags: Database

Similar Questions

  • Simple question? What is the value proposition of Muse, which makes the special muse? I just want to see what think

    What is the value proposition of Muse, which makes the special muse? I just want to see what people think.

    Please refer to the explanation of Brian on the product:

    https://forums.Adobe.com/message/4580442

    Thank you

    Sanjit

  • Question of assignment to the value of the variable ODI

    Hello

    I have a value assigned question of one ODI variable to another

    Scenario:

    I have 2 variables var1 and var2 and you want to assign the value of var1 and var2. Assuming that var1 has a value of 11

    I want in the end

    var1 = var2 = 11

    What do I do?

    At the project level, stated 2 variables var1 and var2 alphanumeric two, without history

    In the package

    (1) I said as a refreshment var1 variable assigned a value via refreshing option

    (2) declared a second SET variable var2

    (3) assigned (tried various options) value with different options

    # < Project code > .var1

    "# < Project code > .var1.

    "# < Project code > .var1.

    < % = odiRef.getOption ("var1") % >

    The value of VAR2 attaches not to the value of VAR1.

    Hello

    I am sure that I answered a question similar at least twice in recent months. Please do a search...

    However do this changes

    • put your variable to the most RECENT VALUE
    • Rename them in capital LETTERS
    • Equip your package the following steps
      1. declare VAR1
      2. say VAR2
      3. Refresh VAR1
      4. Assign VAR2 with this #PROJECT value. VAR1

    Let us know.

  • Getting the values MIN and MAX of the table data

    I have the table and the following records.
    create table test_bank ( trans_id  number ,   trans_date   date ,    trans_amt    number ,      debit_credit_indicator varchar2(3) )
    
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (1, TO_DATE('01/17/2013 08:02:44', 'MM/DD/YYYY HH24:MI:SS'), 1099, 'cr');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (1, TO_DATE('01/18/2013 08:03:02', 'MM/DD/YYYY HH24:MI:SS'), 800, 'cr');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (1, TO_DATE('01/19/2013 08:03:18', 'MM/DD/YYYY HH24:MI:SS'), 500, 'db');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (1, TO_DATE('01/20/2013 08:03:36', 'MM/DD/YYYY HH24:MI:SS'), 200, 'cr');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (2, TO_DATE('01/22/2013 08:04:01', 'MM/DD/YYYY HH24:MI:SS'), 400, 'db');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (2, TO_DATE('01/23/2013 08:04:16', 'MM/DD/YYYY HH24:MI:SS'), 345, 'cr');
    Insert into TEST_BANK
       (TRANS_ID, TRANS_DATE, TRANS_AMT, DEBIT_CREDIT_INDICATOR)
     Values
       (2, TO_DATE('01/24/2013 08:04:33', 'MM/DD/YYYY HH24:MI:SS'), 600, 'db');
    COMMIT;
    I need to get the highest and lowest credit / debit amount for each trans_id.
    I tried the SQL query below. Could you please let me know if a better solution.
    select distinct * from (
    select trans_id , case when debit_credit_indicator ='db' then  max(trans_amt) over (partition by trans_id,debit_credit_indicator )
                                 when  debit_credit_indicator ='cr' then  max(trans_amt) over (partition by trans_id,debit_credit_indicator )
                                 else null end trans_amt , debit_credit_indicator 
     from test_bank  
     union
     select trans_id , case when debit_credit_indicator ='db' then  min(trans_amt) over (partition by trans_id,debit_credit_indicator )
                                 when  debit_credit_indicator ='cr' then  min(trans_amt) over (partition by trans_id,debit_credit_indicator )
                                 else null end trans_amt , debit_credit_indicator 
     from test_bank   )
     order by trans_id
    Thank you

    Hello

    to get the answer, we need to know what is your expected results (showing an example).

    I don't know if this is appropriate for your needs:

      SELECT trans_id, debit_credit_indicator, MAX (trans_amt) trans_amt, 'MAX' min_max
        FROM test_bank
    GROUP BY trans_id, debit_credit_indicator
    UNION ALL
      SELECT trans_id, debit_credit_indicator, MIN (trans_amt)trans_amt, 'MIN' min_max
        FROM test_bank
    GROUP BY trans_id, debit_credit_indicator
    ORDER BY trans_id, debit_credit_indicator, min_max DESC;
    
      TRANS_ID DEBIT_CREDIT_INDICATOR  TRANS_AMT MIN_MAX
    ---------- ---------------------- ---------- -------
             1 cr                            200 MIN
             1 cr                           1099 MAX
             1 db                            500 MIN
             1 db                            500 MAX
             2 cr                            345 MIN
             2 cr                            345 MAX
             2 db                            400 MIN
             2 db                            600 MAX    
    

    Kind regards.
    Al

  • Selection of a column in a table based on a value

    Hello

    I'm stuck with a little problem here. I need to fill a column based on a value. I have an xml that looks like this to make it simple. (Don't worry, I'm not managing the status of a stock of candy ;-)))
    I have to build in rtf.

    <? XML version = "1.0" encoding = "UTF-8"? >
    -< ROWSET >
    -< ROW >
    < CANDY > Bubble gum < / CANDY >
    without SUGAR < > < / SUGAR >
    < / ROW >
    -< ROW >
    < CANDY > candy cinnamon < / CANDY >
    without SUGAR < > < / SUGAR >
    < / ROW >
    -< ROW >
    < CANDY > candy Gummy < / CANDY >
    < SUGAR > < / SUGAR >
    < / ROW >
    < / LINES >


    I have a table with two columns. I need to put on the left column candy SUGAR-free"and right the"tart ".
    Is there a condition to get there. Or what I have to do two table a column next to each other and adapt if condition in the for each.

    Best regards

    Olivier

    Have the same structure of table with two columns and each conditions in each of your columns.
    Say in column1: text to be printed
    Column2: text to be printed

    Hope this is what you want

  • change the value limit in default graphic view, obiee 11g

    Hello

    I have two measures with the columns of the year in my report, I have generated a graph.


    In x - axis, the values of a single measure is beginning with 10,00,000

    but another of the measurement values is no more than 10,000. If the second bar lines are not visible in the chart. My question is how to manually change the values on the x - axis.

    Modify the report-> change the properties of the graph-> scale-> change the limit from the default axis manually and enter the values min and max of the axes limits...

    PLS, mark it contributes to...

  • How to get the value of a * Global * Application point of JS

    If we declare an element of the request, which is NOT a level of the page in question, how we get the value of this element in an Action dynamic JavaScript on a page?

    For example, we declare a "global" variable as an Application named DEFAULT_AJAX_SEPERATOR and set its value with a calculation of the claim "on the new Instance" a moment later, on a page of the application, we would like to get the value of DEFAULT_AJAX_SEPERATOR via JavaScript.

    Page* level syntax element...
    $v( 'DEFAULT_AJAX_SEPERATOR' );
    .. How does not work. I don't understand why it's like $v can only access the elements on the page. However, the APEX is clearly able to get these global values since, for example, they are available in PL/SQL blocks. Also, I know that it is on the session object, because I can see it when viewing the session.

    So... What is sauce secret for obtaining this value?

    Thank you

    -Joe

    Hello
    Use something like this in your javascript code.

    var appItemVal = "& DEFAULT_AJAX_SEPERATOR.";

    Thank you
    Naidu789.

    If you think, I responded to your question, please mark as answer.

  • formula to subtract the value of the fixed number field

    I'm new to javascript and have been unsuccessfully trying to complete what I know is a very simple task.  I have a form with 12 fields containing a sum in dollars.  "C1" field has a formula that counts the number of 12 fields contain a value.  This formula works correctly.  I want the "c2" field to display the number of fields without value.  I thought it would be simple subtract the value of "c1" of 12 to get the value of "c2", but I can't make it work.  The formula below is what I currently have in the custom calculation script window.  Any help with the drafting of a code that works would be greatly appreciated!

    var a = 12;

    var b = this.getField ("c1");

    var c = this.getField ("c2");

    c.Value = a.value - b.value;

    You must make sure that b.value is a number, not a string with a number.

    var a = 12;

    var b = this.getField("c1").value;

    this.getField("c2").value = a - b;

  • query multiple instances of the table min value using the Group of

    Hi all

    I use Oracle 10.2 on Windows 2003

    I'm trying to select the value min for a table, and if there are several occurrences of a value min, the list of all and not just a line. For example, the following query
    with test1 as(
    select to_date('2009-11-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2009-12-01','YYYY-MM-DD') t_date, 't_1' t_name, '2' t_value from dual
    union all select to_date('2010-01-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2010-02-01','YYYY-MM-DD') t_date, 't_1' t_name, '3' t_value from dual
    union all select to_date('2010-03-01','YYYY-MM-DD') t_date, 't_1' t_name, '4' t_value from dual
    union all select to_date('2010-04-01','YYYY-MM-DD') t_date, 't_1' t_name, '5' t_value from dual
    union all select to_date('2010-05-01','YYYY-MM-DD') t_date, 't_1' t_name, '6' t_value from dual
    union all select to_date('2010-06-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2010-07-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    )
    select trunc(t_date,'YYYY') t_date, min(t_value) min_value
    from test1
    group by trunc(t_date,'YYYY') 
    gives the following results
    t_date         min_value
    ---------         --------------
    01-JAN-09    1
    01-JAN-10    1
    then I looked at the forums and tried the following query
    with test1 as(
    select to_date('2009-11-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2009-12-01','YYYY-MM-DD') t_date, 't_1' t_name, '2' t_value from dual
    union all select to_date('2010-01-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2010-02-01','YYYY-MM-DD') t_date, 't_1' t_name, '3' t_value from dual
    union all select to_date('2010-03-01','YYYY-MM-DD') t_date, 't_1' t_name, '4' t_value from dual
    union all select to_date('2010-04-01','YYYY-MM-DD') t_date, 't_1' t_name, '5' t_value from dual
    union all select to_date('2010-05-01','YYYY-MM-DD') t_date, 't_1' t_name, '6' t_value from dual
    union all select to_date('2010-06-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    union all select to_date('2010-07-01','YYYY-MM-DD') t_date, 't_1' t_name, '1' t_value from dual
    )
    select t_date,min_value
    from (select t_date,min(t_value) min_value,
    rank() over (order by min(t_value) ASC) RN
     from test1 group by t_date)
    where rn=1
    I get the results you want with this query, which are
    t_date           min_value
    ---------           --------------------
    01-NOV-09     1
    01-JAN-10      1
    01-JUN-10      1
    01-JUL-10       1
    the problem is, when I change the values in the table test1 as follows
    with test1 as(
    select to_date('2009-11-01','YYYY-MM-DD') t_date, 't_1' t_name, '123' t_value from dual
    union all select to_date('2009-12-01','YYYY-MM-DD') t_date, 't_1' t_name, '2' t_value from dual
    union all select to_date('2010-01-01','YYYY-MM-DD') t_date, 't_1' t_name, '21' t_value from dual
    union all select to_date('2010-02-01','YYYY-MM-DD') t_date, 't_1' t_name, '13' t_value from dual
    union all select to_date('2010-03-01','YYYY-MM-DD') t_date, 't_1' t_name, '24' t_value from dual
    union all select to_date('2010-04-01','YYYY-MM-DD') t_date, 't_1' t_name, '15' t_value from dual
    union all select to_date('2010-05-01','YYYY-MM-DD') t_date, 't_1' t_name, '26' t_value from dual
    union all select to_date('2010-06-01','YYYY-MM-DD') t_date, 't_1' t_name, '100' t_value from dual
    union all select to_date('2010-07-01','YYYY-MM-DD') t_date, 't_1' t_name, '2' t_value from dual
    )
    select t_date,min_value
    from (select t_date,min(t_value) min_value,
    rank() over (order by min(t_value) ASC) RN
     from test1 group by t_date)
    where rn=1
    I get the following results
    t_date          min_value
    ----------         -------------
    01-JUN-10     100
    I expected to get the results
    t_date         min_value
    --------          --------------
    01-DEC-09     2
    01-JUL-10      2
    any help would be appreciated

    See you soon

    Hello

    The string "100" comes before "2" in the sort order for the same reason that 'ALL' comes before 'B '.

    If you want to t_value a number, make a NUMBER, not a VARCHAR2 column.

    I f you can do that, then you can try to use TO_NUMBER to convert it to a NUMBER.
    but you will get an error if Island column already contains everything that cannot be interpreted as a NUMBER.

  • maybe simple question of string of the variable in the pop up window

    Hello

    I write a name who helped me in the previous question, but now the list is great and sorry, no nicks personal

    Hi all

    We have a chain

    scany_col value {{15677, 5654, 7453}, {37008, 19532 17733}, {32896, 15163 14906}, {15934, 6939, 9509}, {16705, 6682, 9252}, {38293, 39064, 40092}, {19532, 6939, 8224}, {65535, 65535 65535}, {17219, 6425, 8738}, {24158, 9509, 11051}, {14392, 5911, 8481}, {22873, 16448, 16191}, {30840, 14649, 14649}, {29041, 16191, 15934}, {12593, 5397, 8224}}

    -(this is a RGB pixels)

    Choose from the list of the scany_col with the title "what color to the first position.

    the value of result listreturn

    listreturn

    ... one one-and this script returns an error "blah - blah with chain of cant.

    Tell me please, what is the problem?

    The sublists themselves aren't of strings and numbers.

    If you wish to choose from the sublists, replace the choice of the list command with:

    Choose from list (point 1 of scany_col) with the title "what color to the first position.

    If you want to choose a specific sub-list on all of them:

    scany_col value {{15677, 5654, 7453}, {37008, 19532 17733}, {32896, 15163 14906}, {15934, 6939, 9509}, {16705, 6682, 9252}, {38293, 39064, 40092}, {19532, 6939, 8224}, {65535, 65535 65535}, {17219, 6425, 8738}, {24158, 9509, 11051}, {14392, 5911, 8481}, {22873, 16448, 16191}, {30840, 14649, 14649}, {29041, 16191, 15934}, {12593, 5397, 8224}}

    Set scany_strings to {}

    Repeat with this_item in scany_col

    the value scany_strings scany_strings & ((article 1 de la this_item as string) & "," & (article 2 of the this_item as string) & "," & (point 3 of this_item as string))

    end repeat

    Choose from the list of scany_strings with the title "what color to the first position.

    listreturn Set result

    listreturn

    (143331)

  • ([JDev12c, ADF] 1) how to get the value of a field of the line currently selected in question 2) af:table: flowScope

    Hallo,

    How can I get the value of a field in the row that is currently selected in an af:table?

    I need to pass this value to a setCurrentRowWithKeyValue who took the record to display in another (by a button) called page:

    Limited workflow

    Page1 - goToPage2-> setCurrentRowWithKeyValue-> PAGE2

    I defined a managed bean flowScope for the workflow in which I created the variable 'CodeToSetPage2Row '.

    I will store the value of the field for the selected line in this variable so that I can move on to the setCurrentRowWithKeyValue.

    Could be this method OK? Ore is there any good practice to achieve this goal?

    The managed bean flowScope used to go to the stubborn task may take some values from the outside?

    The workflow defined will be executed in a dynamic region.

    Thank you

    Federico

    Federico, you cannot use a flow variable scope for this page. The region has no access to the bean. You must use a workflow for this parameter.

    To get an attribute of the currently selected line you make slide data vo of control on the page attribute. This will create a link attribute for this attribute. Once this link exists, switch to source mode and remove the component that you do not want.

    The framework passes the value of the current row in this affair of the attribute (table should be in single selection mode).

    Click on the button, you switch the binding of the attribute for the setting of task flow using a setPropertyListener.

    In the workflow, you call the setCurrentRowWithKeyValue with the parameter of workflow as the default activity.

    Timo

  • using the function - how to use the values of the input variables on the table select statement names

    Hello community, I have a problem when creating a function. The purpose of this function is to check the table of weather gave yesterday or not. We must check this on different tables on different sachems. We are creating a function with input variables.

    CREATE OR REPLACE FUNCTION IN_SCHEMA.IS_YDAYDATA_TO_TABLE

    (

    in_schema IN VARCHAR2,

    in_tablename IN VARCHAR2,

    in_datefield IN VARCHAR2,

    )

    RETURNS INTEGER

    AS

    -Declaring variables

    v_is_true INTEGER.

    BEGIN

    SELECT

    CASE

    WHEN MAX (in_datefield) = TRUNC(SYSDATE-1)

    THEN 1

    ON THE OTHER

    0

    END

    IN

    v_is_true

    Of

    in_schema.in_tablename

    ;

    RETURN v_is_true;

    END;

    /

    When creating, I got error: [error] ORA-00942 (44:19): PL/SQL: ORA-00942: table or view does not exist

    How to use the values of the input variables on the table select statement names?

    Hello

    Here's a way you can use dynamic SQL statements for this task:

    CREATE OR REPLACE FUNCTION IS_YDAYDATA_TO_TABLE

    (

    in_schema IN VARCHAR2,

    in_tablename IN VARCHAR2,

    in_datefield IN VARCHAR2,

    in_first_date DATE DEFAULT SYSDATE - 1,.

    in_last_date DATE by DEFAULT NULL

    )

    RETURNS INTEGER

    AS

    -IS_YDAYDATA_TO_TABLE returns 1 if in_schema.in_tablename.in_datefield

    -contains all the dates in the in_first_date of the range through included in_last_date

    - and it returns 0 if there is no such lines.

    -If in_last_date is omitted, the search only the data on in_first_date.

    -If in_first_date is omitted, it defaults to yesterday.

    -Time parts of the in_first_date and in_last_date are ignored.

    -Declaring variables

    sql_txt VARCHAR2 (1000);

    v_is_true INTEGER.

    BEGIN

    sql_txt: = 'SELECT COUNT (*).

    || 'FROM ' | in_schema | '.' || in_tablename

    || 'WHERE ' | in_datefield | ' > =: d1'

    || «AND» | in_datefield | '< >

    || 'AND ROWNUM = 1';

    dbms_output.put_line (sql_txt |) '= sql_txt in IS_YDAYDATA_TO_TABLE");  -For debugging

    Sql_txt EXECUTE IMMEDIATE

    IN v_is_true

    With the HELP of TRUNC (in_first_date) - d1

    TRUNC (NVL (in_last_date

    in_first_date

    )

    ) + 1                -- d2

    ;

    RETURN v_is_true;

    END is_ydaydata_to_table;

    /

    DISPLAY ERRORS

    If you must use dynamic SQL statements, put all the SQL statement in a single string variable, such as sql_txt in the example above.  In this way, you can easily see exactly what will be executed.  Comment out the call to dbms_output under test is completed.

    Try to write functions that will address not only the question that you have now, but similar questions that you may have in the future.  For example, now that interest you only to the verification of the data of yesterday, but later, you might want to check another day or range of days.  The above function combines the convenience of a function simple (looks like yesterday data if you don't tell him otherwise) with the power of a more complex function (you can use the same function to check any day or range of days).

  • Question to submit the value of the box in a tableview

    Hello everyone, I have a tableview and a checkbox in one of the columns. However, I have problems in retrieving the value for the checkbox control in my action method. Any help to solve this is highly appreciated...

    My FXML:
    <BorderPane id="adminTab" xmlns:fx="http://javafx.com/fxml" fx:controller="controllers.TabInboxController">
    ......................................
    ......................................
         <Tab fx:id="billReferralTab" closable="false"> 
             <text>Bill Referrals</text>
             <content>
              <BorderPane fx:id="billReferralsPanel">
                  <center>
                   <TableView fx:id="billReferralsDataTable"/> 
                  </center>
                  <bottom>
                   <VBox spacing="15">
                       <children>
                        <Separator orientation="horizontal"/>
                        <Button text="Accept the Bills" onAction="#addBillReferrals" defaultButton="true"/>
                       </children>
                   </VBox>
                  </bottom>
              </BorderPane>
             </content>
         </Tab>
    ......................................
    ......................................
    <BorderPane/>
    My controller: I need to retrieve the last State (enabled or disabled) of my check boxes in the table column. However it always returns false...
    //All imports
    public class TabInboxController implements Initializable {
    
        @FXML
        private TableView<BillReferralDataModel> billReferralsDataTable;
        @FXML
        private BorderPane billReferralsPanel;
    
        @FXML
        protected void addBillReferrals(ActionEvent event) {
            try {
                UserBean userBean = CAClient.getInstance().retrieveUserBeanFromCache();
                String userId = userBean.getLoginId();
                ServiceLocator serviceLocator = ServiceLocator.getInstance();
                BillReferralsDataSLBeanRemote billReferralsRemote = serviceLocator.retrieveBillReferralsEJB();
                ObservableList<BillReferralDataModel> billReferralsList = billReferralsDataTable.getItems();
                for (BillReferralDataModel billReferralDataModel : billReferralsList) {
    
                    // ALWAYS displays false irrespective of my checkbox status on the screen...
                    System.out.println("isAddToHome?::"+billReferralDataModel.getAddToHome());
                    System.out.println("isPending?::"+billReferralDataModel.getPending());
    
                }
            } catch (NamingException ex) {
                Logger.getLogger(TabInboxController.class.getName()).log(Level.SEVERE, ex.getExplanation(), ex);
            }
        }
    
        @Override
        public void initialize(URL url, ResourceBundle rb) {
            UserBean userBean = CAClient.getInstance().retrieveUserBeanFromCache();
            Integer committeeId = userBean.getCommitteeId();
    
            ObservableList<BillReferralDataModel> billReferralsList = retrieveBillReferrals(committeeId);
            billReferralsDataTable.setItems(billReferralsList);
            billReferralsDataTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
            CheckboxTableCellFactory checkBoxFactory = new CheckboxTableCellFactory(Pos.CENTER, billReferralsDataTable);
            billReferralsDataTable.setTableMenuButtonVisible(true);
    
            TableColumn billIdCol = new TableColumn("Bill Id");
            billIdCol.setCellValueFactory(new PropertyValueFactory<BillReferralDataModel, String>("billId"));
            billIdCol.setCellFactory(alignmentFactory);
    
            TableColumn addReferralCol = new TableColumn("Add");
            addReferralCol.setCellValueFactory(new PropertyValueFactory<BillReferralDataModel, Boolean>("addToHome"));
            addReferralCol.setCellFactory(checkBoxFactory);
            addReferralCol.setEditable(true);
            addReferralCol.setOnEditStart(new EventHandler<CellEditEvent<BillReferralDataModel, Boolean>>() {
                
                // The control never goes in here when I click on my checkboxes
                @Override
                public void handle(CellEditEvent<BillReferralDataModel, Boolean> t) {
                    ((BillReferralDataModel) t.getTableView().getItems().get(
                            t.getTablePosition().getRow())).setAddToHome(t.getNewValue());
                }
            });
            addReferralCol.setOnEditCommit(new EventHandler<CellEditEvent<BillReferralDataModel, Boolean>>() {
                // The control never goes in here when I click on my checkboxes            
                @Override
                public void handle(CellEditEvent<BillReferralDataModel, Boolean> t) {
                    BillReferralDataModel dataObject = (BillReferralDataModel) t.getTableView().getItems().get(t.getTablePosition().getRow());
                }
            });
    
            TableColumn pendingCol = new TableColumn("Pending");
            pendingCol.setCellValueFactory(new PropertyValueFactory<BillReferralDataModel, Boolean>("pending"));
            pendingCol.setCellFactory(checkBoxFactory);
            pendingCol.setEditable(true);
    
            billReferralsDataTable.setEditable(true);
            billReferralsDataTable.getColumns().setAll(billIdCol, addReferralCol, pendingCol);
        }
    
        private ObservableList<BillReferralDataModel> retrieveBillReferrals(Integer committeeId) {
            ObservableList<BillReferralDataModel> billReferralsDataList = null;
            try {
                ServiceLocator serviceLocator = ServiceLocator.getInstance();
                
                ... ... ... ... ... ... ... ... ... ... ...
                RETRIEVE DATA FROM THE DATABASE
                ... ... ... ... ... ... ... ... ... ... ...
                
                billReferralsDataList = FXCollections.observableArrayList(billReferralsList);
                Logger.getLogger(TabInboxController.class.getName()).log(Level.INFO, "Bill Referrals Data List Size::{0}", billReferralsDataList.size());
            } catch (NamingException ex) {
                Logger.getLogger(TabInboxController.class.getName()).log(Level.SEVERE, "Failed to get EJB connection");
                Logger.getLogger(TabInboxController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
            }
            return billReferralsDataList;
        }
    }
    Plant cells to generate checkboxes:
    public class CheckboxTableCellFactory implements Callback<TableColumn, TableCell> {
    
        Pos position;
        Object object;
    
        public CheckboxTableCellFactory(Pos thisPosition, Object thisObject) {
            this.position = thisPosition;
            this.object = thisObject;
        }
    
        @Override
        public TableCell call(TableColumn arg0) {
            final CheckBox checkBox = new CheckBox();
            checkBox.setUserData(object);
            TableCell tableCell = new TableCell() {
    
                @Override
                public void updateItem(Object item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null) {
                        boolean selected = ((Boolean) item).booleanValue();
                        checkBox.setSelected(selected);
                    } else {
                        checkBox.setVisible(false);
                    }
                }
            };
            tableCell.setAlignment(position);
            tableCell.setGraphic(checkBox);
         return tableCell;
        }
    }
    My grain of data model:
    package model;
    
    import java.io.Serializable;
    import java.util.ArrayList;
    import javafx.beans.property.*;
    
    public class BillReferralDataModel implements Serializable {
    
        private StringProperty billId = new SimpleStringProperty(this, "billId", "");
        private BooleanProperty pending = new SimpleBooleanProperty(this, "pending");
        private BooleanProperty addToHome = new SimpleBooleanProperty(this, "addToHome");
    
        public String getBillId() {
            return billId.get();
        }
    
        public void setBillId(String billId) {
            this.billId.set(billId);
        }
    
        public final StringProperty billIdProperty() {
            return billId;
        }
    
        public boolean getPending() {
            return pending.get();
        }
    
        public void setPending(boolean pending) {
            this.pending.set(pending);
        }
    
        public final BooleanProperty pendingProperty() {
            return pending;
        }
    
        public boolean getAddToHome() {
            return addToHome.get();
        }
    
        public void setAddToHome(boolean addToHome) {
            this.addToHome.set(addToHome);
        }
    
        public final BooleanProperty addToHomeProperty() {
            return addToHome;
        }
    }
    I'm sure that I'm missing out on a minor addition. Any hint on solving this would be appreciated.

    Thank you.

    Hello Florent.
    I have not read all your codes but from the title of your question. I think that you are not been able to get the status of the Update checkbox. To obtain the present value of checkbox, you must update 'OBJECTS' tableview to plant cells check box. For the State of the elements of this update...

    SIMPLE ALGORIGTHM
    -CLICK EVENT IS PAST IN THE CELL (BOX)
    -FUNCTION CELL_FACTORY TRIGGERS
    -YOU WILL GET THE INDEX OF THE LINE
    -UPDATE THE TABLE VIEW "ITEMS" WITH AND UPDATE THE SPECIFIC INDEX
    -THE CHANGES WILL HAPPEN THIS WAY

    Thank you
    Narayan

  • Question from beginner on the fusion of the Recrords in the Table

    This question is about question 10-b of merger on page 3-41, it says:
    (page 3-41 "Oracle Database 10g SQL Fund. II Vol.1")

    Merge the data into the EMP_DATA table that is created in the lab last in the data in the table emp_hist. assume
    EMP_DATA external table data corresponds to the EMP_HIST of table, update the email column
    table EMP_HIST to match the row in the EMP_DATA table. If a row in the EMP_DATA table is not
    match, to be inserted in the tables of EMP_HIST lines are considered as corresponding whenever his first and
    family name are the same.

    For me, this issue is built wrong. First of all in the last lab we have not been asked to create EMP_DATA. Secondly, EMP_DATA is empty.
    Thirdly, this question asks us to merge into the table EMP_HIST while EMP_DATA is empty.

    Table EMP_HIST currently copied data from the employees table. Structure EMP_HIST:

    FIRST NAME VARCHAR2 (20)
    LAST_NAME NOT NULL VARCHAR2 (25)
    EMAIL NOT NULL VARCHAR2 (45)

    EMP_DATA table is empty. I created it as follows:

    create or replace directory emp_dir
    like 'F:\emp_dir ';

    drop table emp_data;

    CREATE TABLE emp_data
    (first name VARCHAR2 (20))
    , last_name VARCHAR2 (20)
    , email VARCHAR2 (30)
    )
    EXTERNAL ORGANIZATION
    (
    TYPE oracle_loader
    Emp_dir default DIRECTORY
    ACCESS SETTINGS
    (
    RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII
    NOBADFILE
    NOLOGFILE
    FIELDS
    (first name POSITION (01:20) TANK)
    , last_name POSITION (22:41) TANK
    CHAR POSITION (43:72) by email)
    )
    LOCATION ('emp.dat'));

    Back to our question, I've done the merger as follows:

    merge into e emp_hist
    with the help of emp_data d
    on (e.first_name = d.first_name)
    When matched then
    game update
    Select = d.last_name,
    e.email = d.email
    When not matched then
    Insert values (d.first_name, d.last_name, d.email);

    I get this error:

    Error report:
    SQL error: ORA-29913: error in executing ODCIEXTTABLEOPEN legend
    ORA-29400: data cartridge error
    KUP-04040: file emp.dat in EMP_DIR not found
    ORA-06512: at "SYS." ORACLE_LOADER', line 19
    29913 00000 - "error in the execution of %s legend".
    * Cause: The execution of the specified legend caused an error.
    * Action: Examine the error messages take appropriate measures.

    On the other hand, I said I'm going to try this:

    merge into emp_data d
    using e emp_hist
    on (d.first_name = e.first_name)
    When matched then
    game update
    d.last_name = select,
    d.email = e.email
    When not matched then
    Insert values (e.first_name, select, e.email);

    I get this error because the external table's final after its creation (no update, insert, delete authorized) as far as I know:

    Error report:
    SQL error: ORA-30657: operation not supported on external organized table
    30657.0000 - "operation not supported on external-organized table".
    * Cause: User attempted on the operation on an external table which is
    not supported.
    * Action: Don't do that!

    **********************************

    I don't know what to do. I did my best, please help.

    What happens if I want to import large data set in the external table?

    Hmm, external table is just a definition on how you want to watch a file as a table in the database. Think of it as a tool to import data.

    1. first of all, have a ready file (with data).

    2. create an external table using the format of the file.

    3. now you should be able to see the data when you do this. Select * from my_external_table.

    4. now, create an ordinary table where you want the data to insert permanently.

    5 insert into permanent_table select * from my_external_table.

    I hope this helps.

  • How to select the values for each check box in a group of records

    Hello

    I have a requirement in form 10g. In this form there are 10 records are display each record has a checkbox is there if I click on the check box save number one and number three and make some changes in the text field (field adjustment is the number data type) and then finally, I want to see the total a total amount called field.

    In this, my question is how to select specific to a group of records records? and finally these selected records are inserted in a table.
    Because I am not able to read these records at a time.
    Is there any table to define a record group to fetch each of them individually for example Rec [1] Rec [2]... like this if yes please suggest me the steps how to do this.

    Thanks in advance
    Prasanna

    Published by: user10315107 on December 17, 2008 23:44

    OK, so you want to shoe the total amount in the form itself (I guess that somewhere under the dashboard lines?).

    You can do this easily using formulat elements:

    1 create a new item in your block where the field amount is places, set "section of the database" on the 'No', 'calculation mode' to the 'formula' and the 'formula' himself to something like:

    CASE WHEN :BLOCK.CHECKBOXITEM=CHECKVALUE THEN :BLOCK.AMOUNT+:BLOCK.ADJUSTMENT ELSE 0 END;
    

    This formula returns 0 if the checkboxitem is not checked, otherwise the sum of amount and adjustment (of course you can adjust the names of elements and the value for 'Checked')
    2. place the element in the layout, if you wish.
    3. set the property "Query all Records" to "true" for your block elements, this is necessary for the calculation to work
    3 create a control block to keep summary article in a, "Single Document" set to 'True '.
    4. place a new element in this control block, set 'Calcuation mode' to 'Summary', 'Summary block' to your block elements, 'Summary point' in newly created formula section in the block elements
    and function of synthesis for the "sum".
    5. place the element in the layout

    She's.

Maybe you are looking for