Range from columns based on list of values

Hi,
I have a table that has a key_code and a alt_code like this
with values like so.. (has 2 million records in 8.1.7 Database)
KEY_CODE ALT_CODE
0001     AA
0001          AB
0001          AF
0001          G4
0001          G5
0001          G6
0200          BB
0200 BC
0200 BD
0200 Bx
I'm struggling with the concept of how to create a range of these values.
There is one problem I'm running into.
The alt code must be in a valid code list to have a break in the range
An example would be
VALID ALT_CODES TABLE
B1
B2
ZA
ZB
ZC
ZH
ZJ
ZK
WHAT I'M LOOKING FOR IS THE OUTPUT TO BE
KEY_CODE          BEGRANGE               ENDRANGE
10               B1                    B2
10               ZA                    ZK
20               ZA                    ZJ
WHAT I'VE GOT SO FAR IS
SOMETHING THAT LOOKS LIKE
THE PROBLEM IS THAT THE VALID ALT_CODE LIST IS NOT SEQUENTIAL AND THERE ARE GAPS.
SO IF, FOR EXAMPLE THERE IS NO CODE ZD IT WILL BREAK A RANGE ON IT THE VALUE BETWEEN ZC AND ZH
WHEN I DON'T WANT IT TO.
KEY_CODE          BEGRANGE               ENDRANGE
10               B1                    B2
10               ZA                    ZC
10               ZH                    ZH
10               ZJ                    ZK
20               ZA                    ZC
20               ZH                    ZH
20               ZJ                    ZJ
I'd be most grateful for your input.

Ditto.
And where the hell does this row come from (not to mention the 10s and 20s being totally different key codes from the first table)?
KEY_CODE BEGRANGE ENDRANGE
10 B1 B2
10 ZA ZK
20 ZA ZJ <-- ??

