Help with poplist record group query
Hi, I want to populate a poplist based on the following query:
SELECT value
FROM table.value
WHERE code_parent IS NULL
UNION ALL
SELECT 'ALL'
FROM dual
ORDER
BY code
Now I know that you need 2 columns in the record group to populate a poplist, but I cannot seem to modify the query to have 2 columns. I am basically adding the 'ALL' value, which will have a label of 'ALL' and a value of 'ALL'.
The first select I can easily modify to be an acceptable record group for a dynamic poplist, Its the union that im having problems with. The following select does not work. Help would be appreciated.
SELECT table.value, table.value
FROM table.value
WHERE code_parent IS NULL
UNION ALL
SELECT 'ALL', 'ALL'
FROM dual
ORDER
BY table.value
Based on the error I'd guess that one of your columns are defined as a number and the union columns are both varchar2. Match the datatype with the column it corresponds to:
UNION
SELECT 'ALL', 0
FROM DUAL
ORDER BY 1
The order by clause also needs to reference the column number instead of the column name since the union clause does not have a column name.
Similar Messages
-
List item - Record Group Query - Alignment improper Order
Dear All,
When am trying to concatenate two columns using record group query and displaying in the list item, the alignment is not in proper order.
E.g; Below is the columns and data's used in process:
CODE_VALUE SHORT_DESC DESCRIPTION
ROLL1 Customer - Non accidental Production, booking with other carrier, bad projection.
ROLL2 Customer - Accidental L/C, B/L draft, Customs, Samples, AMS, LAR.
ROLL3 ABC - Lack of empty Lack of empty units.
ROLL4 ABC CDE - Roll over AGR RRR decision.
ROLL5 ABC XXX - Accidental IMO or OOG refused, operational problems, Cut & Run.
ROLL6 ABC YYY - Fictive booking Equipment buffer, dummy booking.
Below is the record group query used in forms:
PROCEDURE p_when_new_form_instance
IS
GROUP_ID recordgroup;
list_id item := FIND_ITEM ('BLK_CONTROL.LI_ROLL_REASON');
rg_name VARCHAR2 (20) := 'LI_ROLL_REASONS';
status NUMBER;
l_query VARCHAR2 (4000);
BEGIN
l_query :=
'SELECT rpad(short_desc,50,'' '')||'' | ''||description description, code_value code_value FROM codes WHERE code_value IN (''ROLL1'', ''ROLL2'', ''ROLL3'',''ROLL4'',''ROLL5'',''ROLL6'')';
GROUP_ID := CREATE_GROUP_FROM_QUERY (rg_name, l_query);
status := POPULATE_GROUP (GROUP_ID);
POPULATE_LIST (list_id, GROUP_ID);
EXCEPTION
WHEN OTHERS
THEN
pl_common.when_others;
END;
Moreover i have my list item font property by default as ""MS SANS SERIF" and when i run in Forms Builder am getting the alignment as below.
Result:
====
DESCRIPTION CODE_VALUE
Customer - Non accidental | Production, booking with other carrier, bad projection. ROLL1
Customer - Accidental | L/C, B/L draft, Customs, Samples, AMS, LAR. ROLL2
ABC - Lack of empty | Lack of empty units. ROLL3
ABC CDE - Roll over | AGR RRR decision. ROLL4
ABC XXX - Accidental | IMO or OOG refused, operational problems, Cut & Run. ROLL5
ABC YYY - Fictive booking | Equipment buffer, dummy booking. ROLL6
Above order is not the expected result as all the |(pipe) symbol should display in proper order as below.
Expected Result:
==========
DESCRIPTION CODE_VALUE
Customer - Non accidental | Production, booking with other carrier, bad projection. ROLL1
Customer - Accidental | L/C, B/L draft, Customs, Samples, AMS, LAR. ROLL2
ABC - Lack of empty | Lack of empty units. ROLL3
ABC CDE - Roll over | AGR RRR decision. ROLL4
ABC XXX - Accidental | IMO or OOG refused, operational problems, Cut & Run. ROLL5
ABC YYY - Fictive booking | Equipment buffer, dummy booking. ROLL6
I tried with RPAD and LPAD still the alignment issue is there; i know the issue is because of invariable length of the font.
But is there any solution to override this it will be of great help.
So please help!!!!!!!!!!!!!!!!!
Thanks..................
Regards,
Sunil.GHi Francois,
Thanks for your reply. I have tried changing the font to "Courier(Western)" it is working fine.
But as per the standards defined, it should be "Ms Sans Serif" nothing apart from that.So that is where the problem lies. :(
Regards,
Sunil.G -
Populating list item with a record group
I'm trying to populate a list item (TList) with a Record group with a simple query: SELECT FRM_NAME FROM FORM
In the forms WHEN_VALIDATE_NEW_FORM trigger, I use POPULATE_LIST('FORM_LIST', 'RG_FORM_LIST');
Am I missing something? I get the error FRM-41334: Invalid record group for list population.thanks, i've tried that, but still nothing. I must be doing something simple, but very wrong. I tried with oracle's default scott/tiger schema, created a simple form with a record group with 2 columns, and populating a manually made poplist (populate_list('LIST4', 'RG1'); Still get errors:
FRM-30191: No list items defined for required poplist.
List LIST4
Item: LIST4
Block: EMP
Form: MODULE5
FRM-30085: Unable to adjust form for output. -
ORA-00904 when use column alias in Record Group Query
Is it possible to use column aliases in Record Group Queries?
I have a query that runs fine in SQL*Developer, but gives me runtime errors when I use it as a Record Group Query.
When I use it as a Record Group Query, the Form compiles, but at runtime I receive the following errors:
FRM-40502: ORACLE error: unable to read list of values
when I use Help - Display Error, I see:
ORA-00904:"CHILDNAME":invalid identifier
The query is something like this
select decode(complex stuff here) as "childname" ....
I've tried it with and without the double quotes surrounding the alias name, and have also tried it without using the "as" keyword.
I would appreciate any suggestions or insights. I'm using Forms 9.0.4.
Thanks.It looks like this is caused by bug 725059:
"FILTER BEFORE DISPLAY" DOESN'T WORK IF LOV HAS COLUMN ALIASES (TRIAGE1098)
My LOV does have the Filter Before Display turned on. Here's the text of the bug:
IF an LOV is created with column aliases in the select statement, (eg: select ename emp_name from emp) and the LOV property "Filter Before Display" is "Yes", THEN when you attempt to filter the LOV at runtime, (eg: type '%' then press the 'Find' button) the internal WHERE clause that forms sends to the database is: WHERE column_alias LIKE '%%' This is incorrect syntax. A client-side sqlnet trace shows this. The correct syntax should be: WHERE column LIKE '%%' . The incorrect syntax results in no rows returned. However no error is displayed by forms to the user. -
I have two LOV s one in the mainform and one in the subform. If I select one category from the list in the mainform LOV. In the subform LOV has to change it's record group (3 record groups) depending on the category selected in the mainform LOV. Please help. I am pasting the code I wrote. I tried it in the NEW ITEM INSTANCE TRIGGER, NEW BLOCK INSTANCE TRIGGER (datablock for the 2nd LOV with 3 record groups) and in the NEW FORM INSTANCE TRIGGER. Please help. Thank you.
DECLARE
lov_id1 LOV;
--val boolean;
rg_id1 RECORDGROUP;
rg_id2 RECORDGROUP;
rg_id3 RECORDGROUP;
BEGIN
lov_id1 := FIND_LOV ('ACTIVITYTYPE_LOV');
rg_id1 := FIND_GROUP('ACTIVITYTYPE_RG1');
rg_id2 := FIND_GROUP('ACTIVITYTYPE_RG2');
rg_id3 := FIND_GROUP('ACTIVITYTYPE_RG3');
-- val := SHOW_LOV(lov_id1, 32, 48);
IF
GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1' AND :YOUTH_GOALS.GOAL_TYPE = 'EXIT COUNSELING'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id1');
ELSIF
GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1' AND :YOUTH_GOALS.GOAL_TYPE = 'COMPLETE TRAINING'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id1');
ELSIF
GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1' AND :YOUTH_GOALS.GOAL_TYPE = 'VOCATIONAL TRAINING'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id2');
ELSIF
:YOUTH_GOALS.GOAL_TYPE = 'GRADUATE FROM HIGH SCHOOL'AND GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id2');
ELSIF
:YOUTH_GOALS.GOAL_TYPE = 'IMPROVE ACADEMIC PERFORMANCE'AND GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id2');
ELSIF
:YOUTH_GOALS.GOAL_TYPE = 'OBTAIN GED'AND GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id2');
ELSIF
:YOUTH_GOALS.GOAL_TYPE = 'NON-ACADEMIC'AND GET_LOV_PROPERTY(lov_id1,GROUP_NAME ) = 'rg_id1'
THEN SET_LOV_PROPERTY(lov_id1,GROUP_NAME,'rg_id3');
END IF;
end;try on when-validate-item or on POST-CHANGE
Regards,
Danish Hayder -
Just wondering if we need to check :system.mode = query or normal in the query for record groups or oracle forms handles it automatically
ThanksNo, you should not check System.Mode in a record group query. But then, Forms does not do that either.
Your question makes me wonder what you are doing... Record groups are usually populated only when you need to see a list of values, or use an LOV to perform an edit. -
Record Group Query - item block
I need to calculate a Record Group Query using a block item value, but when a use the query below the query didn't return rows:
SELECT OID_SIIB_FINALIDADE_TED
, F.COD_FINALIDADE || ' - ' || F.DES_FINALIDADE DES_FINALIDADE
FROM SIIB_FINALIDADE_TED F
, ( SELECT P.TP_PARAMETRO
FROM SIIB_PARAMETROS_GERAIS P
WHERE P.NM_PARAMETRO = 'TIPO_' || :BLOCK.ITEMX ) PAR -- using the :BLOCK.ITEMX the query did'nt return data
WHERE PAR.TP_PARAMETRO = F.TPO_FINALIDADEBut if a use a static query the Record Group( changing :BLOCK.ITEMX for 'STR0005' ) return the desired values.
This Record Group is used to pupulate a LOV.
Edited by: user5914526 on Feb 15, 2012 9:26 AM
Edited by: user5914526 on Feb 15, 2012 9:26 AM
Edited by: user5914526 on Feb 15, 2012 9:29 AMNo, it doesn't .
And return the message: "There aren't data in the List of Values"
And the block item is not empty or null.
Edited by: user5914526 on Feb 15, 2012 10:13 AM -
Changing the record group query in seeded forms
Hi all,
I need to change the record group query in one seeded form.
Can it be done through custom pll or what is the correct approach to do that..
Thanks,
Devangyou want to do that at runtime?
-
SOMEBODY HELP ME WITH A RECORD GROUP URGENT !
I HAVE THE NEXT ERROR 'UNHANDLED ERROR IN ICRG 102' IN ORACLE FORMS 5.0 WHEN I CREATE A RECORD GROUP WITH THE SENTENCE 'select nombres, to_char(ficha) from abogados order by nombres ' where nombres is data type VARCHAR2 and ficha is NUMBER. TOO I GOT IT THE SAME ERROR WHEN I CREATED A PROCEDURE WITH THE NEXT CODE:
PROCEDURE Populate_The_List(list_id VARCHAR2, sql_stat VARCHAR2) IS
group_id RecordGroup;
outcome NUMBER;
BEGIN
--Create temporary record group.
group_id := CREATE_GROUP_FROM_QUERY('List_Elements', sql_stat);
IF ID_NULL(group_id) THEN
MESSAGE('Record Group could not be created in Populate_the_List.');
RAISE FORM_TRIGGER_FAILURE;
END IF;
--Populate record group.
outcome := POPULATE_GROUP(group_id);
IF outcome <> 0 THEN
MESSAGE('Record Group could not be populated in Populate_the_List.');
RAISE FORM_TRIGGER_FAILURE;
END IF;
--Populate list item
POPULATE_LIST(list_id, group_id);
--Destroy the temporary record group to release resources
DELETE_GROUP(group_id);
EXCEPTION
WHEN OTHERS THEN
MESSAGE('Internal error occurred in Populate_the_List.');
RAISE FORM_TRIGGER_FAILURE;
END Populate_the_List;
ANYBODY CAN HELP ME WITH THE SOLUTION
ATTE: ROBERTO
SORRY FOR MY ENGLISHHi Roberto,
I don't understand your message!
What do you did?
bye Roxane
--thanks Roxane I did'it, but there is where jump the message
--the error, do you have other solution.
--Sorry
--Roberto -
Hi I am using oracle 10g. Trying to aggregate duplicate count records. I have so far:
SELECT 'ST' LEDGER,
CASE
WHEN c.Category = 'E' THEN 'Headcount Exempt'
ELSE 'Headcount Non-Exempt'
END
ACCOUNTS,
CASE WHEN a.COMPANY = 'ZEE' THEN 'OH' ELSE 'NA' END MARKET,
'MARCH_12' AS PERIOD,
COUNT (a.empl_id) head_count
FROM essbase.employee_pubinfo a
LEFT OUTER JOIN MMS_DIST_COPY b
ON a.cost_ctr = TRIM (b.bu)
INNER JOIN MMS_GL_PAY_GROUPS c
ON a.pay_group = c.group_code
WHERE a.employee_status IN ('A', 'L', 'P', 'S')
AND FISCAL_YEAR = '2012'
AND FISCAL_MONTH = 'MARCH'
GROUP BY a.company,
b.district,
a.cost_ctr,
c.category,
a.fiscal_month,
a.fiscal_year;
which gives me same rows with different head_counts. I am trying to combine the same rows as a total (one record). Do I use a subquery?Hi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
user610131 wrote:
... which gives me same rows with different head_counts.If they have different head_counts, then the rows are not the same.
I am trying to combine the same rows as a total (one record). Do I use a subquery?Maybe. It's more likely that you need a different GROUP BY clause, since the GROUP BY clause determines how many rows of output there will be. I'll be able to say more after you post the sample data, results, and explanation.
You may want both a sub-query and a different GROUP BY clause. For example:
WITH got_group_by_columns AS
SELECT a.empl_id
, CASE
WHEN c.category = 'E'
THEN 'Headcount Exempt'
ELSE 'Headcount Non-Exempt'
END AS accounts
, CASE
WHEN a.company = 'ZEE'
THEN 'OH'
ELSE 'NA'
END AS market
FROM essbase.employee_pubinfo a
LEFT OUTER JOIN mms_dist_copy b ON a.cost_ctr = TRIM (b.bu)
INNER JOIN mms_gl_pay_groups c ON a.pay_group = c.group_code
WHERE a.employee_status IN ('A', 'L', 'P', 'S')
AND fiscal_year = '2012'
AND fiscal_month = 'MARCH'
SELECT 'ST' AS ledger
, accounts
, market
, 'MARCH_12' AS period
, COUNT (empl_id) AS head_count
FROM got_group_by_columns
GROUP BY accounts
, market
;But that's just a wild guess.
You said you wanted "Help with count and sum". I see the COUNT, but what do you want with SUM? No doubt this will be clearer after you post the sample data and results.
Edited by: Frank Kulash on Apr 4, 2012 5:31 PM -
Using 'like' in record group query
Hi ,
(Forms 6i)
I'm creating a record group dynamically.
So in when new item trigger for a list item,
i want to list all names from a table like 'a%';
query : select name, to_char(id) id from test_name where name like 'a%';
but i'm not able give single quote(') in the query.
Is there a way to do that?
Edited by: Tuts009 on May 9, 2010 1:38 AMHi Arif,
i'm not giving a% directly in the query, this i'm getiing from what we type in the list , so :list4
i'm storing it in another string say str and then the query will be
str := :list4||'%';
rg_id := Create_Group_From_Query( rg_name,
'SELECT name,to_char(id) id from test_name where name like '||str); Now any help? -
Help with a simple XMLTable query
Newbie Oracle XML developer here and need a little guidance on how to retrieve multiple records in an xmltype table using xmltable.
My document in the xmltype table looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<echoems:ECHOMetrics xmlns:echoems="http://myURL/myFilename.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://myURL/myFilename.xsd
http://myURL/myFilename.xsd">
<OrderMetrics>
<OrderItemMetric>
<requestor>user1</requestor>
<product>123</product>
</OrderItemMetric>
<OrderItemMetric>
<requestor>0.0.0.0</requestor>
<product>ABC</product>
</OrderItemMetric>
<OrderItemMetric>
<requestor>user3</requestor>
<product>XYZ</product>
</OrderItemMetric>
</OrderMetrics>
</echoems:ECHOMetrics>
I want to get all the products:
Product
123
ABC
XYZ
I know to use XMLTable but am not sure how exactly to write it. If just one record, the following worked fine:
select extractvalue
(object_value,
'echoems:ECHOMetrics/OrderMetrics/OrderItemMetric/product',
'xmlns:echoems="http://myURL/myFilename.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
) object_value
from echoXML;
But with multiple records, I'm trying XMLTable but can't get it right. Trying something like this:
select m.product
from echoXML3
xmlTable(
(object_value,'echoems:ECHOMetrics/OrderMetrics/OrderItemMetric/*','xmlns:echoems="http://myURL/myFilename.xsd')
passing object_value
COLUMNS
product varchar2(85) path 'product') m;
Thanks in advance for any help on this.One more question. Instead of putting the xml doc in the query, how do I reference it from the xmlType table?
You have:
select *
from xmltable
'//OrderMetrics/OrderItemMetric'
passing xmltype(
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<echoems:ECHOMetrics xmlns:echoems="http://myURL/myFilename.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://myURL/myFilename.xsd">
<OrderMetrics>
<OrderItemMetric>
<requestor>user1</requestor>
<product>123</product>
</OrderItemMetric>
<OrderItemMetric>
<requestor>0.0.0.0</requestor>
<product>ABC</product>
</OrderItemMetric>
<OrderItemMetric>
<requestor>user3</requestor>
<product>XYZ</product>
</OrderItemMetric>
</OrderMetrics>
</echoems:ECHOMetrics>')
columns
prod varchar2(20) path 'product',
requestor varchar(50) path 'requestor'
However, the xmlDocument is already in an xmlType table called echoXML3 based on the xsd. I'm just trying to query it to get a relational result set. How, in the query above, do I replace the hardcoded xmlDoc with the xmlDoc located in my xmlType table?
I thought maybe something like this but it's not working:
select *
from xmltable
'//OrderMetrics/OrderItemMetric'
passing xmltype(select value(e)
from echoXML3,
TABLE(xmlsequence(extract(object_value,'echoems:ECHOMetrics/OrderMetrics/OrderItemMetric/*','xmlns:echoems="http://myURL/myFilename.xsd'))) e)
columns
prod varchar2(20) path 'product',
requestor varchar(50) path 'requestor'
Message was edited by:
user619814 -
Hi:
Is there any way you can get at runtime the query of a record group?.
I can't find any property for this.
Can I use a tree to put there the record group and after this get it with
Ftree.GET_TREE_PROPERTY( htree, 'QUERY_TEXT')
ThanxI don't think that it will work with a tree, but you could try to keep the query in a parameter and assign it to the recordgroup at runtime. At least you can read the parameter.
-
When i click the LOV it is giving Error Frm-40502 ORACLE error: unable to read list of values.
I have written the following query in the Record Group
Select uua_cd_company, uua_cd_dept, uua_id_proc_cntr from v_user_user_area where uua_id_users = user
I have used the user keyword in my query. When i run my form connecting to 11g database i get the LOV error
But when i run the form in 10g Database the LOV works.
Is there any restirction in using "User" in record group in LOVSeems like the select does not work for some reason against your 11g database. Try to execute the query using SQL*Plus with the same user youuse to connect in forms.
-
Help with listing records from two tables
Hi: I have two tables joined by the first field. The field is primary key in first table. Need help listing records from both tables with each record one line/record.
create table EVENTS (
event_key varchar2(64) primary key,
event_description varchar2(64),
create_time int
create table EVENT_UPDATES (
event_key varchar2(64) NOT NULL ,
update_description varchar2(64),
update_time int
insert into EVENTS values('Event1', 'This is event1', 1);
insert into EVENT_UPDATES values('Event1', 'Ticket created', 3);
insert into EVENT_UPDATES values('Event1', 'Event cleared', 10);
insert into EVENTS values('Event2', 'This is event2', 4);
insert into EVENT_UPDATES values('Event2', 'Ticket created', 6);
insert into EVENT_UPDATES values('Event2', 'Event cleared', 8);I want to print each record in EVENTS table as one line and corresponding records in EVENT_UPDATES as one line/record like this
Event1 1 This is event1
3 Ticket created
10 Event cleared
Event2 4 This is event2
6 Ticket created
8 Event clearedTIA
Raviselect case weight
when 1 then event_key
end key,
time_val,
description
from (
select event_key,
create_time time_val,
event_description description,
1 weight
from events
union all
select event_key,
update_time,
update_description,
2 weight
from event_updates
order by event_key,
weight
KEY TIME_VAL DESCRIPTION
Event1 1 This is event1
3 Ticket created
10 Event cleared
Event2 4 This is event2
6 Ticket created
8 Event cleared
6 rows selected.
SQL> SY.
Maybe you are looking for
-
Hello, I am currently producing a XY graph based on a set of points. Along with this, I plot three trendlines that the user then will select from. When he/she selects one of the trendlines, I wish for the other two to disappear. Currently, I am ab
-
Can i open adobe acrobat tracker on any computer and view my tracking information?
Can i open adobe acrobat tracker on any computer and view my tracking information?
-
Purchasing iSkin eVo2 Click Wheel Caps in the UK...?
Hello folks, Resident Furball here with a quick query. Apologies for posting in multiple locations, but I'm seeking an answer from the entire demographic of Pod users for this, given that it's something of an abstract query, and I need to play the nu
-
Older version incompability question
Hey people! I was hoping to get some help with the following question: I'm helping my sister launching her own wordpress (org) website. So I've been looking for nice templates on the web and have found some that suits the job. One template in particu
-
Do you need google chrome for new version of adobe reader
Hi= Sorry about the previous question. I went into on-line banking to pay bills, and was advised that I needed to download the newest version of Adobe Reader, which I did. When I click on the payee I get a message saying to install the newest version