Select lists and deactivated values

Consider the following simplified test case.
1. create tables like this
create table lov_values
  lov_pk number primary key
, name varchar2(10)
, active varchar2(1) not null
insert into lov_values valeus ( 1, 'A', 'Y' );
insert into lov_values valeus ( 2, 'B', 'Y' );
insert into lov_values valeus ( 3, 'C', 'Y' );
commit;
create table trx
  trx_pk number not null primary key
, lov_fk number not null foreign key references lov_values
) ;2. Create an APEX Insert/Update form on the trx table. Define the LOV_FK item as a select list with this query
List of values definition:
  select name d, lov_pk r
  from   lov_values
  where  active = 'Y' ;
Display Extra Values: Yes3. Users use the APEX form to create records like this:
  trx( trx_pk, lov_fk ) = ( 10, 1 )   -- users sees LOV_FK value as "A"
  trx( trx_pk, lov_fk ) = ( 20, 2 )   -- users sees LOV_FK value as "B"
  trx( trx_pk, lov_fk ) = ( 30, 3 )   -- users sees LOV_FK value as "C"4. A year later an admin deactivates lov_value 2/B by setting active to 'N'.
5. When a user queries trx row 10 they still see "A".
6. When a user queries trx row 20 they now see "2".
7. When a user queries trx row 30 they still see "C".
In step 6 I'd like the user to see "B" whenever they query old data with that value but I never want them to be able to create new trx rows with 2/B or update the LOV_FK value of existing rows to be 2/B. I'd also like to avoid using a pick list with a popup window just for selecting from a list of two (could be a few) values.
Just wondering how others have dealt with this scenario in their APEX apps.

I actually just found a simpler way in Select list filter in a tabular form problem forum thread. In the query that defines the tabular form I added a column called HIDDEN_FK_VALUE as follows.
select
"TRX_PK",
"TRX_PK" TRX_PK_DISPLAY,
"LOV_FK",
APEX_UTIL.SAVEKEY_NUM("LOV_FK") hidden_fk_value
from "#OWNER#"."TRX"Then I modified the the Select List query to look like this.
SELECT name d, lov_pk r
FROM lov_values
WHERE (active = 'Y' OR lov_pk = APEX_UTIL.KEYVAL_NUM )Works like a charm. Thanks everyone for your input.

