Using an IF Statment to combine three columns

Post Author: smcbride
CA Forum: Data Connectivity and SQL
I'm trying to combine three columns inorder to use the one column in a crosstab table.
I'm trying to use an IF statment to do this but it's not working. can some one help me with this. this is the formula i used in access, but i'm not sure how to convert into a SQL stamtent. please helped.
if ([field one]="", if ([field two]=0,[field three],[field two]), [field one])
thanks,
Sydney

Post Author: smcbride
CA Forum: Data Connectivity and SQL
thank you, that seems closer then were i was before. i put this in the formula section and it's asking for a boolean around one of the values, what do i do with that?
thanks,
Sydney

Similar Messages

  • Photo Gallery combined with three column CSS

    Hi, I am trying to implement your photo gallery into our
    school site and I am having trouble with the layout. I am using a
    three-column layout created with CSS and JS, and then placing the
    photo gallery inside of this. What happens is when you pull up the
    page the three column layout does not position everything correctly
    until you resize the browser window (ever so slightly). Help, have
    been staring at CSS and JS code now for about a month and cannot
    get it to behave, any help would be greatly appreciated. Thanks.
    HSPVA Photo
    Gallery

    "kjuliff" <[email protected]> wrote in message
    news:eqij22$are$[email protected]..
    >I can reproduce your problem, gnd4evr&evr. I have XP
    an IE7 and FF2.
    >It's fine
    > in FF2 but not in IE7.
    >
    > I have a similar problem, and I think it's related. This
    problem
    > really needs
    > addressing!
    >
    > Go to
    http://www.coolabah.com/spry/demos/gallery/
    and look at the
    > bottom of
    > the page (in either IE or FF). You will see a google
    adsense div.
    > Although it
    > is specified in it's div tab as being 15 px in height,
    it takes up
    > much more
    > than that.
    >
    > I HAD wanted to have these google links at the top of my
    gallery, but
    > cannot
    > as I cannot force the div to be only 15px in height.
    >
    > I posted this problem a few weeks ago but no one
    answered.
    Your Google ads are in an iframe. This rule will get you
    started
    iframe {
    height: 2em !important;
    position: absolute;
    top: 650px;
    You can leave the position static if you like, and it will
    move up and
    down with your images - I found that a bit distracting,
    though. If you
    leave it static, use a top-margin to establish space between
    your image
    and the ads.
    The !important notation is required for the height,
    indicating either a
    conflict somewhere in your markup or CSS, or poor Google code
    (not
    uncommon).
    Al Sparber - PVII
    http://www.projectseven.com
    Extending Dreamweaver - Nav Systems | Galleries | Widgets
    Authors: "42nd Street: Mastering the Art of CSS Design"

  • What do I do if three columns make up what is to be used for ScdOriginalID?

    I have a table where three columns in the source table uniquely identifies the record at the business level. 
    Do I now have to go back and create a derived column identifying all three columns in the ETL package just so I can use it in SSAS?  

    Hi T,
    A common solution is to insert the rows into a new table with an identity column and a unique constraint on the 3 columns. However, if these 3 columns are also in your fact table, there is no need to create a synthetic key. SSAS is quite happy for a dimension
    (or any attribute for that matter) to have a composite key.
    Hope that helps,
    Richard

  • How to merge three columns values to single row values in sql server 2008

    Hi Frds.....
    I have three quantity in my table.
    Quantity1,quantity2,quantity3
    this three quantity have different values
    ex:
    quantity1 = 1000,quantity2=2000,quantity3=3000
    the three column combine 2 display in single row values. this values display in one by one.
    ex: quantity
         1000
         2000
         3000

    You will need to use the UNPIVOT operator:
    DECLARE @example TABLE
    Id int NOT NULL IDENTITY(1,1),
    Quantity1 int,
    Quantity2 int,
    Quantity3 int
    INSERT INTO @example VALUES (1000, 2000, 3000), (4000, 5000, 6000);
    SELECT * FROM @example;
    SELECT Id, Quantity, QuantityType
    FROM @example
    UNPIVOT
    Quantity FOR QuantityType IN (Quantity1, Quantity2, Quantity3)
    ) AS u;
    Output:
    (2 row(s) affected)
    Id Quantity1 Quantity2 Quantity3
    1 1000 2000 3000
    2 4000 5000 6000
    (2 row(s) affected)
    Id Quantity QuantityType
    1 1000 Quantity1
    1 2000 Quantity2
    1 3000 Quantity3
    2 4000 Quantity1
    2 5000 Quantity2
    2 6000 Quantity3
    (6 row(s) affected)

  • First, Last name fields in Numbers -- Three columns on iWeb page

    I'm new to this (both Numbers and iWeb) and I'm trying to help someone with their page (it's for a local candidate).  They have an excel spreadsheet with names and a bunch of other stuff.  they want to put the list of first and last names on their "supporters" webpage, separated by a space, without having to do it manually -- at this point about 900 such names.
    I can get the names out of Excel and into Numbers, obviously.  And I think I know how to get the list into iWeb, if I can generate it (using an iWeb snippet, which I'd also love help with if anyone here knows THAT as well).
    What I can't seem to do is create a list, in three columns, with First name (single space) last name.  Whatever I put in the formula bar seems not to do anything. And I haven't even BEGUN to figure out how to generate the three-column list.
    Any help would be gratefully appreciated.  As dunce-worthy as possible -- believe me, I won't be offended if anyone talks down to me.

    Hi d,
    I think it's the "three column specification that's throwing me. You might need to clarify that.
    The names are currently entered with First names in one column and Last names in the adjacent column. Here's a way to combine the first and last names into a "full name".
    In the "Full" column, the formula is:
    =B&" "&C
    In Last, First, the formula is:
    =C2&", "&B
    To list the names in a three column table in iWeb, you may need to start with a three column table in Numbers. This one pulls the names from column D (Full) of the table above, and distributes them into three columns. The original table has had four names added, and has been sorted.
    Note that the original table has been named "Data".
    The Data table contains the formula(s) shown above.
    The second table, "Aux", calculates the number of cells needed in each of the three columns so that no column is more than one cell longer than the shortest. Doing this calculation in an auxiliary table greatly simplifies the formulas needed in the final table.
    This table contains a single formula, entered in B2, and filled right to D2. Note that A2 is referenced in the formulas in the final table, "3 Columns". A2 may be empty, contain text, or contain the number zero.
    B2 (and fill right): =QUOTIENT(COUNTA(Data :: $C),3)+IF(MOD(COUNTA(Data :: $C),3)>COLUMN()-2,1,0)
    The third table, "3 Columns" displays the names in three columns.
    It contains a single formula, placed in A1 and filled right to column C and down to row 10.
    3 Columns::A1 (and fill right and down): =IF(ROW()<=Aux::B$2,OFFSET(Data :: $A$1,SUM(Aux::$A$2:A$2,ROW()),3),"")
    Descriptions and further examples for the functions used may be found in the iWork Formulas and Functions User Guide. The guide may be downloaded via the Help menu in Numbers.
    Regards,
    Barry

  • How do I combine three itune accounts into one? Then have three different family member have three different log-in's to sync many different devices to the same itune account ?

    How do I combine three itune accounts into one? Then how do I set up three users for the one Itunes account on ONE Mac Pro Computer with one Itunes program? We are one family with 3 I-Phones, 2- I-Pads, 2- Lap tops and 3-I-Pods and would like to use one main computer to sync all our devices to.

    "How do I combine three itune accounts into one? "
    You cannot.
    "Then how do I set up three users for the one Itunes account on ONE Mac Pro Computer with one Itunes program?"
    You can copy all of the music to one computer and set up different users see:
    Learn how to set up additional user accounts.
    How to use multiple iPods, iPads, or iPhones with one computer

  • How do I build a model calendar page with three columns and two or three lines per day?

    I am trying to build a Page that has three columns with lines in each column that will be numbered according to each month. Then each month I plan to type in the birth dates, anniversaries, special occasions of my family. There will be over 120 entries.Thus far when I take a blank page from Pages and begin to type in the event, it remove the underline I had put in. I imagine I should be able to build one model page and then replicate it as I go from month to month. Thus far I have been unsuccessful. Any help will be sincerely appreciated.
    Ken Melley

    You could use a Table to set up your information in Pages 5.2, unfortunately it has a bug that makes the table moire or less unusable after a few pages.
    Contacts stores all your Address Book information. NJust add all the name, telephone number, address etc and there is an additional field for birthdays, anniversaries etc. Anything else you can put in the notes:
    http://computers.tutsplus.com/tutorials/contacts-101-a-beginners-guide-to-contac ts-on-os-x--mac-51751
    Calendar lets you run separate sets of dates in a desktop calendar, which can include birthdays, anniversaries or any single or recurring events. Any names you use here will be cross referenced to Contacts.
    http://www.macworld.com/article/2057229/get-to-know-os-x-mavericks-calendar.html
    Peter

  • Help with "clearing" in three column format

    The code is pasted in below of a three column page I have created.  However, the background color in the sidebars does not reach to the footer it follows the content.  I know that I need to "clear" the columns but as a newbie I'm not sure how to do so.  Any help would be appreciated.
    Thanks!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body  {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    background: #CCC;
    margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    padding: 0;
    text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    color: #000000;
    .thrColLiqHdr #container {
    width: 80%;  /* this will create a container 80% of the browser width */
    background: #FFFFFF;
    margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    border: 1px solid #000000;
    text-align: left; /* this overrides the text-align: center on the body element. */
    .thrColLiqHdr #header {
    background: #DDDDDD;
    padding: 0 10px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
    .thrColLiqHdr #header h1 {
    margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
    padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
    /* Tips for sidebars:
    1. Since we are working in percentages, it's best not to use side padding on the sidebars. It will be added to the width for standards compliant browsers creating an unknown actual width.
    2. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".thrColLiqHdr #sidebar1 p" rule.
    3. Since Explorer calculates widths after the parent element is rendered, you may occasionally run into unexplained bugs with percentage-based columns. If you need more predictable results, you may choose to change to pixel sized columns.
    .thrColLiqHdr #sidebar1 {
    float: left; /* this element must precede in the source order any element you would like it be positioned next to */
    width: 30%; /* since this element is floated, a width must be given */
    background: #3399FF; /* the background color will be displayed for the length of the content in the column, but no further */
    padding: 15px 0; /* top and bottom padding create visual space within this div  */
    .thrColLiqHdr #sidebar2 {
    float: right; /* this element must precede in the source order any element you would like it be positioned next to */
    width: 30%; /* since this element is floated, a width must be given */
    background: #3399FF; /* the background color will be displayed for the length of the content in the column, but no further */
    padding: 15px 0; /* top and bottom padding create visual space within this div */
    .thrColLiqHdr #sidebar1 p, .thrColLiqHdr #sidebar1 h3, .thrColLiqHdr #sidebar2 p, .thrColLiqHdr #sidebar2 h3 {
    margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
    margin-right: 10px;
    /* Tips for mainContent:
    1. the space between the mainContent and sidebars is created with the left and right margins on the mainContent div.
    2. to avoid float drop at a supported minimum 800 x 600 resolution, elements within the mainContent div should be 300px or smaller (this includes images).
    3. in the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs.
    .thrColLiqHdr #mainContent {
    margin: 0 24% 0 23.5%; /* the right and left margins on this div element creates the two outer columns on the sides of the page. No matter how much content the sidebar divs contain, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the sidebar spaces when the content in each sidebar ends. */
    .thrColLiqHdr #footer {
    padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
    background:#DDDDDD;
    .thrColLiqHdr #footer p {
    margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
    padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
    /* Miscellaneous classes for reuse */
    .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    float: right;
    margin-left: 8px;
    .fltlft { /* this class can be used to float an element left in your page The floated element must precede the element it should be next to on the page. */
    float: left;
    margin-right: 8px;
    .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain its child floats */
    clear:both;
        height:0;
        font-size: 1px;
        line-height: 0px;
    a:link {
    text-decoration: none;
    color: #000;
    a:visited {
    text-decoration: none;
    color: #000;
    a:hover {
    text-decoration: none;
    a:active {
    text-decoration: none;
    -->
    </style><!--[if IE]>
    <style type="text/css">
    /* place css fixes for all versions of IE in this conditional comment */
    .thrColLiqHdr #sidebar2, .thrColLiqHdr #sidebar1 { padding-top: 30px; }
    .thrColLiqHdr #mainContent { zoom: 1; padding-top: 15px; }
    /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]--></head>
    <body class="thrColLiqHdr">
    <div id="container">
    <div id="header">
        <h1>Header</h1>
      <!-- end #header --></div>
      <div id="sidebar1">
    <h3>Today's Top Health News</h3>
        <p>Vitmains C and E cleared in melanoma scare. </p>
    <p>Older men often binge drink, too</p>
    <p>Short kids are psychologically OK</p>
    <p>New drug for schizophrenia and bipolar disorder approved</p>
    <p>Mediterrenean Diet plus exercise lowers risk of Alzheimer's Disease</p>
    <p>Not enough sleep may raise the risk of diabetes</p>
      <!-- end #sidebar1 --></div>
      <div id="sidebar2">
        <h3>Podcasts: In-depth, awarding winning Radio Health Journal Reporting</h3>
        <p><img src="../graphics/I-am-safe-now.jpg" width="106" height="80" align="left" />
    <p>Perinatal Hospice: Giving meaning and easing grief when birth to death is measured in hours </p>
    <p>Medical Mystery Shoppers: Fake patient who keep healthcare quality high</p>
    <p>Pediatric Live Transplants: Children can receive a slice from a living adult donor</p>
    <p>The Selling of healthcare reform: Why revved up rhetoric matters more than facts</p>
    <p>Early Alzheimer's diagnosis: The benefits of early treatment</p>
    <p>Dementia drugs: Are medications too common in nursing homes?</p>
    <p>Pregorexia: Anorexia while pregnant-more common than we think</p>
    <p>Mop men: People who clean up after unexpected death</p>
    <p>Gout: The return of the "disease of kings"</p>
    <p>Prevention and healthcare reform: How much money can prevention really save?</p>
      <!-- end #sidebar2 --></div>
      <div id="mainContent">
        <h1> Featured Content </h1>
        <p><a href="http://speakaboutbipolardepression.com/">The economy is leadiny many Americans to feel additional stress.  This is particularly concerning for the more than 8 million Americans with bipolar disorder.</a></p>
        <p>As modern medicine extends life expectancy, prevelance of Alzheimer's Disease in the U.S. is expected to skyrocket from about 5 million to 16 million in 2050.  Understanding risk factors is more important than ever. </p>
        <p>You might thing a blood transfusion ordered by a physician would be safe and effective.  But a new analysis by an international panel sbows most transfusions have little benefit.  In fact, they may be dangerous.</p>
        <h2>Information about our program's guests </h2>
        <p>Developing A Brain Eraser: Dr. Andre Fenton</p>
    <p>Too sexy, Too soon: Kids, the media, and sex: Dr. Diane Levin, author of "So Sexy So Soon: The new sexualized childhood and what parents can do to protect their kids"</p>
    <p>Everything You Always Wanted To Know About...Death: Harold Schechter, author of "The Whole Death Catalog: A Lively Guide To The Bitter End"</p>
    <p>Borderline Personality Disorder: Randi Kreger, cofounder of BPDcentral.com</p>
    <!-- end #mainContent --></div>
    <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
      <div id="footer">
        <p>Footer</p>
      <!-- end #footer --></div>
    <!-- end #container --></div>
    </body>
    </html>

    Are you posting to the right forum? This is a Designer form where we are working with PDF forms. This looks like HTML!
    Paul

  • Deleting duplicate rows based on three columns in Oracle 8i

    Hi all,
    The database we use is Oracle 8i.
    The query below raises the too_many_rows exception when I launch an application. So I want to delete the duplicated rows :
    select polarisation_1, polarisation_2
    into v_pol1_tech, v_pol2_tech
    from v_cfh_lien_element
    where nom_lien = p_nom_lien
    AND num_canal_1 = p_num_canal_1
    AND freq_emise_1 = p_freq_emise_1;
    Notice that with many possible values of the parameters p_nom_lien, p_num_canal_1 and p_freq_emise_1 then the exception is raised.
    So how to delete generally the duplicated rows based on the three columns "nom_lien" , "num_canal_1" and "freq_emise_1" ?
    Thank you very much indeed.

    Check the other thread with same question deleting duplicate rows based on three columns in Oracle 8i

  • Problem with displaying same field in three columns

    Hi
    I am using reports developer 11g and I have created a report which displays only one field (column), which is id_number as output but I have a problem now.
    I would like to display the id_number in three columns on one page to save paper, that is, I want to show the first 20 (1 - 20) id_numbers in one column going down, then display the next 20 id_numbers (21 - 40) on the second column on the same page and the next 20 (41 - 60) on the third column still on the same page. If there are more than 60 id_numbers, they should be printed on the next page again in three columns, and so on until all the id_numbers are displayed. How can I achieve this? Could you please assist me?
    Thanks.

    Andreas, I think I am missing something here. I have done what you have said but still the id_numbers are all being displayed
    in the first column and jumps on to the next page without displaying the id_numbers across the page in columns.
    My data model contains a group with not only the id_number but has other fields which I am not displaying.
    I am only using the other fields just to use them in conditions to select only id_numbers which meet a certain criteria which I then display in the report.
    I have created a repeating frame for that group and changed the orientation property to Down/Across. Within that frame, I have a field for the id_number
    which I want displayed in three columns, running across the page as I have already told you. Please help.
    Thanks.

  • If a footnote spreads across three columns, does it always fill the middle one?

    Not a scripting question per se, but it sure affects the script I'm writing. I'm trying to detect and address collisions between footnotes and other items on a page. I think in the world of documents I inhabit, I'm not going to run into such a long footnote, but the moment you start thinking that way one pops out of the woodwork and smacks you in the face.
    I guess the reason for my question is some sense that maybe there's a kind of column-balancing that goes on with footnotes? No of course not. I think I know the answer to my own question: Yes! But I wonder if there's a circumstance where it's not true.
    Anyone have any instances of a footnote spreading to three columns without filling the second one? For example, could keeps cause a space to appear at the top, enough to allow some story text in there?
    Wait: InDesign hates empty text columns -- is one that only has a partial footnote in it considered empty? In the case where there is only a partial footnote, myTextColumn.footnotes.length returns 0.
    Perhaps I should construct some examples to see what happens.
    Dave

    Well, it didn't take much experimentation to discover that the answer is no. The middle column in a three-column frame has zero or one line of text from the main story along with the text from the long footnote. And this without any keeps at all. It looks really ridiculous when there is just one line there, although in the case I was working with I used the default gap above the notes of zero. Let's try with a gap there ...
    Same thing happens when a gap is called for. You get one or no lines at the top of the second column, depending on the height of the frame.
    Dave

  • How to edit the "Oracle Three Column Layout" page template?

    Hello all,
    My question is very simple: how can one edit the Oracle Three Column Layout page template? I tried searching the file system for a file called "threeColumnTemplate.jspx" but I cannot seem to find it. Is it hidden into a jar file of some kind? Or at least can anyone tell me the name of the nice component located in the upper right corner that displays the loading activity?
    Thanks.

    Extract oracle-page-templates.jar with winzip & browse to location oracle/templates
    open the file threeColumnTemplate.jspx using jdeveloper.
    after you open it , you can edit the logo , save the changes & create this jar again or save it to the zip which will automatically update the jar.

  • Displaying 20 checkboxes in three columns

    In order to display a database item (table 1) item as check box.
    the values of chexk boxes are the results of another table with 20 records (table2), this I will have 20 check box in my form.
    I proceed like the following :
    I created a region with type is SQL Query ,
    the query is :
    select x.name, x.code
    from (select wwv_flow_item.display_and_save(1, table2.name) as name, htmldb_item.checkbox (2, table2.code, null, decode (table1.code_..., null, 0, table2.code)) as code
    from table2 table2 left outer join table1 table1
    on table2.code = table1.code_..and table1.code_ = :page_CODE) x
    ANYWAY, the I have my result, BUT ,
    because I have 20 cheeck boxex, I want to display them
    in a way that they appear in three columns.
    How can I change my query or how can I do it???????
    NOTE : using Lists is not a solution for me!!!!
    Thanks for any Help!

    First "392451", asking Raj the same question twice within a span of 16 hours will probably not get your question answered any faster. He is only one man and has a lot of questions coming in, not to mention other job responsibilities. Second, he's on the West coast, so is not up yet.
    Now on to your answer. I've used this phrase before, and it definitely applies here: This is not an HTML DB 101 answer. You asked a challenging question (and a good one at that), so the answer may challenge you a bit too. I'll use the emp table which has 14 rows for this example, but this should work for any table.
    First, lets get the empno and ename columns to use for our checkboxes. I'm going to create 2 additional columns, col_num and grp_by to use in the next step. The text description of "col_num" from the inside-out is: take the rownum, now divide it by 3 and give me the remainder (mod(n,3)) which will return 0,1, or 2, then replace any of the 0's with 3's so it will return 1,2 or 3. We will use these numbers for our 3 columns in the next step.
    The grp_by column is simply the rownum divided by 3, rounded up to the next highest integer. The results of rownum divided by 3 for the first 3 rows are .33, .66, and 1. When you apply ceil(n) to these, they all become 1. This will give us a column to group by in the final step.
    All of these queries can be run in SQL Workshop, assuming the schema you run it as has access to the emp table.
    OK, let's start with the first query:
    select empno,ename,
           replace(mod(rownum,3),0,3) col_num /* alias to col_num */,
           ceil(rownum/3) grp_by /* alias to grp_by */
          from(
                select empno,ename
                  from emp
                 order by ename)
         EMPNO ENAME      COL_NUM                                      GRP_BY
          7876 ADAMS      1                                                 1
          7499 ALLEN      2                                                 1
          7698 BLAKE      3                                                 1
          7782 CLARK      1                                                 2
          7902 FORD       2                                                 2
          7900 JAMES      3                                                 2
          7566 JONES      1                                                 3
          7839 KING       2                                                 3
          7654 MARTIN     3                                                 3
          7934 MILLER     1                                                 4
          7788 SCOTT      2                                                 4
          7369 SMITH      3                                                 4
          7844 TURNER     1                                                 5
          7521 WARD       2                                                 5Now, let's pivot the rows to columns. Any row with a value of col_num = 1 will be in the first column, col_num=2 will be in the second column, etc...
    select decode(col_num,1,empno||'-'||ename) col1,
           decode(col_num,2,empno||'-'||ename) col2,
           decode(col_num,3,empno||'-'||ename) col3
      from(
        select empno,ename,
               replace(mod(rownum,3),0,3) col_num /* alias to col_num */,
               ceil(rownum/3) grp_by /* alias to grp_by */
              from(
                    select empno,ename
                      from emp
                     order by ename))
    COL1         COL2        COL3
    7876-ADAMS 
                 7499-ALLEN
                             7698-BLAKE
    7782-CLARK 
                 7902-FORD
                             7900-JAMES
    7566-JONES 
                 7839-KING
                             7654-MARTIN
    7934-MILLER
                 7788-SCOTT
                             7369-SMITH
    7844-TURNER
                 7521-WARDNow, we need to "compress" our results so the empty gaps are filled in. This is where the grp_by column comes in. I'll add a max() around the the_col1 etc column so I can use a group by on the query. I will then group by the grp_by column:
    select max(decode(col_num,1,empno||'-'||ename)) col1,
           max(decode(col_num,2,empno||'-'||ename)) col2,
           max(decode(col_num,3,empno||'-'||ename)) col3
      from(
        select empno,ename,
               replace(mod(rownum,3),0,3) col_num /* alias to col_num */,
               ceil(rownum/3) grp_by /* alias to grp_by */
              from(
                    select empno,ename
                      from emp
                     order by ename))
    group by grp_by
    COL1         COL2          COL3
    7876-ADAMS   7499-ALLEN    7698-BLAKE
    7782-CLARK   7902-FORD     7900-JAMES
    7566-JONES   7839-KING     7654-MARTIN
    7934-MILLER  7788-SCOTT    7369-SMITH
    7844-TURNER  7521-WARD    Now, simply replace the empno concatenated to ename with a call to htmldb_item.checkbox. Use the "col_num" column for the value p_idx,and the empno column for the value of p_value. Then concatenate in initcap(ename) so the checkbox has a label:
    select max(decode(col_num,1,htmldb_item.checkbox(col_num,empno)||initcap(ename))) col1,
           max(decode(col_num,2,htmldb_item.checkbox(col_num,empno)||initcap(ename))) col2,
           max(decode(col_num,3,htmldb_item.checkbox(col_num,empno)||initcap(ename))) col3
      from(
        select empno,ename,
               replace(mod(rownum,3),0,3) col_num /* alias to col_num */,
               ceil(rownum/3) grp_by /* alias to grp_by */
              from(
                    select empno,ename
                      from emp
                     order by ename))
    group by grp_by
    (Can't display the results here.  Try in SQL Workshop.)Good luck,
    Tyler

  • JSF Page - Three Column Layout

    Hi all,
    I'm trying to create a JSF page with Oracle Three Column Layout but am only one column in the visual design view. Moreover, in the visual design view, i cannot see the normal Oracle logo on the left corner.
    Heres he steps i used:
    1. Right click ViewController and select New.
    2. Under Web Tier i click JSF and selected JSF Page then click OK
    3. In the Create JSF Page dialog, i renamed the page and in Page Template drop down i select Oracle Three Column Layout and checked Create as XML Document then click OK
    I'm new in JDeveloper and if theres any steps i'm missing then please let me know.
    Thanks in advance
    Stoneiidol

    Hi,
    Mostly a Jdeveloper design view problem. Did you try closing and reopening the page? Or restarting JDeveloper?
    The code Generated in my Jdev is:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx"
    id="pt1">
    <f:facet name="center"/>
    <f:facet name="header"/>
    <f:facet name="end"/>
    <f:facet name="start"/>
    <f:facet name="branding"/>
    <f:facet name="copyright"/>
    <f:facet name="status"/>
    </af:pageTemplate>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    What Amit said is alos true.
    Regards,
    Venkat

  • Long list of names - three columns

    Hi,  I am tryhing to do the follow:
    -  I have a long list of names which need to be continually updated.
    -  List is in Alphbetical order
    -  As the list is so long I want to have three columns per page.
    -  How can I keep updating and making sure they are in alphabetical order without having to keep organising them.
    If you select and put into ascending order it only does one column at a time not the whole list?
    Please can you help.
    Thanks.
    Ozpaws

    Hi Oz,
    I'm disappointed that we haven't heard from you since my (and Jerry's and Jeff's) most recent posts.
    I've done a bit of further exploring since then. Here's a sample of the results, using the same data as in my earlier suggestion, but with the result data moved into two three-column tables.
    The result tables (Print3x, on Sheet 1, on the right, are scaleable to the size that will fit one to a page, and additional result table need only a simple edit to the formula before it is filled into the new table. The extra column on Print3a is required to avoid a self-reference error. All Print3x tables must contain the same number of rows.
    Updating, as previously, requires a sort of the Data table (on Sheet 2, on the left) after new entries are made. Resorting of the result tables is automatic.
    The small table, Counts, on Sheet 2, is for calculations related to the transfer, and may be hidden, or moved to a third sheet, if desired.
    Formulas:
    Counts::B2: =COUNTA(Data3 :: $A)
    Counts the number of names in the list.
    Counts::B3: =ROWS(Print3a :: $D)-1
    Counts the number of rows (including the header row) in Print3a. Subtracts 1 to obtain the number of rows to fill with names.
    Counts::B4: =COLUMNS(Print3a :: $1:$1)-1
    Counts the number of columns (including the extra column) in Print3a. Subtracts 1 to obtain the number of columns to fill with names.
    Counts::B5: =B3*B4
    Calculates the number of cells used when the table is full.
    Print3a:
    A2, and filled right to column 3 and down to the end of the table:
    =IF(0+ROW()-1+(COLUMN()-1)*Counts :: $B$3<=Counts :: $B$2,OFFSET(Data3 :: $A$1,0+ROW()-1+(COLUMN()-1)*Counts :: $B$3,0),"")
    0+ROW()-1+(COLUMN()-1)*Counts :: $B$3<=Counts :: $B$2
    Compares the number of cells used to this point with the number of names to be filled in. If the number 'used' is less than or equal to the number of names, then:
    OFFSET(Data3 :: $A$1,0+ROW()-1+(COLUMN()-1)*Counts :: $B$3,0)
    Fills the current cell with the next name from the Data table.
    If the number 'used' is greater than the number of names, then:
    places a null string in the cell.
    Print3b:
    =IF((Counts::$B$5+ROW()-1+(COLUMN()-1)*Counts :: $B$3)<=Counts :: $B$2,OFFSET(Data3 :: $A$1,Counts :: $B$5+ROW()-1+(COLUMN()-1)*Counts :: $B$3,0),"")
    This is the same formula as used on Print3a, with the two bold parts replaced as shown to make each new table start at the right place on the Data list.
    For the third Print# table, Counts::$B$5 would be replaced with (2*Counts::$B$5), etc.
    Some difficulty to set up, but fully automatic once in place. To Print, go to Sheet 2, then Print. Limit the pages to print to pages 1 to the count of tables containing names.
    Regards,
    Barry
    PS: I like Jerry's method—simple and easy, requiring only a copy and paste, then setting the Pages document to three columns. The second step could possibly be eliminated by setting up a three column template, and using that for the document to paste into. (NOT tested due to lack of time at the moment)
    B

Maybe you are looking for