Listing a join column only once in a select

Hi.  Has there been any advancement in t-sql where I can continue to select * on tables a and b in a join but expect to get back only one occurrence of columns that r used in the join.  Or do I still need to explicitly list all cols in the
query?
eg.  select a.*,b.* from a inner join b on a.c = b.c
hoping there is some shorthand way to see c only once
 

Sorry, I would not refer your expectation with "advancement". Relational engine needs to identify each column separately in the query, user have capability to select required columns.
If you consider LEFT OUTER JOIN, how would it decide which column to display from LEFT or RIGHT table (because when the values do not match you will still have all the rows from LEFT table).
When you specify "*" it brings the entire result set. So you will have to do little work and select only the required column. :-)
If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

Similar Messages

  • Display Column only when Current Year Selected

    Hi Gurus,
    1)I have a Req where in I need to Display a Column only when 2012 is selected,It shouldn't appear when i select 2010 & 2011 in the Prompt.
    2)I have to display a column only when the Last month of the Quarter is selected.
    Any help???

    Hi,
    Make it two reports, one with the column and the other report without the column. Place both the reports in two different dashboard sections and use conditional show/hide section as explained here,
    http://total-bi.com/2011/01/obiee-hide-show-sections/
    Regards,
    Dpka

  • WHEN-LIST-CHANGED Triggers Works Only Once ??

    hi
    i have a form with the 2 list ITEMS
    And i have some trigger WHEN-LIST-CHANGED For the
    first LIST item which Populates the Second List
    Based on the Value selected in First List
    Its Works Fine For the First time.
    But for second time Onward , it Does change the Value of the items in List2.
    Do i have to first clear and then repopulate, i tried this but then i get a total
    Blank , please help.
    jai

    From one of our support notes:
    List Items populated from Record Groups are extremely useful when you need to
    give your users a choice of items to choose from. This note will show you how
    to create two list items that have a "master-detail" relationship, i.e., the
    items appearing in the "detail" list item will depend on what is chosen in the
    "master" list item.
    CREATING THE LIST ITEMS
    Create two list items called DEPT_LIST and ENAME_LIST. Allow them to remain
    the default type of List Item, Poplists. For this situation we will not make
    them base table items. Go to the property pallet of each list item, click on
    the elements in list property and choose more. The cursor should be in the
    very topmost item under List_Elements. Depress CTRL+SHIFT+< to remove this
    default element and depress the OK button. Since you are going to populate the
    list item with RG values at runtime you do not need this element. This will
    avoid an "FRM-30351: No list elements defined for list item" error when
    running the form.
    CREATING THE RECORD GROUPS
    For this example, we will use the dept and emp tables. We have a choice of
    creating the Record Groups (RG) dynamically at runtime or at design
    time. In this case, the easiest option is to create them at design time.
    First create a RG called DEPT_GROUP with the following select statement:
    SELECT TO_CHAR(DEPTNO) A,TO_CHAR(DEPTNO) B
    FROM DEPT
    If you are unfamiliar with the structure of the RG required when it will be
    used to populate a list item please note the following:
    1. A list item has both a label and a value. For this reason the select
    statement brings back two fields, one which will be the label name and the other
    the label value.
    2. TO_CHAR is used to convert numeric values to character as the list item
    contains character values.
    Second, create a RG called ENAME_GROUP with the following select statement:
    SELECT ENAME A, ENAME B FROM EMP ORDER BY ENAME
    Note that depending upon your applications logic you may want to use the
    distinct operator to prevent duplicate names. But you should be aware that
    this will result in the overhead for sorting. Also, since ENAME is a VARCHAR2
    data type, the to_char function is not needed.
    POPULATING THE GROUPS AND LIST ITEMS
    You can populate the RGs and list items from a number of triggers but the most
    common is the WHEN-NEW-FORM-INSTANCE trigger. Place the following code in this
    trigger:
    DECLARE
    V_DEPT_GROUP NUMBER;
    V_ENAME_GROUP NUMBER;
    BEGIN
    V_DEPT_GROUP:=POPULATE_GROUP('DEPT_GROUP');
    V_ENAME_GROUP:=POPULATE_GROUP('ENAME_GROUP');
    POPULATE_LIST('DEPT_LIST','DEPT_GROUP');
    POPULATE_LIST('ENAME_LIST','ENAME_GROUP');
    END;
    Note that this code is needed to initially populate both RGs and both List
    Items.
    If you run the form at this time you will see that DEPT_LIST contains all the
    departments in Dept and ENAME_LIST contains ALL the enames in the emp table.
    As our original goal was to populate ENAME_LIST depending upon what was chosen
    from DEPT_LIST, we will now add the code to do this. In this situation we will
    add the code to a WHEN-LIST-CHANGED trigger on DEPT_LIST. The code should
    look as follows:
    DECLARE
    V_NUMBER NUMBER;
    V_QUERY VARCHAR2(512);
    BEGIN
    V_QUERY:='SELECT ENAME A, ENAME B FROM EMP
    WHERE DEPTNO = '||:DEPT_LIST||' ORDER BY ENAME';
    V_NUMBER:=POPULATE_GROUP_WITH_QUERY('ENAME_GROUP',V_QUERY);
    POPULATE_LIST('ENAME_LIST','ENAME_GROUP');
    END;
    First we will build a query that will contain the currently chosen department
    in DEPT_LIST. This is basically the same query we created in RG ENAME_GROUP
    but we are adding the where clause restriction. We then use the
    populate_group_with_query built-in to repopulate the RG and then populate the
    list again.
    Run the form again and test. Choose department 10 from the DEPT_LIST list item
    and then choose the ENAME_LIST item. You will note that the enames appearing
    in ENAME_LIST will be those in department 10. This should work for any
    department you choose.

  • I am having an issue where whenever I am at the document list and do edit, to copy or delete a document the iPad locks up. Happens for both pages and numbers. Also happens on my iPhone, but only once in a while. Help.

    I am having an issue with both Pages and Numbers on my iPad. Whenever I am at the document list page and use "edit" to make a copy of a document or delete it, the iPad locks up. Happens almost every time. Also happens on my iPhone but only once in a while. Thought of completely redoing the iPad, but if it happens on the phone as well, won't help. ???

        Hello APVzW, we absolutely want the best path to resolution. My apologies for multiple attempts of replacing the device. We'd like to verify the order information and see if we can locate the tracking number. Please send a direct message with the order number so we can dive deeper. Here's steps to send a direct message: http://vz.to/1b8XnPy We look forward to hearing from you soon.
    WiltonA_VZW
    VZW Support
    Follow us on twitter @VZWSupport

  • Should columns only be read once....

    Good day,
    I have a question about reading the resultset.
    I was recently reading the java.sql API.
    And in the description for the Resultset interface.
    It mentions that "each column should be read only once"     
    Currently I don't call columns via results.getString("column") directly.
    I usually set it to a variable and the use the variable as much as i need.
    This method mainly helps me keep organized.
    I was wondering if there are any real problems or issues that may arise from calling a column directly a numerous amount of times.
    I don't plan on chaning my current method of going about resultsets, but i was just curious.
    thanks,
    alex

    Hi,
    You can scroll through the result set and read a column any number of time (provided proper resultSetType is set during statement creation).
    see the scenario where such things will not work (but depends on the driver implementation). suppose u are retrieving rows in bulk (say >10k number of rows of large size).retrieving the bulk will give u out of memory etc exceptions. and if u set the fetchsize(int size)method things will become ok. but here u cant gurantee that u will get the column value on ur second visit to the same column (ie calling rs.getXX()method second time) .
    so the rule thumb is retrieve the column value only once and store it in a variable- this is what u are doing rt now (if its a large value, process it on the spot according to ur need)
    HTH,
    -asharafkk

  • In my library, under the Artist column only...items are not listed in alpha order.  How can I get that to happen?

    In my library, under the Artist column only...items are not listed in alpha order.  How can I get that to happen?

    Same deal as your other thread but with Artist/Sort Artist:
    https://discussions.apple.com/message/25561674#25561674
    For more info. on how iTunes organizes things see Grouping tracks into albums.
    tt2

  • Display column titles only once per page

    Hello,
    I am a newbie to BIP (R12.1.3). Below is how the output data shows up in my custom template:
    Vendor type lookup : Expense
    Vendor no: A12345 Vendor Name: Test Vendor1 Vendor Category: Expense - Construction
    VENDOR SITE INVOICE# INVOICE DATE DUE DATE INVCT AMT REM AMT PAYMENT METHOD
    ======== ====== ========= ====== ====== ====== ============
    Kannapolis A#12345 03-MAR-12 15-MAR-12 1000.00 1000.00 Check
    Vendor no: B12345 Vendor Name: Test Vendor2 Vendor Category: Expense - Rents
    VENDOR SITE INVOICE# INVOICE DATE DUE DATE INVCT AMT REM AMT PAYMENT METHOD
    ======== ====== ========= ====== ====== ====== ============
    Test Site B#12345 03-MAR-12 15-MAR-12 1500.00 1500.00 EFT
    The column titles repeat for each vendor since the titles are in the for-each loop under the vendor grouping. However, is there a way to restrict the titles to show up only once per page on all the pages? I tried putting the titles outside the vendor grouping but with in the vendor type lookup grouping. It is displaying the titles only on page1.
    Thanks,
    Monkey

    Hi, could you try Inserting the code <?if:position()=1?> before the header of your template and the code <?end if?> after the header of your template.
    See the a sample code below:
    <?if:position()=1?>
    VENDOR SITE INVOICE# INVOICE DATE DUE DATE INVCT AMT REM AMT PAYMENT METHOD
    <?end if?>
    Thanks,
    mr_bip_learner

  • Display Select list only once in the report

    Hi,
    select
    CLS.NAME "Name",
    CLI.SECTION "Section",
    CLI.DESCRIPTION "Description",
    htmldb_item.select_list(5,R.REVIEWER_CONFIRM,'YES;YES,NA;NA,NO;NO') "Reviewer Confirm",
    htmldb_item.text(6,R.REVIEW_COMMENT,60,60) "Reviewer Comment",
    R.ID "ID"
    from
    CHECK_LIST_SUB CLS,
    CHECK_LIST_ITEM CLI,
    RCL R
    where
    CLS.CHECK_LIST_SUB_ID = CLI.CLS_ID
    and
    CLI.CLI_ID = R.CLI_ID and
    R.RI_ID = :P21_RI_ID
    The above query will return set of rows there is also a select list displayed for each row
    I need to restric this select list for each name wise in the result of the report.
    select list should not repeat it must be report only once
    Please suggest me how to do this
    Thanks
    Sudhir

    Sudhir,
    Try this query.
    SELECT
    CLS.NAME "Name",
    CLI.SECTION "Section",
    CLI.DESCRIPTION "Description",
    CASE WHEN ROWNUM = 1 THEN
         htmldb_item.select_list(5,R.REVIEWER_CONFIRM,'YES;YES,NA;NA,NO;NO')
         ELSE NULL
    END "Reviewer Confirm",
    htmldb_item.text(6,R.REVIEW_COMMENT,60,60) "Reviewer Comment",
    R.ID "ID"
    FROM     CHECK_LIST_SUB CLS,
         CHECK_LIST_ITEM CLI,
         RCL R
    WHERE     CLS.CHECK_LIST_SUB_ID = CLI.CLS_ID
         AND CLI.CLI_ID = R.CLI_ID
         AND R.RI_ID = :P21_RI_IDThanks,
    Manish

  • Adding list based menu only once for all related pages

    Hi,
    I have a one level tab application. For a given tab I have 5 different pages. I would like let the end user navigate to these pages via a list region. Currently I have added to all five pages a list region and assigned the same list item to these list regions.
    Is it possible that I add this list based menu only once to my application or this is the normal way of doing it?
    Is there a way to let
    Regards,
    Tamas

    Use page zero.
    Add regions containing the lists for each tab to the same region display point on page zero, making each region conditional using a "Current Page Is Contained Within Expression 1..." condition.

  • How to make a summary column appear only once (in the first page only) in SSRS 2008?

    Hello Everyone,
    How to make a summary column appear only once (in the first page only) in SSRS 2008?
    Regards
    Gautam S
    Regards

    Hi,
    Assuming you have test data like this ;
    select 'abc'as [GROUP],'NN' name , 1 id
    union all
    select 'abc' as [GROUP] ,'PP' name , 1 id
    union all
    select 'abc'as [GROUP],'RR' name , 2 id
    Step1  : take Tablix with row group as your group Name .
    Step2 : right Click on Row Group Details -> Delete-> Delete Group Only
    Step3 : In Count Cell use below expression ;
    =CountDistinct(Fields!id.Value)
    Follow this link;
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b6b45917-0a26-4d15-be46-2c6a2697d6e9/distinct-rows-sum?forum=sqlreportingservices#5ffdee06-c2c8-44ea-a3a5-b958488bb6b5
    Thanks
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com

  • Return each value only once using cfloop query

    Hi,
    I have some code that dynamically populates a cfselect list and then populates a second list based on those values. Everything seems to be working fine, except that all values are being pulled from the database, and there are duplicates in most cases. For example, value 1S1W diplays in the drop-down menu 10 times, where I would only like it there once.
    Is there a way to have one of each value in my list?
    <cfif isDefined('form.select_Main_Group')>
        <cfset page.select_Main_Group = form.select_Main_Group>
    </cfif>
    <cfoutput>
      <form name="DropDown" method="post">
      <!--- query DB for the first drop down list --->
    <CFQUERY name="get_Main_Group" datasource="ds" dbtype="odbc">
    SELECT *
              FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
              ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
              ORDER BY page_description
    </CFQUERY>
      <!--- first drop down list --->
      <!--- NOTICE the onChange javascript event in the select tag, this is what submits the form after the first selection --->
      <select name="select_Main_Group" required="yes" onchange="this.form.submit()">
         <option>Select Township/Range</option>
         <!--- dynamically populate the first drop down list based on the get_Main_Group query --->
         <!--- NOTICE the CFIF within the option tag, this says, if the first selection has been made, display the chosen option when the page reloads --->
         <cfloop query="get_Main_Group">
             <option value="#SECTION#" <cfif isDefined('form.select_Main_Group')><cfif form.select_Main_Group eq "#SECTION#">selected</cfif></cfif>>#TOWNSHIP_RANGE#</option>
               </cfloop>
    </select>
    <p>
    <!--- if the first selection has been made, display the second drop down list with the appropriate results --->
    <cfif isDefined('page.select_Main_Group')>
       <!--- query DB for second drop down list, based on the selected item from the first list --->
       <cfquery name="get_Sub_Group" datasource="ds" dbtype="odbc">
            SELECT TOWNSHIP_RANGE, SECTION
            FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
                        ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
            WHERE SECTION = '#page.select_Main_Group#'
       </cfquery>
       <!--- second drop down list --->
       <select name="select_Sub_Group" required="yes">
          <option>Select Section</option>
          <!--- dynamically populate the second drop down list based on the get_Sub_Group query --->
          <cfloop query="get_Sub_Group">
             <option value="#SECTION#">#SECTION#</option>
          </cfloop>
       </select>
    </cfif>
    </form>
    </cfoutput>

    Emily,
    OK.  Yes it is possible.  Change your first query to:
    SELECT  DISTINCT TOWNSHIP_RANGE
              FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
              ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
              ORDER BY TOWNSHIP_RANGE
    </CFQUERY>
    Notice I removed any mention of SECTION, because it's irrelevant to generating a unique list of TOWNSHIP_RANGE.  Also, GROUP BY is not needed, but an ORDER BY will sort the records in alphanumeric order.
    Then you need to modify your code where you generate the option list for the first pulldown:
    <option value="#get_Main_Group.TOWNSHIP_RANGE#" <cfif StrucKeyExists(form,'select_Main_Group') AND form.select_Main_Group eq "#get_Main_Group.TOWNSHIP_RANGE#">selected</cfif>>#get_Main_Group.TOWNSHIP_RANGE#</option>
    Here I did a couple of things beside changing SECTION references to TOWNSHIP_RANGE .  It's a good idea to add the query name prefix to column names when you output them so that you avoid collisions with variables that have the same name.  I also reduced your <CFIF> statements to one compound statement for simplicity, and replaced the IsDefined with a StructKeyExists function.  This is considered to be better practice and won't throw an error when used in a compound statement (if you kept the IsDefined statement and tried that in a compound selection, it can sometimes throw errors if the variable in the IsDefined doesn't exist).
    Now, your second query should be something like:
    <cfquery name="get_Sub_Group" datasource="ds" dbtype="odbc">
            SELECT DISTINCT SECTION
            FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
                        ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
            WHERE TOWNSHIP_RANGE = '#page.select_Main_Group#'
            ORDER BY SECTION
       </cfquery>
    Here I changed the WHERE clause to filter based on the TOWNSHIP_RANGE you selected in the first pull-down.  This should now return a list of SECTIONs that match the TOWNSHIP_RANGE selected in the first pull-down.
    Lastly, some minor changes to the option list for the second pulldown:
      <option value="#get_Sub_Group.SECTION#">#get_Sub_Group.SECTION#</option>
    One other thing I noticed.  If you are on ColdFusion 8 or 9, the dbytpe="odbc" is no longer needed.  I'm assuming you are using an ODBC database connection to something like MS Access.  If so, you can omit the dbytype entirely.  It's only needed now if you do query-of-query queries, where it would be dbtype="query".
    HTH,
    -Carl V.

  • Power Query: Expand multiple lists within a row at once

    I have a json file that I've been fairly successful importing into excel using power query. My issue now is dealing with lists in multiple columns.  I need to figure out how to expand the values of the lists at once so I only add rows once, versus multiple
    times.
    Example:
    Row 1 - Text | List1 {1,1,2,4} | List2 {A,B,B,D} | List3 {W,X,Z,Z}|
    Row 2 - Text | List1 {1,1,2,4} | List2 {A,B,B,D} | List3 {W,X,Z,Z}|
    Row 3 - Text | List1 {1,1,2,4} | List2 {A,B,B,D} | List3 {W,X,Z,Z}|
    When I use Table.ExpandListColumn on the first column (List1), it adds rows to the table. Row1 is expanded into four rows, which is fine but I can only do this one at a time resulting in too many rows being added.  Row 1 is expanded as:
    Text | 1 | List2 {A,B,B,D} | List3 {W,X,Z,Z}
    Text | 1 | List2 {A,B,B,D} | List3 {W,X,Z,Z}
    Text | 2 | List2 {A,B,B,D} | List3 {W,X,Z,Z}
    Text | 4 | List2 {A,B,B,D} | List3 {W,X,Z,Z}
    If you do this again for the next column (list2), it keeps adding rows.  The above example should only have 12 rows. A single row needs to be expanded to look like:
    Text | 1 | A | W
    Text | 1 | B | X
    Text | 2 | B | Z
    Text | 4 | D | Z
    Note, the lists will always be equal in size across a starting row but may be of larger or smaller sizes and can be null.

    You can account for nulls by testing to see if there is a list in the columns, but it would be cleaner to do this using a custom function e.g.
    Create a custom function (query) called TableFromLists, The code would be:
    (value1, value2, value3)=>
    let
        List1 = if Value.Is(value1, type {list}) then value1
         else {value1},
        List2 = if Value.Is(value2, type {list}) then value2
         else {value2},
        List3 = if Value.Is(value3, type {list}) then value3
         else {value3},
        Table = Table.FromColumns({List1,List2,List3})
    in
        Table
    In the code, you test to see if each input value is a list. If so, then each identifier (List1...List3) is assigned the corresponding input value (value1...value3). If not, each identifier is assigned the input value converted to a list (by
    surrounding the input value in braces).
     Then, in the previous step 2, the formula for the custom column would be:
    TableFromLists([List1],[List2],[List3])

  • How to display field value only once in REUSE_ALV_GRID_DISPLAY

    hi experts,
                   i am using REUSE_ALV_GRID_DISPLAY, for alv outpur display.but i want one of the field in output ,not to display the value which is of same, it have to be displayed only once, I mean i have a number which contains multiple line items corresponding, here i want to display the field value only once when it is repeating , for the same header number, how can i achieve it

    Hi,
    check the sample code,
    REPORT  Z_ALV.
    Database table declaration
    TABLES:
      sflight.
    Typepool declaration
    TYPE-POOLS:
      slis.
    Selection screen elements
    SELECTION-SCREEN BEGIN OF BLOCK blk_1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS:
      s_carrid FOR sflight-carrid.
    SELECTION-SCREEN END OF BLOCK blk_1.
    Field string to hold sflight data
    DATA:
      BEGIN OF fs_sflight ,
        carrid   TYPE sflight-carrid,      " Carrier Id
        connid   TYPE sflight-connid,      " Connection No
        fldate   TYPE sflight-fldate,      " Flight date
        seatsmax TYPE sflight-seatsmax,    " Maximum seats
        seatsocc TYPE sflight-seatsocc,    " Occupied seats
      END OF fs_sflight.
    Internal table to hold sflight data
    DATA:
      t_sflight LIKE
       STANDARD TABLE
             OF fs_sflight .
    Work variables
    DATA:
      t_fieldcat TYPE  slis_t_fieldcat_alv,
      fs_fieldcat LIKE
             LINE OF t_fieldcat.
    *START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM get_data_sflight.            " Getting data for display
      PERFORM create_field_cat.            " Create field catalog
      PERFORM alv_display.
    *&      Form  create_field_cat
          Subroutine to create field catalog
          There is no interface paramete
    FORM create_field_cat .
      PERFORM fill_fieldcat USING   'Carrier Id'    'CARRID'   '2'.
      PERFORM fill_fieldcat USING   'Connection No' 'CONNID'   '1'.
      PERFORM fill_fieldcat USING   'Flight Date'   'FLDATE'   '3'.
      PERFORM fill_fieldcat USING   'Maxm.Seats'    'SEATSMAX' '4'.
      PERFORM fill_fieldcat USING   'Seats Occ'     'SEATSOCC' '5'.
    ENDFORM.                                    "create_field_cat
    *&      Form  fill_fieldcat
          Subroutine to fill data to field column
         -->p_seltext      Column label
         -->p_fieldname    Fieldname of database table
         -->p_col_pos      Column position
    FORM fill_fieldcat  USING
                        p_seltext    LIKE fs_fieldcat-seltext_m
                        p_fieldname  LIKE fs_fieldcat-fieldname
                        p_col_pos    LIKE fs_fieldcat-col_pos.
      fs_fieldcat-seltext_m  = p_seltext.
      fs_fieldcat-fieldname  = p_fieldname.
      fs_fieldcat-col_pos    = p_col_pos.
      APPEND fs_fieldcat TO t_fieldcat.
      CLEAR fs_fieldcat.
    ENDFORM.                    " fill_fieldcat
    *&      Form  get_data_sflight
          Subroutine to fetch data from database table
          There is no interface parameter
    FORM get_data_sflight .
      SELECT carrid
             connid
             fldate
             seatsmax
             seatsocc
        FROM sflight
        INTO TABLE t_sflight
       WHERE carrid IN s_carrid.
    ENDFORM.                    " get_data_sflight
    *&      Form  alv_display
          Subroutine for ALV display
          There is no interface parameter
    FORM alv_display .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          it_fieldcat   = t_fieldcat
        TABLES
          t_outtab      = t_sflight
        EXCEPTIONS
          program_error = 1
          OTHERS        = 2.
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " alv_display
    End of code

  • Transition executed only once in a TableRow

    h1. SCENARIO
    h3. Model
    /* Model is a Person containing a flag active */
    class Person {
       private Boolean active = false;
       /* more fields and methods */
    h3. View
    /* The View is implemented in FXML */
    class View extends TableView<Person> {  }-----
    h3. Service backend
    class Service implements Observable {
       public void run(){
          Person person = new Person();
          person.setActive( Math.random() > 0.5 ? true : false );
          setChanged();
          notifyObservers(person);
    h3. AS IS ViewController
    /* ViewController observes the service which sends back Person with a randomly changed flag [true or false] */
    class ViewController implements Observer {
    TableView table;
    public void initialize(URL url, ResourceBundle rb){
    /* some code before */
    /* Implemented with datafx library */
    table.setRowFactory(new Callback<TableView<Person>, TableRow<Person>>() {
                @Override
                public TableRow<Person> call(TableView<Person> p) {
                    final CSSTableRow rowCell = new CSSTableRow() {
                        @Override
                        public void getCssState(List s) {
                            super.getCssState(s);
                            if(getItem() == null || s == null){
                                return;
                            if ( !((Person) getItem()).isActive() ) {
                                s.add("active");
                                FadeTransition fadeTransition = FadeTransitionBuilder.create()
                                        .duration(Duration.seconds(2))
                                        .node(this)
                                        .fromValue(0.1)
                                        .toValue(1)
                                        .build();
                                fadeTransition.play();
                    rowCell.getStyleClass().add("table-row");
                    return rowCell;
    /* some code after */
    }h4. Main Problem in AS-IS:
    <font color="green" face="courier" size="3"> The animation animates for every event occurs in the table (click on a row, hover on a row and so on) </font>
    h3. WANNA BE ViewController
    <font color="blue" face="courier" size="3">
    <li>Apply the transition when the service sends the updated Person.</li>
    <li>Apply the transition to the row which this person belongs to.</li>
    </font>
    class ViewController implements Observer {
        public void update(Observable obj, Object message) {
            if (message instanceof Person) {
                Person p = (Person) message;
    /* ----> 1. Find the row of this current person sent by service */
    /* ----> 2. Apply the transition only once in the row found */
    }Edited by: valerio.massa on 29-ago-2012 2.51

    I just dont want to raise the animation via rowfactory, is that possible?
    I would like to find a "better" (stylish) way to launch the animation (for example in the update(){} method, which is better theoretically speaking)

  • How to make for loop pass only once in a next() method

    Good Day!
    Can anyone help me or suggest any idea to resolve my problem with the below code, wherein it will only pass the for loop only once. I already tried inserting the for loop in side the if (sqlset4.isFirst()) condition but the problem is it only retrieved the first row of the resultset.
    Cheers!
                   Statement sOutput = consrc.createStatement();
                            ResultSet sqlset4 = sOutput.executeQuery(xquery);
                            ResultSetMetaData rsMetaData = sqlset4.getMetaData();
                            int numberOfColumns = rsMetaData.getColumnCount();
                            String writefld = "";
                            while (sqlset4.next()) {
                                 writefld = "";
                                 for (int i = 1; i <= numberOfColumns; i++) {
                                     if (xxformatid.equals("1") || xxformatid.equals("3")) {
                                         writefld = writefld + "sqlset4.getString(" + i + ").trim()" + "|";
                                writefld = writefld.substring(0, writefld.length() - 1) + ")";
                                output.write("\r\n");
                                output.write(writefld);
                            output.close();I am using Netbean IDE 6.8
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi

    Hi everyone!
    What I actually trying to do is that I have a multiple tables and from these tables I'm going to write each of it into a flatfile that is a pipe delimeted that is why I have to make a loop to know how many fields I am going to write. The code that was attached are actually working, my only concern is that it will take a longer time of processing cause every record of a table it will pass to the for loop(checking how many column) wherein number of column/ were already known on the first loop.
    Hi kajbj,
    I think what your trying to explain is almost the same with below code which i had already tried. The problem with this is that the every loop of the outer loop data retrieve is only the data of the first record.
                   Statement sOutput = consrc.createStatement();
                            ResultSet sqlset4 = sOutput.executeQuery(xquery);
                            ResultSetMetaData rsMetaData = sqlset4.getMetaData();
                            int numberOfColumns = rsMetaData.getColumnCount();
                            String writefld = "";
                            while (sqlset4.next()) {
                                 writefld = "";
                                 if (sqlset4.isFirst()) {
                                    for (int i = 1; i <= numberOfColumns; i++) {
                                        if (xxformatid.equals("1") || xxformatid.equals("3")) {
                                            writefld = writefld + "sqlset4.getString(" + i + ").trim()" + "|";
                                writefld = writefld.substring(0, writefld.length() - 1) ;
                                output.write("\r\n");
                                output.write(writefld);
                            output.close();

Maybe you are looking for