Similar Messages

  • Column selector for list of values

    Hi,
    is it possible to use column selector to select list of values of a certain column? I mean similar to dashboard prompts? We may have a situation that the environment we use does not allow us to use dashboard prompts in certain cases. If not, is there a way to separate lov's from each other in pivot tables? Now if we select two columns, lov will look like column1-column2 with all possible combinations and we don't want that.
    BR,
    Mari

    Use a pivot table view to achieve this requirement.
    open pivot view properties-->place the required column in the pages--->try the result
    It will work like a prompt in the report.
    mark if helpful/correct..
    thanks,
    prassu

  • Unseen user parameter data when it is based on list of values

    Hi All;
    i use oracle report builder version 6.0.8.8.3 on win98 platform and i have a silly problem.
    When i create a user parameter with list of values , the list does not display any data .
    When i select any empty row from the list the report runs correctly displaying the data filtered where the selected emty row indicating that the list contains data but it does not appear in the list.
    I feel that it is a bug in my version.
    thank you in advance.

    i discovered a new notice about this problem,
    when the data displayed is arabic ,it does not appear.
    when it is english ,it appears clearly.
    my nls_lang=american_america.ar8mswin1256 and i tried another nls_lang=american_america.ar8msawin and it does not work also.
    i tried to un check the hide first column property but both arabic & english data do not appear
    thank u for your concern

  • Populating fields based on list box values

    I have created an application based off of a table and so the 1st page is the actual report and the 2nd page is the data entry form. I have changed the form elements (like text box to select list) etc.
    I need to have (2) text box fields populated based on the value from the 2nd select list box. I created a pl/sql page process that will check the value of the select list and assign values to the text boxes. This is triggered when a POPULATE button is pressed.
    When I select a truck number in the select list - nothing happens and the original select list values get reset back to original. There is another button used in order to insert the data so that's why I figured I needed to add another button to trigger the population of the text boxes from a table. Here is my pl/sql page process used to populate:
    BEGIN
    SELECT dr1_name, dr2_name
    INTO
    :P2_DRIVER_1, :P2_DRIVER_2
    FROM
    active_drivers a
    WHERE
    :P2_DRIVER_CODE = a.code;
    END;
    It is set to fire on submit - before computations and validations.
    Regards,
    Jeff

    Not sure if this is the best way but it works for me……
    Make P2_DRIVER_CODE be a form element of Select List with Submit
    Create 2 items, P2_DRVR1 and P2_DRVR2, of form element Hidden
    Edit the P2_DRIVER_1 item. In the source region enter :P2_DRVR1 in Post Calculation Computation.
    Edit the P2_DRIVER_2 item. In the source region enter :P2_DRVR2 in Post Calculation Computation.
    Create a page rendering computation for item: P2_DRVR1.
    Type: SQL Query
    Computation Point: Before Header
    Computation: SELECT dr1_name FROM active_drivers a WHERE a.code = :P2_DRIVER_CODE
    Create a page rendering computation for item: P2_DRVR2.
    Type: SQL Query
    Computation Point: Before Header
    Computation: SELECT dr2_name FROM active_drivers a WHERE a.code = :P2_DRIVER_CODE
    When an item is selected in P2_DRIVER_CODE the page will submit/refresh, causing the computations to be fired. P2_DRIVER_1 and P2_DRIVER_2 will be populated by the return of the queries in the computations respectively.
    P2_DRIVER_1 and P2_DRIVER_2 are still editable by the user (unless you define them as read only) but if you have another select list with submit on the form, if used, the page will refresh and the computation will run again overwriting what the user has entered.
    Suppose I want the user to be able to change the defaults and keep from losing them (changed back to default) in case another item submits/refreshes the page.
    Create a hidden item P2_DRIVER_CODE_CHANGE with the source of: Static Text. For the Default Value enter &P2_DRIVER_CODE. (include the period after &P2_DRIVER_CODE)
    Edit the P2_DRVR1 and P2_DRVR2 computations and in the Conditional Computations region set:
    Condition Type: Text in Expression 1 != Expression 2 (include &ITEM substitutions)
    Expression1: &P2_DRIVER_CODE.
    Expression2: &P2_DRIVER_CODE_CHANGE.
    Hope this works for you,
    Jeff

  • How to hide table column based on country molga value

    Hi Experts,
    I am doing some enhancement in ess application. I want to hide table column based on country code i.e. Molga value.
    I want to hide coulm for only Japan country reset of them i need to be show those coulmn.
    Could you please provide me a sample code.
    Regards
    Chakri

    Hi Chakri,
    Your setting the table value that time you will get the Country Code.
    1.Create the attribute like Country_Column_Visible Data Type bind the com.sap.ide.webdynpro.uielementdefinitions.Visibility this value  you need to bind the table country column.
    2.In Table You need to check the country code Japan is available you need follow this below sample code.
    for(int i=0;i<tablesize;i++)
         tablesithValue=wdContext.nodeTable().getTablenode(i);
         if(null != tablesithValue.getcountrycode)
         if(tablesithValue.getcountrycode.equalsIgnoreCase("Japan"))
              wdContext.currentxxxxElement.setCountry_Column_Visible(WDVisibility.NONE);
         }else
              wdContext.currentxxxxElement.setCountry_Column_Visible(WDVisibility.VISIBLE);
    Use the above code you condition it will work.I hope it will help you.
    BR,
    Durga

  • Update column based on a parsed value from another column

    <p>i have table1 which has&nbsp;description, region and division columns.&nbsp;If the "description like '% (%.% or %.%'" I want to parse the first '%.%' which has the values for&nbsp;'region.division' and update the table1.region
    and table1.division columns. </p><p></p><p>FOR EXAMPLE</p><p>DESCRIPTION, REGION, DIVISION</p><p>Total Employes (SouthEast.Florida or 111.22),,</p><p>WANT IT AS</p><p>Total Employes (SouthEast.Florida
    or 111.22),SouthEast,Florida</p><p>thanks in advance.</p><p></p>

    In my tests the following update of CTE works fine. Hopefully this will work for the real table as well although it is a good idea to always have primary key:
    DECLARE @t TABLE (
    DESCRIPTION VARCHAR(200)
    ,REGION VARCHAR(30)
    ,DIVISION VARCHAR(30)
    INSERT INTO @t (
    DESCRIPTION
    ,REGION
    ,DIVISION
    VALUES (
    'Total Employes (SouthEast.Florida or 111.22)'
    'Test no info'
    WITH cteParsed
    AS (
    SELECT *
    ,CASE
    WHEN DESCRIPTION LIKE '%(%.%'
    THEN substring(description, charindex('(', DESCRIPTION) + 1, len(Description))
    ELSE NULL
    END AS StartInfo
    FROM @t
    WHERE DESCRIPTION LIKE '%(%.%'
    AND len(Region) = 0
    AND len(Division) = 0
    ,cte
    AS (
    SELECT *
    ,substring(StartInfo, 1, charindex(' ', StartInfo) - 1) AS Rest
    FROM cteParsed
    UPDATE cte
    SET region = substring(Rest, 1, charindex('.', Rest) - 1)
    ,division = substring(Rest, charindex('.', Rest) + 1, len(Rest))
    SELECT *
    FROM @t; -- verify the changes taken place
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Display a column with a list of values from DUAL;

    Hello, how can I display something like:
    COL1
    A
    B
    C
    D
    E
    F

    On my planet these are 'words' ;) :
    SQL> select dbms_random.string('a', level)
      2  from   dual
      3  connect by level <= 10;
    DBMS_RANDOM.STRING('A',LEVEL)
    r
    BB
    pmE
    bHri
    aZZDC
    FzOZBf
    fXfPyIP
    LOqrQbnK
    AYzNgHcGc
    lvxRvflHXj
    10 rows selected.
    SQL> select dbms_random.string('a', dbms_random.value(10, 50))
      2  from   dual
      3  connect by level <= 10;
    DBMS_RANDOM.STRING('A',DBMS_RANDOM.VALUE(10,50))
    AKExSSzIJOkabCT
    VCHHRTcgtnBSlZyRmsITqzWqVNgDnPdnxmt
    qLnuyGQErxZvHttRBpWrPoLEiGUra
    rcllLkyZXiwvlcGaUoEAeMbEdZSHlZBIgdilgGTQzxlIUW
    ftnGzDCzUBEsxKzhDLfgS
    aqUmpIzjqkWMZGpbAchhbiqFBUKdRaDwFAgdP
    nskqNdzmlAKlsGOJpbKfQHiCfvkDpoFcTkTvKaUcGLFDkgjsX
    fwkxBSoVuDSEOFldgDhilvm
    iAnSvDMQzamGvIFNydfjhr
    lHRPUnKgOxYQwWAltdELJNqqfgMRSmbBpSDnjOsfx
    10 rows selected.http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_random.htm#CDEJAHCB

  • Expense reporting, get values from column and return only unique values somewhere else

    i would like check a column for the values it contains (expense categorizations) and then return a list of only the unique values somewhere else in a vertical list. So "gasoline" may be listed 12 times in the reference list but in my result listing i would expect it to only show up once. If there is a way to do this then I would also like to know how empty cells are handled.
    I will then be applying a SUMIF to the returned list to get totals for all the unique categorization a have specified.
    Thank you for your time.

    Deleting the first row made your $F$2 become $F$1.
    Explaining how a formula works is not so easy to do. I'll try, but the best way is to read up on the formulas and piece it all together.  There's nothing fancy or tricky going on here.
    The "active ingredient" in the formula is this piece: OFFSET('Table 1-2'::$F$1,SMALL('Table 1-2'::G,ROW()−1)−1,0)
    ROW() returns the row number of the cell that has the formula in it. It is an easy way to get an ever increasing number for the formula. The other way would be to have another column with 1,2,3,4, etc. in it.  So, ROW() will return the number 1 if the formula is in row 1, will return the number 2 in row 2, etc.
    SMALL(range, n) returns the nth smallest number from the given range of numbers.  So, for the formula  in row 2, SMALL('Table 1-2'::G, ROW()−1) becomes SMALL('Table 1-2'::G, 1) which will return the 1st smallest number from the G column of Table 1-2.  In the 3rd row it would return the 2nd smallest number. Etc.  And remember that those numbers it is returning are the row numbers of your unique values in Table 1-2.
    OFFSET(base, row offset, column offset) is a way of  referencing a cell.  For instance, OFFSET($F$1,1,0) would be one row down from cell F1. OFFSET($F$1,2,3) would be two rows down and three columns to the right of cell F1.  The SMALL formula has given you the row number for a unique value in your Table 1-2.  To reference the correct row, the row offset from F1 needs to be one less than that number (an offset of 0 = cell F1. An offset of 1 = cell F2, etc.). The column offset is zero.

  • APEX4: Populating fields from database based on the SelectList value

    Hi,
    I've a Select List and 4 Text Fields on a form. On selecting a value on the Select List, I've to populate the Text Fields by fetching its values from the database by using the Select List value as the primary key.
    How can I do this in APEX 4?
    Thanks for the help.
    --Hozy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thank you so much for helping me out.
    Yes, it comes from the same table account.
    These are the sqls to fetch the 4 values in each dynamic action:
    select a.address1 from account a where a.account_id = :P14_ACCOUNT
    select a.address2 from account a where account_id = :P14_ACCOUNT
    select a.city from account a where a.account_id = :P14_ACCOUNT
    select a.postal_code from account a where a.account_id = :P14_ACCOUNT
    Right now, I only have one dynamic action for text field P14_BILLING_ADDRESS_1, and even for just one the value is not showing up in it. Please note that when I added for dynamic actions, the the values were showing up in all the 4 text fields before.
    Then when I added 4 more dynamic actions for a different Select List (P14_CUSTOMER), but for the same text fields, it all stopped working. And now even a single dynamic action is not working. This is how the sql for next 4 dynamic actions looked like:
    select c.address1 from customer c where c.customer_id = :P14_CUSTOMER
    select c.address2 from customer c where c.customer_id = :P14_CUSTOMER
    select c.city from customer c where c.customer_id= :P14_CUSTOMER
    select c.postal_code from customer c where c.customer_id= :P14_CUSTOMER
    }

  • Fill another textbox based on list item value

    I have a list_item with option1, option2, option3 and 'N/A' with values 1,2,3,4. There is another text field called startdate of date type format FMMM/DD/RRRR. I would like to display date '01/01/1900' in the text box whenever user select 'N/A' in the list item.
    I used varuious trigger - WHEN-LIST-CHANGED or POST_CHANGED with following code.
    if :block1.options = 'N/A' then          
    :block1.startdate := '11/11/1111';
    else
    :block1.startdate := :block1.startdate ;
    end if;
    On both triggers, I am getting error when I select 'N/A' in a list item
    FRM-40735: WHEN-LIST-CHANGED trigger raised unhandled exception ORA-01843.
    -1403: ORA-01403: no data found
    Could you please help me with this? I will really appreciate it.
    Thanks,
    user7954680

    Hi,
    You might want to check this
    ORA-01843 is caused coz of the following reasons
    Cause: A date specified an invalid month. Valid months are: January-December, for format code MONTH, and Jan-Dec, for format code MON.
    Action: Enter a valid month value in the correct format.
    -Nisar

  • Changing display of item in column based on its value

    Hi,
    I'm confused as to how I can change the display attributes of an item in a column based on that items value. I've grepped through the forums and it seems there are ways to do this in the report query but that seems inefficient. My preferred method would be at the column level, I could set up some logic that says "if the value is X then display A and if the value is Y then display B". In this case A and B could be a snippet of HTML to display an image that represents the value.
    Seems reasonable that this app would have this functionality and I'm sure it's there, I just can't seem to find it.
    Help! Suggestions welcome, heckling encouraged!
    Thanks,
    Jon

    Jon,
    You should probably start storing the images in a custom table as described here:
    http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm
    The following column is taken from the Products query in the sample application (page 3):
    decode(nvl(dbms_lob.getlength(p.product_image),0),0,null,'<img src="'||apex_util.get_blob_file_src('P6_PRODUCT_IMAGE',p.product_id)||'" height="75" width="75" />') img
    Note, getting this configured is a little tricky the first time. Notice that there is an item from page 6 referenced. Page 6 contains that item and a DML process both of which are needed for everything to work. Read more here:
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/advnc.htm#BCGGJHEF
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen

  • How to get data from list of values (LOV) to be displayed in a text field ?

    Hi guys,
    I am very new to Oracle APEX so please spare me if it is a silly question. How can I get the selected values from a set of list of values (LOV) displayed in a text field (or text area or so) ? Fox example, in my form I create 4 items: STATE, COUNTY, STREET, ZIPCODE and all of them are LOV (list of values). I also create 2 buttons (ADD & REMOVE). Then I create a test field (or text area name SELECTED RECORD). Now here is what I want to do with my form:
    When I set the values for all 4 fields, I will click on the ADD button then I want those values be displayed in the text field.
    For example, if the selected values are:
    STATE = Alabama
    COUNTY = Abbeville
    STREET= 1 Street
    ZIPCODE = 36310
    And the ADD button is pressed. Then in the text field I want it displays like this:
    Alabama,Abbeville,1 Street,36310
    If I choose other values and click ADD again, a new line will be added into the text fields (text area). If I click the REMOVE button, then it will clear those two line in the text field.
    Would it be possible to do it? Any help will be greatly appreciated. Thanks in advance.

    If you can live with the page being submitted and refreshed, make your ADD button do a submit with a request value of ADD and make your REMOVE button do a submit with a request value of REMOVE.
    Then create two computations (one firing with a condition of Request = ADD and the other firing with a condition of Request = REMOVE).
    In the ADD one, concatenate the values together into the text area (most likely a PL/SQL computation wiill be what you want). In the REMOVE one, set it to null with a PL/SQL computation.
    If you want it done without submitting the page, make the buttons each do a redirect to a URL but instead you will have to write two short javascript functions in the page HTML header to manipulate the field values. Each button would call each javascript function in an onclick event.

  • Looping thru column names based on a variable value

    I have an ArrayCollection with a series of columns named
    price1, price2... thru to price10
    I'm trying to loop thru these columns based on a variable
    value, but can't figure the syntax:
    for (var column:int = 1; column < 11; column++){
    testPrice = myGrid.selectedItem.price(column); <-- this
    doesn't work
    }

    Try testPrice = myGrid.selectedItem["price" + column];
    Remember to test that selectedItem isn't null before you try
    to assign the values.
    TS

  • Hide or show a column based on a parameter?

    I have a parameter that has two values linked to 2 fields and included in my SQL query.  I would like to hide or show columns based on the parameter value chosen for other fields.  How do I begin to write the expression? 

    Hi KittyCat101,
    Based on my understanding, you want to display columns dynamically based on a parameter, right?
    In your scenario, you can specify column visibility for all columns based on the expression which contains selected parameter values. So that if we select a value from the drop-down list of the parameter, the column will display based on the column visibility
    expression. For more information, please refer to this article:
    Conditionally Setting Column Visibility in SSRS.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Error while selecting NULL value from Popup Key LOV(numeric or value error)

    Hi,
    I have a item P1_DEPTNO with following properties.
    P1_DEPTNO - Popup Key LOV (Displays description, returns key value)
    LOV - P1_DEPT_LOV
    select deptname d, deptno r from deptP1_DEPTNO item properties
    List of Values
      Named LOV - P1_DEPT_LOV
      Display Null - Yes // changed to Yes, so that it can accept NULL values.
      Null display value - NULL
      Null return value -   (blank)PL\SQL Process -
    declare
    v1 number;
    begin
    if :P1_DEPTNO is null OR :P1_DEPTNO = '' then
        v1 := 0;
    else
        v1 := :P1_DEPTNO;
    end if;
    // rest of the PL\SQL process
    end;Now, when I run the page and select NULL value from Popup LOV and submit, I get the following error.
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error.When, I select any other value other than NULL, then it's working perfectly fine.
    Only in case of NULL value, I am getting this error.
    ANY idea, why this error is coming??
    Thanks,
    Deepak

    Hi Varad,
    I did the following change
    Null display value - (blank) // by default it is displaying '%' in the select this
    Null return value - -1
    but when I select % (null value) from the popup list, it displays the return value -1 in the text field.
    My question is why it is displaying the return value -1 in the text field...*It should display the display value in the text field (i.e blank in this case)*
    then, I did the following change
    Null display value - (blank) // by default it is displaying '%' in the select this
    Null return value - // a single space, so that when I select %(null value) from the list, it should display blank in the text field...
    then I did the following change in the PL\SQL process.
    PL\SQL process
    declare
    v1 number;
    begin
    if :P1_DEPTNO = ' ' then // -- checking the value of single space ' ' when we select %(null) in the popup list, BUT even I select %(null), control is not coming here.
        v1 := 0;
    else
        v1 := :P1_DEPTNO;
    end if;
    // rest of the PL\SQL process
    end;Thanks,
    Deepak

Maybe you are looking for

  • Email notifications not being sent - SORRY - WRONG FORUM!  PLEASE DELETE!

    Hello all - I have two Mac Mini Servers - both running 10.6.5 One server is within my LAN and behind an Apple Airport Extreme which is acting as a router. The other server is collocated and has a direct connection to the internet. It is running the s

  • How to set default color to e-mail

    I want to set a default color for all e-mail messages and although I have tried to set the color it doesn't seem to work ... second day with a mac, so speak slowly. Also want to set up a signature with the name in one color and address and contact in

  • Why can't I send a pdf file by email?

    Why can't I send a pdf file by email?

  • Tamplate based button in  Report Column

    Hi there, Is there any way to put tamplate based button into report column. I have a "sliding doors" css button in my theme's CSS file and I would like to use in in the report column. Thanks

  • AD RMS

    I have one AD RMS server installed in Dev environment. I want to ensure that users will be able to access the documents already secured and will be able to restrict access on new documents even if AD RMS server goes down for a while.I am testing it a