Different calculations in the same column.

Hi everyone,
Picture a spreadsheet with the following columns: column A is an unique identifier, columns B to G have different sums of money for every unique identifier in A. You are asked to provide a result in column H for every identifier using columns B-G as input. However, the formula needed for calculating varies from identifier to identifier -for example, the formula for id. 1 is column B + (column C * column D), the formula for id 2 is avg(column C+column F) and so on-.
In a common spreadsheet is easy: you just write the formula in the column H's cells.
Can this be accomplish with pl/sql sql -no matter if it needs dynamic sql to work- or pure old sql?
I've been trying to find a way and, so far, MODEL clause seems to be the only answer -not the best, the simpler o more complex: the only answer- (something I was eagerly waiting because I want to give it a try). However I would like to know if somebody can suggest a different path before going that way.
Thanks in advance for your time and valuable suggestions.
Mariano.

If I understand correctly CASE or DECODE should work.

Similar Messages

  • I am having trouble getting a numbers spreadsheet to hold different formats in the same column.  A column with a date formatted heading will not convert to $ for the cells below.   Any suggestions would help.

    I am having trouble getting a numbers spreadsheet to hold different formats in the same column.  A column with a date formatted heading will not convert to $ for the cells below.   Any suggestions would help.

    Hi Wayne,
    Thank you for this response.  I have tried this but when I start enterring $ amounts some, such as $6.00, go in OK others such as $4.00 appear as a date ie 4 Oct 12.  
    Kind regards
    Paul

  • How can I give different Editors in the same column for the jTable?

    I am having a JTable with 2 columns and 10 rows. In the 2nd column, for the first 2 rows
    I need to show JCheckBox, for nect 2 JComboBox and for remaining JTextField as the editor.
    How can I do this. Thanks in Advance.

    Remember, the parent class of a cell renderer does NOT have to be a Component itself. Most do simply because the end result of the getCellRenderer call is the component itself.
    Create 3 cell renderers, one based off of the checkbox, one based off the combobox, one based off of Object. The Object based one will hold instances of the other two renderers and will be the actual renderer supplied to the JTable. When called, based on the row, it will forward the call to the to the appropriate renderer and return the result of the call.
    Technically, the internal components do not NEED to be renderers themselves, but doing so makes it a lot easier to test them independently of the combined renderer.

  • REPORT WITH CHANGING ITEM ON THE SAME COLUMN

    Hi to all,
    i'm trying to build a report with different item in the same column.
    Is that possible in any way using other Oracle technique?
    i'm not doing anything specific here, only i would like to know if the following possibility exist or not and how can i let apex render the htmldb_item fields 'dynamically'.
    Using this CODE inside a PL/SQL function body returning sql query I obtain the following report content. Such the code of htmldb_item.fields is written, as a field value the HTML_ITEM is not rendered, so only the description of them appear in the report.
    Does somebody know some tricks to make it work?
    Thanx a lot
    1     2     LAST_CALL     htmldb_item.date_popup (4, ROWNUM, FLD_VALUE,'dd/mon/yyyy') VALUE
    21     1     AGE     htmldb_item.text(4,FLD_VALUE,10,10) VALUE
    create or replace FUNCTION FNC_GEN_GUI_ITEM(ITEM_TYPE NUMBER) RETURN VARCHAR2 AS
    STRHTMLDITEM VARCHAR2(4000);
    BEGIN
    CASE ITEM_TYPE
    WHEN 1 THEN STRHTMLDITEM:=' htmldb_item.text(4,FLD_VALUE,10,10) VALUE ';
    WHEN 2 THEN STRHTMLDITEM:=' htmldb_item.date_popup (4, ROWNUM, FLD_VALUE,''dd/mon/yyyy'') VALUE ';
    END CASE;
    RETURN STRHTMLDITEM;
    END FNC_GEN_GUI_ITEM;
    MY TABLE AS FOLLOWS:
    CREATE TABLE "NEWPROJ"."DINFIELDGUI"
    (     "ID" NUMBER NOT NULL ENABLE,
         "FLD_TYPE" NUMBER,
         "FLD_NAME" VARCHAR2(4000 BYTE),
         "FLD_VALUE" VARCHAR2(4000 BYTE),
         CONSTRAINT "DINFIELDGUI_PK" PRIMARY KEY ("ID"));
    Message was edited by:
    Marcello Nocito

    Hi to all,
    i've solved, is very simple using decode inside the select:
    SELECT
    ID,
    FK_HTMLDB_ITEM, DECODE(FK_HTMLDB_ITEM,1,HTMLDB_ITEM.DATE_POPUP(3,rownum,VAL,'dd-mon-yyyy'),2,HTMLDB_ITEM.TEXT(3,VAL)) VALORE
    FROM TESTID
    my table is:
    CREATE TABLE "DEV"."TESTID"
    (     "ID" NUMBER NOT NULL ENABLE,
         "FK_HTMLDB_ITEM" NUMBER,
         "VAL" VARCHAR2(4000 BYTE))
    Bye Bye

  • Two prompts on the same column

    Hi Experts,
    I am trying to define two different prompts (and associate them to two different presentation variables) on the same column. However, when I display the 2 prompts on the same dashboard page, whenever I select a value for the first prompt, the same value is automatically selected for the second prompt.
    Is this normal behavior? How can I do to capture two separate values?
    Thanks,
    Guillaume

    Hi Stijn,
    Thanks for your quick reply.
    I think that's what I have done. I have 2 prompts (Prompt1, Prompt2) on the same column, and respectively associated with presentation variables Var1 and Var2.
    In the request, I refer to '@{Var1}' and '@{Var2}' in my filters. On the dashboard page, I display Prompt1 and Prompt2. But the moment I select a value for Prompt1 and click 'Go', the same value is assigned to 'Prompt2' (and thus to Var2). And if I select a value in Prompt2 and click 'Go', again that same value is selected in Prompt1.
    Bottom line, it looks like a dashboard prompt defined on a specific column can only have one value. Is this correct? And if so, how can I capture 2 different values for the same column and use them as parameters/variable in a request?
    Thanks,
    Guillaume

  • Datagrid scrolling problem when different items are in the same column

    I have a datagrid which I am populating with different items (LinkButtons, Images, Labels). However when there are different types of items in the same column and when i try to scroll everything gets messed up (Images get overlapped with each other or the labels get overlapped with images).
    I am overloading the "IDropInListItemRenderer" to create different types of items in each cell and I am overloding the "updateDisplayList" function
    Any ideas as to why the items get messed up during scrolling? Is there some other preperty of IDropInListItemRenderer that should be overloaded?

    Hi Subeesh Arakkan,
    Thanks. This is the exact problem that I have. Althought my overloaded functions are a little different and Im trying to resolve it. But htis is a good lead.
    Thanks,
    Prashanth

  • Different ItemRenderer's in the same column of a datagrid

    I am using actionscript to read some XML input and dynamically add data into the datagrid.
    Currently I am reading the first row and depending on the data type of the coulmn i am creating the column to be a IntemRenderer of Image, or Link button.
    Now is there anyway of adding some rows to be LinkButton ItemRenderes and some to be Image ItemRenderers, in the same column?
    Any examples are also appreciated

    You can try overriding createColumnItemRenderer
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Can I print several different pics of the same size on one shee  of papert?

    Hi,
    I should like to print a group of several different pics of the same size & resolution on one sheet of (A4) paper eg 6 family photos. There doesn't seem to be a template for this - just two choices of format (both with one large and a few smaller format) and there is no 'Printer' pop up menu.
    I tried to laboriously copy pics to a two column works word processing document (after resizing in a different one so that they would fit in the columns). This is time consuming and when down sizing the pics lose resolution!
    Maybe I can download templates somewhere on the apple site as suggested by apple care but I couldn't find out where. Maybe there is a possibility of doing some contact prints?
    Any help much appreciated - many thanks - John

    Select the 6 photos you want printed in the iPhoto Library or Album window.
    Choose File->Print.
    In the Print dialog box, Select the paper size in the Paper popup menu.
    In the Style popup menu, select N-Up.
    In the Photos per page popup select 6.
    The preview should show what you'll get. I hope its what you wanted.
    Message was edited by: Thomas Emmerich

  • Different artists in the same unique album

    Hi. I have this little question, maybe someone will know how to help me : i'm using the grid view, sorting by genres. then if i click on a genre, i can see what's inside, with the albums covers on the left. this could be very nice, but when an album contains tracks by several artists, itunes makes one line by artist. i don't know how to make that clear. but the result is that only one album is expanded on ten lines, and i can see ten times its cover... what's the point then ? it's not sorting per album but by artist, even when i tell itunes to sort by album.
    could you please help me (if u miraculously understood what i tried to say ? )
    thank u so much!

    Excuse the long post, but hopefully covering all the bases (that I can think of) will help you fix the other issues you are likely to run into as you try to organise your library.
    The iPod (and iTunes to a lesser extent) conflates two or more albums with the same title, most obviously with *Greatest Hits*. On the iPod this can result in one album acting as a combination of two or more. Selecting any cover gives all the tracks of all albums with the same title. The workaround for this "Greatest Hits" bug is to give each album a unique title - I tend to go for *Album - Album Artist* as this reads clearly in the iTunes browser. Alternatively you could use the wording as it appears on the cover, append different numbers of spaces for each different album or set different values for the Sort Album.
    iTunes relies on the Gracenote CDDB database when identifying CD's. This often marks collections or anthologies of an artist's work as a compilation. In iTunes, however, the compilation flag has the logical function of grouping together tracks with the same album name, but different artists on each track, e.g. "Now That's What I Call Metal 666!". These compilations are then all grouped together at the end of cover flow. Most of us however, would expect "Greatest Hits" albums to be listed with the other albums by the same album artist. For albums which are essentially by a single album artist or group it is best to set the appropriate value for the album artist and clear the compilation flag.
    Sadly the iPod ignores the Album Artist field when grouping albums which causes problems when some tracks list guest artists. You can simply mark the entire album as a compilation which seems to be the way iTMS handles it, however that's not an ideal fix. Short of waiting for Apple to address this issue (and as far as I can tell it goes back to the 1st gen. of iPods) we need a workaround. What I do is to put any additional artist info. in square brackets after the song name. E.g. *Track \[Feat. Guest\]* and then set *Artist=Album Artist* for each track. For anthologies where the Album Artist is credited as part of another group, e.g. for Cream tracks on an Eric Clapton anthology, I use *Track \[As Group\]*. For a track where the main Album Artist doesn't receive a credit, e.g. the first track of the Slim Shady LP credited to Jeff Bass, I just set the track name to *Track \[Guest\]* while still setting the artist to the album artist. N.b. I use square brackets to indicate this is not part of the actual song title and also use this style for Mix/Live/Bonus info.
    iTunes may split albums into two or more sections if some tracks from the album have different values for Artist, Album Artist, Album, No. of Discs or Part of a Compilation. Tiny differences such as trailing spaces, accented characters or variants of symbols can sometimes be quite hard to spot. The iPod is also more sensitive to case variations and may split or reorder an album that looks okay in iTunes. Normally overtyping the desired value for each shared field will complete the grouping of the album into one entity. Occasionally, however, this method seems to fail. When this happens I've found that you can force every field to update properly by adding some extra text - e.g. a trailing X, which once applied seems to complete the joining of the tracks into one album. Once this has happened the extra data can be removed and the album should remain properly grouped.
    The Sort Artist, Sort Album & Sort Album Artist fields can be used to override the normal sort order. For example iTunes automatically drops leading prepositions (a/an/the) so "The Beatles" are arranged under "B" instead of "T". Occasionally different tracks from the same album can have different values in these sort fields which can also break up the grouping. Making the sort columns visible in iTunes can help with spotting & correcting such problems.
    Multi-disc albums are often listed as *Album (CD1)* for CD 1, *Album (CD2)* for CD 2 etc. To display these properly using just one cover, each disc should have the correct *Disc X of Y* values set, and then the entire album should be given the single title Album. Being somewhat obsessive I also renumber the tracks sequentially, working backwards from the last track until I reach disc 1.
    tt2

  • Different fonts in the same field

    Is it possible to format a single field with two different fonts. I have concatenated two database columns to get this field. But I want different fonts for the two columns. I could achieve this by using a format trigger and placing some html tags. But this solution only works if the output is in HTML style sheets. It does not work if I want the output to be in PDF. Does anybody know how to achieve it in PDF? Is it possible at all (from what I have seen it isn't). I will be grateful for any help in this direction.
    Thanks
    Janaki

    Hi!
    Try this:
    Let say you have scott/tiger and emp-table and want to concatenate and print ename and job in the same field but with different fonts.
    1. In the Database model you have the columns seperate as usual.
    2. Create a boileplate text field and put &ENAME &JOB in this field.
    3. Select &ENAME and set the right font to it, set another font for &JOB.
    4. Run and test. This should work...

  • Time Division Multiplexing and Processing Different Loops at the same time

            Hi, I am new in Labview so you may find my questions too silly, sorry about that
    I want to design an interface to control the test&measurement devices remotely. I have two desks and there are several devices on these desks. The real problem is to use two different devices at the same time. To do this I heard that I can use time division multiplexing. But I couldn't find enough information about it in Labview. Another advice I heard was to use a matrice and hold the on/off state of the devices in this matrice. 
    Where should I start the design to create such a system? Do you have any advices? Thank you in advance.
    My basic GUI is attached.
    Attachments:
    InterfaceAli.zip ‏42 KB

    As Mike pointed out you cannot communicate in parallel on the GPIB bus - unless you have separate buses for each instrument - and that defeats the purpose of a bus. I am not sure about LXI.
    With regard to your VI:
    1. Do not use global variables to pass your data around.
    2. You should use the Array data type, not the Matrix data type. The Matrix data type in LabVIEW should only be used for matrix mathematical operations (linear algebra) which cannot be easily performed on the array data type. You have many more tools in LV to work with arrays.
    3. The Event structure needs to be in a parallel loop. This is basic data flow. If you do not understand this concept, get some training, either though the online tutorials or through a class.
    4. Use Value Changed events and place the button terminals inside the event case for that control.
    5. The parallel loops need to have a Wait or some other function which causes a delay. Otherwise, the first one to start executing could consume all available processor resources. These are called "greedy loops." 
    6. Use integer data types for case structure selector inputs. Floating point values are coerced to integers at the inputs. If the values resulted from calculations, unexpected rounding effects may occur, resulting in the wrong case being selected. In some cases using type defed enums may be even better. The underlying data is integer and the enum item names show up in the case selector labels, helping to document what the case does or why it was selected.
    7. Remove the timeout case from the event structure since it never executes. Also avoid Use Default if Unwired on the terminal with your matrix (array) data. You never have a situation where an empty array is appropriate.
    Before going any further with the program questions, you need to carefully define your requirements.  How many instruments will you have? How many can be active at one time? What kinds of communication between the program and the instruments is required? This includes commands to the instrument, data returned from the instrument, error handling, and timing requirements. What will be done with the data? Display, save to file, use to automatically control another device? What safety requirements or constraints need to be met? Once you have a good requirements document, then you can begin to determine what kind of program architecture is best suited to meet the needs.
    I suspect that you may be making some things much more complicated than they need to be while ignoring other important issues.
    Lynn

  • F4 help based on the records in the same column

    Dear All
    its an fantastic blog....i have one different question for u....n u can check the below..
    is it possible to get F4 functionality for a record in column in ALV based on the first 3 records of the same column....
    material vendor shipping contract
    2 4 6 -
    > 5(f4 help)
    3 2 4 6(f4 help)
    the contract value should only come based on the first 3 records of the coulumn and it shouldnt show any other value...other than combination values of first 3 records.....
    hope u got me know.....
    please let me know if you need further clarification....thanks in advance....
    Regards,
    Kartheek.....

    Hi Kartheek,
    do a where-used-list on function F4_INT_HELP_VALUE_REQUEST, start with B* programs.
    Or do a search on SCN and find [ABAP Code Sample to Attach F1 and F4 Help Fields in ALV Grid|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d] and [view the code sample|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b3d5e890-0201-0010-c0ac-bba85ec2ae8d?quicklink=index&overridelayout=true].
    I hope your approved programming skills allow you to copy&paste.
    Regards.
    Clemens

  • [ora_hash] different value for the same input

    hi all,
    i'm using 2 different machine running the same version of oracle (11g).
    on those 2 db i have the same tables with the same datas.
    for the comparisson of the data i'm using the ora_hash function (both on numeric and string fields) and for some records i get different results.
    how is that possible?
    (by the way looking at the records that has different hashes the values calculated by the hash function are the same)
    thx

    You have posted in the wrong forum. As the forum title says this forum is for SQL Developer and not for SQL or PL/SQL questions.
    After reading the information provided at the end of this reply you should
    1. create a new thread in the SQL and PL/SQL forum
    PL/SQL
    2. Edit this current question to add a link to the new question and tell people to follow up in the other forum.
    3. Mark this current question ANSWERED so followup will be in the other forum.
    Thanks.
    When you post in the other forum provide information related to the following
    >
    for the comparisson of the data i'm using the ora_hash function (both on numeric and string fields) and for some records i get different results.
    >
    Please post your 4 digit Oracle versions - both versions (result of SELECT * FROM V$VERSION) and examples (i.e. actual code) of values that are giving different results.
    >
    (by the way looking at the records that has different hashes the values calculated by the hash function are the same)
    >
    What? there can't be 'different hashes' if the 'values calculated by the hash function' are the same. What are you saying here?
    Again - provide examples that show the differences. Should be something like
    SELECT ORA_HASH(12345) FROM DUAL;Since you say there are differences on the two machines provide the execution plan from each machine that shows what Oracle is actually doing. One machine may be applying a function to the data.

  • Different parts for the same ID

    Hi,
    TABLE1 contains informations about programs, these include:
    PROGRAM_ID (fk of program table), PART_NO, MEDIA_ID
    A program can be made of different parts (PART_NO i.e., part 1, 2, 3, 4, or 5).
    The media_id is the unique identifier or a VHS tape where the program is recorded on.
    Parts of a program will have the same Media_id as long as the sum of their lenght does not exceed the VHS length, if that happens, the media_id for the part which does not fit the VHS will be different:
    i.e. Program1 has 4 parts of 1 hour each. Part 1 and 2 will be on the same VHS (2 hours), hence will have the same media_id; part 3 and 4 will have a different media_id associated to program1.
    TABLE2 contains information about the media:
    MEDIA_ID (pk), MEDIA_NAME
    If one program has more than one media associated to it, I need to be able to display both media_names on the same row as the program_id under the same column called VHS_Number (I asssume by using concat).
    Can anyone suggest anything so that I can move in the right direction?
    thanks
    Message was edited by:
    user564568

    create table table1(program_id number(2),part_no number(2),media_id varchar2(3));
    insert into table1 values(1,1,'m1');
    insert into table1 values(1,2,'m2');
    insert into table1 values(1,3,'m2');
    insert into table1 values(1,4,'m1');
    insert into table1 values(2,1,'m3');
    insert into table1 values(2,2,'m2');
    insert into table1 values(3,1,'m1');
    insert into table1 values(3,2,'m2');
    table1
    program_id part_no media_id
    1          1     m1
    1          2     m2
    1          3     m2
    1          4     m1
    2          1     m3
    2          2     m2
    3          1     m1
    3          2     m2
    create table table2(media_id varchar2(3),media_name varchar2(9));
    insert into table2 values('m1','media1');
    insert into table2 values('m2','media2');
    insert into table2 values('m3','media3');
    insert into table2 values('m4','media4');
    insert into table2 values('m5','media5');
    table2
    media_id media_name
    m1          media1
    m2          media2
    m3          media3
    m4          media4
    m5          media5
    select program_id,distinct media_name
    from table2 A,(select media_id,program_id,part_no,dense_rank() over ( partition by program_id order by media_id) rn from table1) B
    where A.media_id=B.media_id
    is this kind of data you are looking for

  • Does not do the sorting if I click twice to the same column.

    Hello
    I am new to winforms.
    I have a listview. I want it to toggle the sorting of the records of the listview when the columns are clicked
    Please guide me as to how to do the same.
    The code that I have attached does not do the sorting if I click twice to the same column. I have to click a different column ten the previous column 
    The code is attached below
    regards
    Manoj Gokhale
    private void SiteInChargeorSupervisor_Load(object sender, EventArgs e)
    this.listView1.ColumnClick += new ColumnClickEventHandler(listView1_ColumnClick);
    private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
    ListViewSorter Sorter = new ListViewSorter();
    listView1.ListViewItemSorter = Sorter;
    if (!(listView1.ListViewItemSorter is ListViewSorter))
    return;
    Sorter = (ListViewSorter)listView1.ListViewItemSorter;
    if (Sorter.LastSort == e.Column)
    if (listView1.Sorting == System.Windows.Forms.SortOrder.Ascending)
    listView1.Sorting = System.Windows.Forms.SortOrder.Descending;
    else
    listView1.Sorting = System.Windows.Forms.SortOrder.Ascending;
    else
    listView1.Sorting = System.Windows.Forms.SortOrder.Descending;
    Sorter.ByColumn = e.Column;
    listView1.Sort();
    public class ListViewSorter : System.Collections.IComparer
    public int Compare(object o1, object o2)
    if (!(o1 is ListViewItem))
    return (0);
    if (!(o2 is ListViewItem))
    return (0);
    ListViewItem lvi1 = (ListViewItem)o2;
    string str1 = lvi1.SubItems[ByColumn].Text;
    ListViewItem lvi2 = (ListViewItem)o1;
    string str2 = lvi2.SubItems[ByColumn].Text;
    int result;
    if (lvi1.ListView.Sorting == System.Windows.Forms.SortOrder.Ascending)
    result = String.Compare(str1, str2);
    else
    result = String.Compare(str2, str1);
    LastSort = ByColumn;
    return (result);
    public int ByColumn
    get { return Column; }
    set { Column = value; }
    int Column = 0;
    public int LastSort
    get { return LastColumn; }
    set { LastColumn = value; }
    int LastColumn = 0;

    Every time through the ColumnClick event handler, you are creating a new sorter. This means that any values set in the sorter from the previous click are not saved.
    Try this.
    private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
    // Only create a new sorter if we don't have one already.
    if(listView1.ListViewItemSorter == null)
    ListViewSorter Sorter = new ListViewSorter();
    listView1.ListViewItemSorter = Sorter;
    // And so on with the rest of your code.

Maybe you are looking for

  • Decent HD camcorder compatible with FCP?

    I really need to get an HD camcorder and the most important thing for me is easy compatibility with Macs and uploading to Final Cut Pro X, which I have. My budget is under $600, so obviously how good the HD quality is is not the priority here. I've l

  • Lifecam 3000 - Can't use Dashboard

    Does anyone know if the Dashboard on my camera is compatible with Skype?  I thought it would be fun to use the different effects when I make a video call but I can't get them to work during a video chat.

  • Cfchart yaxis scale is wrong when combining bar and line charts

    Hi, I am trying to combine a bar and line chart ti display data.  Everything looks good except that the yaxis scale is off.  I set the scaleMin to 0 but that doesn't help.  Below is my code, the custom XML style and a screen shot.  My ultimate goal i

  • Songs On iPod, But Not Showing Up In Song Count

    I just added 312 songs, and now have 5832 songs. However, my iPod still only shows a count of 5520. The songs are on the list and everything, and the memory taken up is correct, they just don't show up on the count. Anyone know what's wrong? Thanks.

  • Video titles disappeared

    I have many videos on iPad, but now it's painful to open each video to find correct because in iOS 7 the titles disappeared. And please don't recommend to have any cover art..... it used to work just fine.