Dynamic LOV with inactive row
Hi everyone,
I need your help on this one as I can't seems to find an intelligent solution.
I have a select list LOV based on a table that show only active values of that table when you create an object. That works well. But now I need to display an object for modification years after (The same page display as creation). The value entered at that time is not active anymore and is not showing up in the select list. Because of that you cannot see the old value in the select list
CREATE TABLE TYPE
IDE NUMBER (9) NOT NULL ,
NAME VARCHAR2 (50) ,
ACTIVE NUMBER (1)
LOV
select NAME display_value, IDE return_value
from type
WHERE active = 1
order by 1
My best guess is to add a given value to the LOV using application/page variable like this but I find this very ugly.
select NAME display_value, IDE return_value
from type
WHERE active = 1
OR ide = :P10_ide
order by 1
Do you see any other solution ?
I would really like a better one as I need to do this 20+ times on many pages .... going to be a mess ...
Checkout this post on my blog:
http://simonhunt.blogspot.com/2009/02/how-to-cope-with-list-of-values-lovs.html
It's similar to your solution and I agree that it's ugly, but I've not seen a better solution. I would be interested to know if anyone has any better ideas.
I hope it helps
Shunt
Similar Messages
-
Dynamic LOV with dates and selected default value
Hello,
I have a dynamic lov with dates. Query looks like this:
select distinct concat(to_char(b.send_day_time,'YYYY.MM.DD HH24'),':00') display_value, to_char(b.send_day_time,'YYYY.MM.DD HH24') return_value
from ...
No I want to select a specific date as the default value. I put the following code for the default value:
declare
begin
return to_char ('2008.02.19 10:00');
end;
But it doesn't work.The date (string) exists in the lov but it is not selected.
Can someone tell me where the problem is?
Thx in advance.
Greetings,
hamburgerHi hamburger,
As return value you specified to_char(b.send_day_time,'YYYY.MM.DD HH24'),
so your default value should be like to_char('2008.02.19 10'). Also pay attention to select the "Default Value Type".
Hope this helps.
chrissy -
Dynamic LOV with where conditions
Hi all! I have a question regarding Dynamic LOVs. I have a List of values that can be used from three pages, the query is something like this:
SELECT a.CODE CODE_DISPLAY,
a.CODE CODE_RETURN
FROM OREF_COUNTRIES a,
OREF_REGIONS b
WHERE a.REG_ID = b.ID AND
b.CODE = :P336_LOV_REGION;
The thing is I don't want to hardcode the name of the item ":P336_LOV_REGION" because this is the name of 1 item of one page, and I'd like to use this LOV from another two pages, so the name of the item won't be ":P336_LOV_REGION". How can I create a reusable dynamic LOV with a where condition depending on one item of the page?
Thanks!!hi! anyone has any information about this?
Daniela. -
Select item on a Tabular form with a different dynamic LOV on each row
I would like to use a tabular form where one of the columns is a dynamic LOV based Select, and where that dynamic LOV refers to one of the column values on each row.
So if the tabular form represented a list of teams and the LOV-based Select column was the current team leader, I would want that select list to be populated only with the members of that team (different for each row). Since the list of team members is in some other table (all_players or something) I would want to populate the LOV with a query with a where clause that selected only those players records with a team-membership equal to the current tabular form's team id. So, on each row that select list's contents would be different.
-- JustinI'm beating a dead horse here but I did get something to work with "less" code. My current needs do not require me to cascade drop downs, I only want 1. You can use the query like the in the first reply (but I don't have a table with joins) I created a simple two column table dept_emp with 4 records 10,null 20,null .... I want to fill the nulls with an employee but ONLY an employee that matches the dept. (Same concept of team leader and members).
Here's the query:
select apex_item.display_and_save(1,dept) dept,
apex_item.select_list_from_query(2, name, 'select ename from emp where deptno='||dept) name
from dept_emp
I removed the code that was there already (ApplyMRU) and just put in this code:
BEGIN
FOR i IN 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
UPDATE dept_emp
SET
name=HTMLDB_APPLICATION.G_F02(i)
WHERE dept=to_number(HTMLDB_APPLICATION.G_F01(i));
END LOOP;
END;
The G_F01 matches the column 1 and so forth. There's more documentation but little explanation at:
http://download.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25309/api.htm#sthref2171
The thing I could not get to work was a dynamic message
#MRU_COUNT# row(s) updated, #MRI_COUNT# row(s) inserted.
Not sure when the MRU_COUNT gets populated (probably in the routine I removed ;))
You're probably way past me by now but I like to have as little code as possible when it comes to maintaining an app. That's why I liked oracle forms so much. This kind of stuff was pretty easy to do.
Thanks again everybody! -
Error in Dynamic LOV with Bind Variable
Hi
I created 2 Dynamic LOV's in which Second one is with a Bind Variable.Then I creted a Form and Attached the LOV's to the form fields.But I am getting the below mentioned error when i choose a value in the First LOV and the Second LOV is not Populated. I tried the same thing with the scott.dept and scott.emp table which is working fine.but when i try the same on my tables it is throwing me error.
Can Anyone Suggest me what is the problem of these LOVs
FYI
1)I am writing SELECT on Views in the LOVs and the views are created on tables of a different of database.
2)Below Mentioned LINK_TIT is my DB Link.
Error Message:
An unexpected error occurred: ORA-01722: invalid number
ORA-02063: preceding line from LINK_TIT (WWV-16016)
Error displaying form : ORA-01722: invalid number
ORA-02063: preceding line from LINK_TIT (WWV-16408)
Error displaying block : ORA-01722: invalid number
ORA-02063: preceding line from LINK_TIT (WWV-16406)
Error displaying item : ORA-01722: invalid number
ORA-02063: preceding line from LINK_TIT (WWV-16404)
Error ORA-01722: invalid number
ORA-02063: preceding line from LINK_TIT, displaying DUMMY_FRM_BLEND.DEFAULT.SKU5ID.01, combobox (WWV-16405)
The preference path does not exist: ORACLE.WEBVIEW.PARAMETERS.16172911255 (WWC-51000)Hi Everyone,
This was a known Issue in Oracle 9i AS Portal.I referred to the
metalink note ID 174116.1 which talks about the BUG No:1584284.and it gives some workaround to come across the BUG.
I got my dependent LOV work after changing the NUMBER datatype in the Procedure to VARCHAR2.(Then in the PL i converted the character to number by the SQL function.)
Regds
Rajesh Kanna.V -
Dynamic table with alv rows & colums
Hey,
How to create dynamic internal table with alv grid rows & columns with data .TYPE-POOLS : abap.
FIELD-SYMBOLS: <f_dyn_table> TYPE STANDARD TABLE,
<f_dyn_wa>.
DATA: t_dy_table TYPE REF TO data,
dy_line TYPE REF TO data,
wa_xfc TYPE lvc_s_fcat,
t_ifc TYPE lvc_t_fcat.
*get the structure
DATA: $field TYPE lvc_fname,
$counter(2) TYPE n.
DATA: $output_field(25) TYPE c,
$fld_len TYPE i.
FIELD-SYMBOLS: <f_out_field> TYPE ANY.
DATA : $t_idetails TYPE abap_compdescr_tab,
$wa_xdetails TYPE abap_compdescr.
DATA : $ref_table_des TYPE REF TO cl_abap_structdescr.
get the structure of the table.*
$ref_table_des ?=
cl_abap_typedescr=>describe_by_name( c_struc ).
$t_idetails[] = $ref_table_des->components[].
LOOP AT $t_idetails INTO $wa_xdetails.
CLEAR: wa_xfc, $output_field, $fld_len.
wa_xfc-fieldname = $wa_xdetails-name .
wa_xfc-datatype = $wa_xdetails-type_kind.
wa_xfc-inttype = $wa_xdetails-type_kind.
IF $wa_xdetails-type_kind EQ 'C'
OR $wa_xdetails-type_kind EQ 'N'.
CONCATENATE 'WA_OUTTAB' '-' $wa_xdetails-name
INTO $output_field.
ASSIGN ($output_field) TO <f_out_field>.
IF <f_out_field> IS ASSIGNED.
DESCRIBE FIELD <f_out_field> LENGTH $fld_len
IN CHARACTER MODE.
wa_xfc-intlen = $fld_len.
ENDIF.
ELSE.
wa_xfc-intlen = $wa_xdetails-length.
ENDIF.
wa_xfc-decimals = $wa_xdetails-decimals.
APPEND wa_xfc TO t_ifc.
CLEAR $wa_xdetails.
ENDLOOP.
here if you have any other fields to be added to the dynamic structure based on your requirement, you can add then and apped them to t_ifc. There is a special handling for unicode conversion- so for the numc and char fields the length is passed in a different mothed.
create dynamic internal table and assign to fs*
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_ifc
i_length_in_byte = 'X'
IMPORTING
ep_table = t_dy_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
ELSE.
ASSIGN t_dy_table->* TO <f_dyn_table>.
create dynamic work area and assign to fs
CREATE DATA dy_line LIKE LINE OF <f_dyn_table>.
ASSIGN dy_line->* TO <f_dyn_wa>.
ENDIF.
*move the data into <f_dyn_wa> and then append this to output table <f_dyn_table>.
example:-
IF <f_dyn_wa> IS ASSIGNED AND <f_dyn_table> IS ASSIGNED.
MOVE-CORRESPONDING wa_outtab TO <f_dyn_wa>.
APPEND <f_dyn_wa> TO <f_dyn_table>.
endif.
Edited by: Krishna Adabala on Dec 2, 2008 7:57 AM -
How to create report with dynamic columns with static row labels
Hi All,
I am creating one report as per attached format. I have labels on the right side of the report
and data in 3 columns. The data is taken dynamically from the command query.
It gets data from 3 different result sets/command queries.
I tried creating the report horizontally instead of vertically, but the logo image I am not able to rotate in 270degrees.
Can anybody tell me how to create the report...??Hi Abhilash,
Thanks for the quick reply.
Actually the problem is with the image, as I am not able to rotate 270 degree. Crystal report cannot support the rotation of image.
i have another problem, I have to create a report in which
Lables are fixed on the left side of report and 3 columns per portrait page. Those columns are
dynamically created and shown in the report.
The format is like the above. Can you please help me in doing this report, as I tried it doing
with CrossTab. I am really stuck to this report. -
Dynamic LOV with two static entries
I need an additional static entry in a List of Values field.
As my first static entry I use the Null condition.
Or maybe somebody has a different idea how to accomplish the following:
I want to be able to select all the entries of a table with a certain foreign key, all entries with the "value" NULL or just all entries.
thanksI ran into more problems but i resolved them :D
Since I want that at the first load 'all values' is selected... I needed to set :P1_SELECT to -1 when its NULL but that got me some trouble with select 'NULL Values'... thus I changed the NULL value of :P1_SELECT to -2.
This solution has also the other convenience that at top of the select box is 'all values', second entry is 'null values' and all the following are build up dynamicly
select d, r from (
select ename d, empno r from emp -- your foreign key condition
union
select 'NULL Values' d, -2 r from dual -- NULL values
union
select 'All values' d, -1 r from dual -- All data condition. Use a return value that is not in the empno domain
default: -1
In your report, create a where condtion like
WHERE (empno = :P1_SELECT AND :P1_SELECT IS NOT NULL) -- foreign key
OR (:P1_SELECT = -2 AND empno IS NULL) -- Null values
OR (:P1_SELECT = -1) -- All values -
Item Selection on a dynamic LOV (SQL Query)
Hi,
I've a dynamic LOV with an SQL query who return a list of data (one column). When i select a data in this LOV to be use as an item (sql query) in the same page the data is always null. In debug mode substitution string is null.
FYI : when the data is selected, a button is clik to perform an sql query for a report in another page.
Thanks. Sorry Abasolute beginner
Message was edited by:
user581765Thanks for Your help.
The date is in fact a CHAR display (not really a date) so that is not the error.
For your information when i select a row in the list (format char YYYYMMDD_HHMM) it seems that Apex do not catch my select in the Session state.
I've change the item name with P2_DATE_FLOW but the problem remain.
This is the debug log if can help
0.03: Application 114, Authentication: CUSTOM2, Page Template: 3644802034190382
0.06: ...Session ID 1868105032215374 can be used
0.06: ...Application session: 1868105032215374, user=Neop
0.06: ...Determine if user "Neop" workspace "2859608277950243" can develop application "114" in workspace "2859608277950243"
0.06: Session: Fetch session header information
0.06: ...Metadata: Fetch page attributes for application 114, page 3
0.06: Fetch session state from database
0.06: Branch point: BEFORE_HEADER
0.06: Fetch application meta data
0.08: Computation point: BEFORE_HEADER
0.08: Processing point: BEFORE_HEADER
0.08: Show page template header
0.08: Computation point: AFTER_HEADER
0.08: Processing point: AFTER_HEADER
0.08: Computation point: BEFORE_BOX_BODY
0.08: Processing point: BEFORE_BOX_BODY
0.08: Region: Report 1
Report 1
0.08: show report
0.09: determine column headings
0.09: parse query as: CFM_MDRE
0.12: binding: ":P2_DATE_FLOW"="P2_DATE_FLOW" value="0"
0.14: print column headings
0.14: rows loop: 15 row(s)
No data found. -
Hi,
I would like to create a dynamic LOV with all the colors in it (return value should be the color-code).
One can create a small table with all color-codes, but that's the easy part.
What would be the syntax of the dynamic LOV?
reg.
ChrisHi Todd,
Working from Apex 3.0 there is also a item-type "color picker" wich also solves the problem (as mentioned in your link from Andy).
Thanx.
reg.
Chris -
Return statment for dynamic LOV - exception handling
Hello All,
Good Morning.
Oracle 11g, apex 3.2.1
I am having an dynamic LOV with a return statement.
code :-
==========================
declare
owner varchar2(12) :='';
stmt varchar2(4000) :='';
No_Records_Exception exception ;
phase varchar2(30);
year varchar2(30);
month_quarter varchar2(30);
begin
stmt :='select distinct famid d, famid r from '
||:P1_SCHEMA||'.'||'FMLY';
return stmt;
exception
when No_Records_Exception then
raise_application_error (-20998 , ' Schema does not exist ' );
when OTHERS then
raise_application_error (-20999,' Select the schema first ' );
end;
===================
My question is - why the exception is not handled when there are no table found.
Am getting the following errr ..
Error: ORA-06550: line 1, column 120: PL/SQL: ORA-00903: invalid table name ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored performing List of Values query: "select distinct famid d, famid r from .FMLY".
Pls let me know how to handle this error.. if the table is invalid.
scenario for poping this error:-
==================
I am having three "select list with redirect" items and one radio group ( having two Radion buttons - Relation , Famid )
The requirement is when the user selects Famid radio then the lov is suppose to populate the multiselect list with famid values from table P2D2008M05.FMLY and the schema P2D2008M05 is selected from three list items
P2D, 2008 , M05 one from each item .
If the schema is not selected and the user selects radio famid , then the error is coming , I need to put a validation or error handling mechanism when in which ,if the user selects famid radio and the schema is not selected , I need to raise an exception with proper error message to the user saying that the schema is not selected.
Pls helpin this regard.
Thanks/kumar.Hi,
Your exception is for function that return select.
Error is raised when Apex procedures try use select your function returns.
You need test your select inside function or create validations
Your function could look something like this
DECLARE
stmt VARCHAR2(4000);
l_count NUMBER;
BEGIN
IF NVL(:P1_SCHEMA,'%'||'null%') = '%'||'null%' THEN
raise_application_error (-20999,' Select the schema first ' );
END IF;
SELECT COUNT(1) INTO l_count FROM all_users WHERE username = :P1_SCHEMA ;
IF l_count = 0 THEN
raise_application_error (-20998 , ' Schema does not exist ' );
END IF;
stmt :='select distinct famid d, famid r from ' ||:P1_SCHEMA ||'.' ||'FMLY';
RETURN stmt;
END;That is just example, I did not test it. And I think it is not good idea raise errors inside LOV function.
You should use Apex after submit validations
Br,Jari -
Problem with dynamic LOV and function
Hello all!
I'm having a problem with a dynamic lov in APEX 3.0.1.00.08. Hope you can help me!
I have Report and Form application. On the Form page i have a Page Item (Popup Key LOV (Displays description, returns key value)).
When i submit the sql code in the 'List of vaules defention' box. I get the following message;
1 error has occurred
LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
When i excecute the code below in TOAD or in the SQL Workshop it returns the values i want to see. But somehow APEX doesn't like the sql....
SELECT REC_OMSCHRIJVING d, REC_DNS_ID r FROM
TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
returns_dns_lov_fn is a function, code is below;
CREATE OR REPLACE FUNCTION DRSSYS.return_dns_lov_fn (p2_dns_id number)
RETURN dns_table_type
AS
v_data dns_table_type := dns_table_type ();
BEGIN
IF p2_dns_id = 2
THEN
FOR c IN (SELECT dns_id dns, omschrijving oms
FROM d_status dst
WHERE dst.dns_id IN (8, 10))
LOOP
v_data.EXTEND;
v_data (v_data.COUNT) := dns_rectype (c.dns, c.oms);
END LOOP;
RETURN v_data;
END IF;
END;
and the types;
CREATE OR REPLACE TYPE DRSSYS.dns_rectype AS OBJECT (rec_dns_id NUMBER, rec_omschrijving VARCHAR2(255));
CREATE OR REPLACE TYPE DRSSYS.dns_table_type AS TABLE OF dns_rectype;
I tried some things i found on this forum, but they didn't work as well;
SELECT REC_OMSCHRIJVING display_value, REC_DNS_ID result_display FROM
TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
SELECT REC_OMSCHRIJVING display_value d, REC_DNS_ID result_display r FROM
TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
SELECT a.REC_OMSCHRIJVING display_value, a.REC_DNS_ID result_display FROM
TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) a order by 1
Edited by: rajan.arkenbout on 8-mei-2009 14:41
Edited by: rajan.arkenbout on 8-mei-2009 14:51I just had the same problem when I used a function in a where clause.
I have a function that checks if the current user has acces or not (returning varchar 'Y' or 'N').
In where clause I have this:
where myFunction(:user, somePK) = 'Y'
It seems that when APEX checked if my query was valid, my function triggered and exception.
As Varad pointed out, check for exception that could be triggered by a null 'p2_dns_id'
Hope that helped you out.
Max -
Problem with Lovs in same row of table
Hi all,
I am using two lovs in a row of advanced table.In first lov I am searching for few attributes and storing on of the values in a formValue(by using addLovRealtions(....,...,...,LOV_RESULT,...)). Based on this value I am using LOV_PASSIVE_CRITERIA to serach a value in second LOV. But when I am clicking on torch to search it's showing following message:
you must enter a value for searchVersionId as criteria for LOV.
where serachVersionId is formValue.
But Same LOVs if used outside this table are working properly. Can you guys please help me to pass value to formValue. I am posting that code snippet also where I am setting Lov relations.
//Set lov for Code
OAFormValueBean versionId = (OAFormValueBean)
webBean.findChildRecursive("searchVersionId");
OAMessageLovInputBean codeSystem = (OAMessageLovInputBean)
webBean.findIndexedChildRecursive("CodeSystemVersion");
if(codeSystem!=null){
codeSystem.addLovRelations(pageContext, "searchVersionId",
"VersionId", LOV_RESULT, LOV_REQUIRED_YES);
OAMessageLovInputBean code = (OAMessageLovInputBean)
webBean.findIndexedChildRecursive("Code");
if(code!=null){
code.addLovRelations(pageContext, "searchVersionId",
"VersionId", LOV_PASSIVE_CRITERIA, LOV_REQUIRED_YES);
Message was edited by:
user556665Adding the lovMaps will work for items outside the table at any point of time, since the ids dont get changed for LOVs. However inside the table, every lov in each row will go through some id transformation, this will not allow dynamic lov maps to be added after the Lovs are rendered. You should have them relations declaratively
-
Dynamic gallery with 3 columns and 5 rows with paging
guyz, i am new to spry and i need your help. i want to create
a dynamic gallery with data source as xml. i want to create a
gallery with 3 columns and 5 rows.Basically a wallpaper page where
there would be 15 wallpapers in a page with a link of downloading
wallpapers with resolution 800x600,1024x768 and 1280x1024.
for example if there are 63 wallpapers for a section , then
there would be 5 pages with 5th page having only 3 wallpapers.
everytime a wallpaper is added to xml, it automatically adds
it up in html...
plz help....i really want to create this asap and i cant find
any help...thanks a ton for your response.... Meanwhile i figured out
the solution myself using photogallery tutorial where div fixes the
width and the next repeated element get shifted to another
line.....
now i am struck with another problem.
i need to give substring to a particular data on xml.
for example i have the following xml
<movies>
<data>
Important Note: These online forums are for user-to-user
discussions of Adobe products, and are not an official customer
support channel for Adobe. If you require direct assistance, or
prefer to contact Adobe support staff directly, please contact
Adobe support.
</data>
</movies>
i want to display only first 50 characters of data tag.....
whats the code/syntax to do so..... -
What is the problem with native dynamic sql when counting rows in all table
what is the problem with native dynamic sql when counting rows in all table?Giving an error "table or view does not exist". Thanks.
DECLARE
v_sql_string varchar2(1000);
v_no_of_rows number;
BEGIN
for i in ( select table_name from all_tables )
loop
v_sql_string := ' select count(1) from ' || i.table_name;
dbms_output.put_line( v_sql_string );
--execute immediate v_sql_string into v_no_of_rows;
end loop;
END;Usually your problem can be described with 'Who cares'. I mean, for what reason do you do this? I doubt that there's a business need to get 100 % accurate answers for this. Normally such things are used to get a picture about the growth of data.
Personally I would prefer to have up-to-date statistics for all tables and just query the number of rows from there. Sufficient for me in < 99 % of all cases.
Just my $ .02...
Maybe you are looking for
-
Variant Configuration Variant configuration is for manufacturing complex products in which customer determines the features of the product. Objective of variant configuration is to react quickly to customers' requirements. Here it needs not to c
-
Firefox 3.6.10 currently using a persona (don't know its title) In the welcome window when it offers 8 personas to look at, refer to question.
-
Can't add server to non-cluster pool
Hi all, I created one non-clustered server pool, when tried to add the first server to the pool, it prompted one Error message as below: "Initial server must include master role" What does 'master role' of a server mean? I check the server properties
-
Can php be inserted into XML files in the same way that it can be inserted into HTML files if yes will the PHP still work if the XML flile is used by an external FLASH file of JS file to retrieve settings?
-
Installation CS 5.5, Exit 15 Code
Good day All, I am on my 6th attempt at an install and I receive the same Exit 15 code. I've done the following: 0) I'm installing this on an HP Probook 6440b laptop running, 32-bit Windows 7 OS; 1) Uninstalled all Adobe products from the system; 2)