Similar Messages

  • Multiple selection list and passing that value to oracle reports

    Hi
    I need to create a multiple selection list and then based on use selection, I need to pass that value to oracle reports. Can any one help with steps on how I can do this. Thanks

    Hi
    Concatenate the multiple values into a string separated by comma and then pass that string to report as a parameter.
    In report query, you have to use the lexical parameter using ' & '
    regards
    SD

  • Report with select list and link to call another report

    Hi,
    I am trying to do 2 reports (REPORT1 and REPORT2).
    The first is a summary report (REPORT1).
    This report will display sales figures for the year. Now, I need to have a select list in the result set that will have 2 options, depending on which option is chosen, I want to call REPORT2 with the select list as a parameter. How can I do this ?
    Let me try to explain what I did.
    I created REPORT1 on Page 100
    SELECT YEAR, sum(YTD_SALES), APEX_ITEM.SELECT_LIST(1,'DEPARTMENT','Department;DEPARTMENT,Division;DIVISION') Drilldown FROM SALES_ANALYSIS WHERE YEAR > 2000
    GROUP BY YEAR ORDER BY YEAR
    I created 2 hidden items namely P100_YEAR and P100_DRILLDOWN
    I also made the column YEAR as a link and specified both P100_YEAR and P100_DRILLDOWN as parameters to be passed.
    Next, I created REPORT2
    SELECT YEAR, DECODE(:P100_DRILLDOWN, 'Department', department, 'Division', Division) dept_div, sum(YTD_SALES) ytd_sales
    FROM SALES_ANALYSIS
    WHERE YEAR = :P100_YEAR
    When I run Report 1, it's fine, when I choose either Department or Division from the Select List and click on the link to call Report 2, report 2 is displayed, but the value being passed for P100_DRILLDOWN is not correct and as a result, I am unable to get correct results for Report 2
    Am I missing something ? Are there any alternate ways to do what I'm doing ?
    Thanks,
    Ashok

    Hi Ashok,
    The link definition will not know the value selected in the list as it is constructed only when the page is being rendered. You would need to create some javascript to handle this. I've done that here: [http://apex.oracle.com/pls/otn/f?p=267:182]
    The link on the EMPNO column has been defined in the HTML Expression setting for the column instead of the Link section. The HTML Expression that I have used is:
    <a href="#" onclick="javascript:doDrilldown('#EMPNO#',this);">#EMPNO#</a>And, in the page's HTML Header setting, I have added in:
    <script type="text/javascript">
    function doDrilldown(empno,group)
    var g;
    var p = group.parentNode;
    while (p.tagName != "TR")
      p = p.parentNode;
    var x = p.getElementsByTagName("SELECT");
    if (x.length > 0)
      g = x[0].value;
    var url = "f?p=&APP_ID.:183:&SESSION.::::P183_EMPNO,P183_GROUP:" + empno + "," + g;
    document.location.href = url;
    </script>When a link is clicked, the doDrilldown function is called passing in the EMPNO value and the "this" object (which identifies the object triggering the call). The function starts from that object and goes up in the HTML tag tree to the nearest TR tag (the row tag that the link is on) and then finds the first SELECT list item on the row and gets its value. It then constructs a URL using this and the EMPNO value and performs a redirect to the second page (page 183 in this example).
    Andy

  • Problems with customizing select lists and popup LOVs

    Hi
    I have 2 problems about select lists and popup LOVs.
    The first one is about a select list in a tabular form.
    It should be created with APEX_ITEM.SELECT_LIST_FROM_LOV or similar and take its values from a named LOV.
    This worked fine but now it should also have the possibility to enter a free value.
    I tried to accomplish that by creating a APEX_ITEM.POPUP_FROM_LOV, but there is a problem with the function that is called by the arrow icon right to the input field (for eg. genList_f11_5()).
    If the row is added by addRow, then it works fine, but if the row is is not empty
    then the function call is like genList_f11_$_row() and the input field gets no value, when a LOV option is selected.
    The other problem is about a select list which should have the possibility to enter a custom value and
    also there should be the possibility to select several values. I tried to implement this by a text area containing the selected values and a multiple select list, with an event handler in each option. The user could click options and they would be copied to the text area. The problem is that I couldn't make the event handler work in IE.
    I would appreciate any ideas about either of these problems.
    Tiina

    Hi,
    If you download application you can see source.
    I have not write any instructions, sorry.
    If you are on Apex 4 you can just load jQuery UI autocomplete library and take ideas from my app.
    If you download my sample in zip there is uncompressed htmldbQuery library.
    You can see that and take only function htmldbAutocomplete.
    Then check jQuery UI document
    http://jqueryui.com/demos/autocomplete/#method-search
    There is method search that you can use open list just by click of input.
    I hope this helps at start.
    Regards,
    Jari

  • Select List and detail region

    db11gxe , apex 4.0 , firefox 24 ,
    hi all ,
    i have a master detail page , with an item "test_id" as a select list ,
    and a detail region has also a column "test_id" ,
    what i want is :
    when i change the value of the master "test_id" , the data is retrieved in the detail region where "test_id" = "master_test_id" ;
    how to do so ?
    thanks

    Newbi_egy
    Do you mean that when you change the test in the master you want to refresh the detail?
    Can you put up an example of your tables and foreign keys etc. on apex.oracle.com.
    To me this sounds a wrong model design.
    The detail should only depend on the primary key of the master. And the primary key shouldn't be updatable.
    Nicolette

  • How to make a select list to return value to numeric column?

    I do have a select list with static values (STATIC:01;0,02;1,03;2,04;3,05;4,06;5,07;6,08;7,09;8,10;9). The problem is that I am returning a value to a numeric column. Therefore I have set 'Post Calculation Computation' as "to_number(:P73_MRGRATING, 9);" however I am getting ORA-01722: invalid number. How, (or when and where) to properly convert a character from a select list representing a numeric value into column of NUMBER data type?
    Thank you for your time.
    DanieD

    Sergio,
    It is because I am not able convert a value in a page item (:P73_ID) to number. On a page before, I have assigned a value to an application item (APPL_ID). On page 73, I want to assign the value in APPL_ID to the page item P73_ID . The value assigned to APP_ID is numeric. On a page 73 I also have a computation in Page processing section. It is an 'After Submit' processing of a static assignment of application item APPL_ID to page item P73_ID. Unfortunately it does not work. (ORA-01722: invalid number). I have tested this also with a 'Post Calculation Computation' on page item P73_ID (to_number(:P73_ID, 9999999999);) and I am still getting ORA... error. Only way I can make it work is to create a page item P73_ID as a text field, then when I run page 73 and enter a value into P73_ID manually - then it works and I can save the values from the form into database...
    The strange thing is that I am using application item APPL_ID on a couple of pages, in where clauses and it always works, even when I am comparing APPL_ID against a numeric value like select * from a_table where some_number = :APPL_ID, this works. But when I would like to create an entry form and assign application item APPL_ID to the page item P73_ID that is referencing a numeric table column – then I am getting ORA-01722…
    Is there any application (sample application) that is doing this and it works so I can check it and learn how to create this process appropriately?
    Thank you for your time.
    DanielD

  • Select list and date picker on one line  -  is this a bug?

    I'm using: Application Express 3.2.0.00.27
    Is the following a bug? If so, how do I get it reported so it will be fixed in a future release of APEX? If not, how do I do it so it ends up the way I want?
    1. create blank page
    2. create html region
    3. create "select list" item (Begin On New Line - Yes, ...Field - Yes, ColSpan - 1, Row Span - 1)
    4. create date picker item (Begin On New Line - No, ...Field - No, ColSpan - 1, Row Span - 1)
    There will be other items displayed in more columns above what I just had you create above. I want the select list and the date picker to display next to each other on same line, so I placed date picker item on same line in same field as select list item.
    HOWEVER... the date picker ends up displayed under the select list item (kind of), instead of next to it on the same line.
    Here's what I get:
    ...................... [Select List Field] Date Picker Label
    Select List Label
    ...................... [Date Picker Field]
    Here's what I want:
    Select List Label [Select List Field] Date Picker Label [Date Picker Field]
    Thanks,
    Steve
    Edited by: sskelton on Aug 3, 2009 11:01 AM
    Edited by: sskelton on Aug 3, 2009 11:02 AM

    Hi Steve,
    I'm not sure if it's the official way, but you could add a post here: Enhancement Request Thread : Post 3.1 - that's what I've been doing :D
    Andy

  • Select List and Popup LoV for one column

    Hello,
    is there a built-in functionality to show a select list and a popup lov for one column similar to "Condition Type" in the condition region when editing a page.

    Hello,
    No, you have to code that yourself. For instance by adding HTML in the Post Element Text field (like <IMG src=... />).
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • Question on Dynamic Select Lists and Checkboxes

    Hello,
    I am new to APEX, and this is my first posting, I have a question about how to implement dynamic checkboxes from a select list.
    Basically I would have a select list, and based on what item is selected a set of checkboxes would appear.
    I was originally using the Select and Submit property on the select box, which works fine, all of the checkboxes appear appropriately. But the thing is, APEX refreshes the page each time, and since this select box is lower in the page, the user would have to scroll all the way down to where they were before.
    The main requirement is so that the user won't have to scroll down the that position where the select box is each time they select a new option.
    So a work around attempt is to create a javascript that will automatically scroll down to that position on page load ...
    i.e.
    function pageScroll() {
    window.scrollBy(0,50);
    But that didn't work, because for some reason the javascript wasn't appearing.
    Is there a way to either:
    1. Have a dynamic checkbox appear using ajax? -or-
    2. Have the javascript scrolling effect
    Sorry if this is a confusing question, I was wondering if anyone else came across this issue.
    Thanks in advance!!

    Since this Select List plays such an important role on the page, why not create a side-region and put that select list there so you don't have to overwhelm the user and his 'persistence of vision ' with a page that scrolls all by itself to the 1000th line to, then , change the options ?
    just an idea.

  • Multi-select lists, their return values and showing their display value

    I have a multi select list which is dynamic. The display and return values are pulled from a table where the return value is the Primary Key.
    When people select a few options, the value is stored in session state as 11:12:13 (etc...). From here, I run these numbers through a process which takes a report ID and the multi-select string, and saves individual rows as Report_id, individual multi select value until there are no more multi select values.
    This is great, they're tied in as a foreign key to the LOV lookup table, and they are easily search able.
    I have trouble where I want to list a report's entire multi-select list. I have a function combine the numbers with a : in between them and RTRIM the last one, so I have an identical string to what a multi-select table uses. 11:12:13 (etc..)
    When I assign it to display as an LOV in a report, it just shows the 11:12:13 instead of listing out the values.
    Single number entries, where someone only selected one option in a multi select, display fine.
    Am I doing this wrong?

    Scott - you're right on the money. I did this initially because I thought assigning an LOV display value to a report column would yield the results I wanted.
    I want to do this without referring to the original table... meaning I don't want a function to have to go out and get the names, I'd like my LOV assignment to do it. This saves headache of having to change something in 2 places if it ever changed.
    Am I not going to be able to do this?
    I created a test multi-LOV page, it doesn't work with original(not processed in my function) LOV assignments either, unless you only select one.

  • Report -- filter with selection list -- show all values after select page

    Hello!
    I have the following problem:
    - I have a report
    - this report can be filtered with a selection-list
    - the selection list is based on dynamic LOV and has a null-value
    - I added the code of the report the following, to filter the report after choosing a value of the selection list:
    ... and (instr(type, decode(:P8_FILTER_type, '%null%',type,:P8_FILTER_type)) > 0)
    This works very well.
    But my problem is: When the user logs out and the next time, he logs in, the selection list shows " --- show all values --- " (my null-display-value) and the report is empty "no values found".
    ---> I want to show the first time, the page is selected ALL the values of the report. (this is now only possile if I press the button which belongs to the selection list)
    I hope, somebody understands my problem.
    Thank you so much,
    LISA

    Hello Lisa,
    The first time it's probably NULL.
    So what you can do in your where: (instr(type, decode(NVL(:P8_FILTER_type,'%null%'), '%null%',type,:P8_FILTER_type)) > 0)
    Off topic: I also wonder if that where clause can't be simpler? Do you rely need the instr?
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/

  • Using select list as default value in tabular form.

    Hi,
    I am using Application Express 4.1.0.00.32. I have two questions that are related.
    I have a Select item *'P1_SELECT'* and a tabular form My Items.
    Question 1. The My Items tabular form col1 Attributes are set Display As Text Field, and the Tabular Form Attributes are set Default Type = item(application or page item name), Default = P1_SELECT. I have checked the session state value is set on P1_SELECT ie. Fred. What I need to know is, why, when adding a row to the tabular form My Items does col1 not display 'Fred' as the default value from the select item P1_SELECT? I can change col1 of the Tabular form to be Display as Text (save state) and this will work. However that leads me on to:
    Question 2. After adding say 3 rows to the form, I then change the select P1_SELECT value to Bob and Bob is now set in session state on the P1_SELECT item, but when I again add row to the form the value Fred is still the value not Bob. It seems that the tabular form keeps the default value as Fred and not Bob. How can I get this to look or work like:
    col1_
    Fred
    Fred
    Fred
    Bob
    Your help is needed.
    Thanks.

    Howard (DBA in Training) wrote:
    Do you submit the page or set the value after changing the selection? If not, the display value seems to be Bob but the working value is still Fred. That's what you are seeing right? In the "Settings" section, what do you have for "Page Action when Value Changed". I've been using "Redirect and Set Value" because I was staying on the same page after the selection.
    Additional info which might be helpful (or NOT). ====================
    NOTE: I am just a novice's novice with APEX and I had much agony with Select Lists. It was challenging to have the Select List value displayed because there seem to be so many different sources of the Select List value, namely:
    1) the current value in the session state
    2) the value you can specify in "Source value or expression" in the "Source" section of the Select List item
    3) the value you can specify in the "Post Calculation Compution" in the "Source" section of the Select List item
    4) the value you can specify in the "Default value" of the "Default" section of the Select List item
    [Now, if I've misdescribed any of these, remember, this is from a novice's perspective.]
    It's like putting a clock (back) together. Get any of the pieces wrong and it will probably not work right.
    I had an addiitonal challenge in that I wanted the same Select List displayed on multiple pages and for the currently selected value (from the former page) to already be set on the new page when it was displayed. What fun!
    To see what I did here: http://apex.oracle.com/pls/apex/f?p=43250:101 login Dever/Ima9Dever
    Remember, I'm doing many things you will likely not need to do. I iniitalized the Select List for the first time it displayed. I copied the Select List value from old page to new page by storing it in an application item F217_SYS_NIC_NM.
    Best wishes,
    HowardHi Howard,
    You don't have submit the page for just setting one item's session state. you can use a Dynamic Action OR use Page Items to Submit property if available (this is available in various places such as sql region,chart region etc)
    In context to this question you don't have to do any of those..just see my example above
    Thanks

  • Unable to create a dynamic action ALERT to be generated on a Select List when particular value is selected.

    Hi everyone, this should be so easy, yet I am stuck.
    I have a form region with an item P110_VESSEL_ID.   This item is a select list.   It is based on the query: 
    select distinct v.vessel_name, v.vessel_id
    from vessels vessels v, frequent_fishermen ff
    where ff.dea_permit_id = :G_PERMIT_ID and
    ff:vessel_id = v.vessel_id
    UNION
    select v.vessel_name, v.vessel_id
    from apex_collections a, vessels v
    where collection_name = 'SUPVES_COLLECTION' and
    a.c002 = v.vessel_id
    If the user decides against the values in the select list query, they may opt to SELECT ALL VALUES.  This SELECT ALL VALUES is a POST ELEMENT TEXT on P110_VESSEL_ID.
    <a id="popVessels" href="#"><font color=blue>Select from ALL Vessels</a>
    This all works fine.
    The issue is that when the user selects a vessel name = 'UNKNOWN' and it's corresponding vessel_id value, I would like an ALERT to appear indicating that they should double check that the vessel is UNKNOWN and not that the is no vessel. 
    I created a dynamic action
    event= change
    select type = item
    item = P110_VESSEL_ID
    True ACtion #1 is the ALERT.
    I currently have no other logic, but cannot even get this to work.  Any thoughts.   I have also tried the SELECT TYPE = jQuery Selector = select[name='P110_VESSEL_ID'] but that does not work either (though I am not certain if the value should be P110_VESSEL_ID or the static name of VESSEL_ID).
    Any help is appreciated.
    ps.  the page is not submitted when the vessel is changed.  There is other data that needs to be entered both in this region and others and many validations run when submit, so the submit would not be an option.
    thanks again,
    Karen

    KarenH,
    KarenH wrote:
    I created a dynamic action
    event= change
    select type = item
    item = P110_VESSEL_ID
    True ACtion #1 is the ALERT.
    This should work.  Sometimes I've see where there is other javascript on the page that may have some errors and is causing the dynamic action code to not be executed.  Use your favorite browser script console to try and determine if this may be the case.
    --Jeff
    P.S. Your jQuery selector can be: select#P110_VESSEL_ID

  • Select option in select list and navigate to different page

    Hello,
    I have a tabular form.One of the item is a select list with 2 options. Selecting option one should take the user to page10(just an example) and display all the values of that particular row. Similarly selecting option 2 should take the user to page 20 and display all the values of that row.
    Can some one guide me how to do above mentioned job.
    Thanks in advance.
    Pravish

    @Avinash
      if f_cat-seltext_m = 'Select'.
        f_cat-col_pos = 1.
        f_cat-seltext_l = 'EDIT'.
        f_cat-Checkbox = 'X'.
        f_cat-EDIT = 'X'.
      endif.
    I am already passing f_cat-checkbox = 'X'.
    Thanks
    Kumar.

  • How to add Check box to a static Drop down list (bases on a selection list) and allow mulity select in it?

    Dear All,
    I created a text field in my project (Light switch 201, C#), this text field has a static list which I filled manually. when I click in this text box I get a dropp down list which allow me to chose only one value from it.
    Now what I want to do is to add a check box in this drop down list and allow mulity selection from this list. My list looks as follow:
    Can anyone help me :) ? 
    Thanks all,
    Zayed

    Something like this:
    http://www.codeproject.com/Tips/452756/Add-checkbox-inside-combobox-in-Silverlight

Maybe you are looking for