Display Distinct Item Value
Hello All,
I am having an problem displaying a distinct value for Item 'PK_EMPL_ID'. I need all the Items below because I am passing these values to another page in APEX. But I need help with this select statement syntax.
SELECT hs.pk_session_id,
hsp.pk_session_process_id,
hs.fk_class_id,
hsm.pk_empl_id,
hsm.last_name || ', ' || hsm.first_name studentname,
dg.department_group_descr,
pd.department_descr,
hsm.fk_dept_group,
hsm.fk_dept_code,
hsp.fk_empl_id,
hs.session_meridiem,
hsn.session_name,
hs.session_date,
hsp.session_process_status
FROM hrt_session hs,
hrt_session_name hsn,
hrt_session_process hsp,
hrt_student_master hsm,
cobr.department_group dg,
cobr.pps_department pd
WHERE hsn.pk_session_name_id = hs.fk_session_name_id
AND hsp.fk_session_id = hs.pk_session_id
AND hsp.fk_empl_id = hsm.pk_empl_id
AND hsm.fk_dept_group = dg.pk_department_group_id
AND hsm.fk_dept_code = pd.pk_department_idMy output is like:
-PK_EMPL_ID-
JOHN
JOHN
JOHN
BOBBY
JAMES
I only want to display each 'PK_EMPL_ID' value once when the select statement is executed, not duplicate values. I have tried distinct, group by etc... but I am having trouble since I am using multiple tables using these foreign keys. I have viewed a few threads but they are only handling one or two item values from one table. Can anyone assist me with please? Thanks ahead of time.
Hi,
Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements) for all tables, and the results uyou want from that data.
You may have a clear idea of where you're coming from, and where you want to go, but the description alone doesn't convey that clear idea to us.
You can also rephrase your question in terms of some commonly available table, like scott.emp.
For example: "I'm doing this query on scott.emp:
{code}
SELECT job
, deptno
FROM scott.emp
{code}
How can I get only 1 row per distinct job?"
Without sample output, the question is still vague.
There are 14 rows in scott.emp.
You can reduce the output to 9 rows by changing "SELECT" to "SELECT *DISTINCT* ":
SELECT DISTINCT
job
, deptno
FROM scott.emp
;which produces:
OB DEPTNO
MANAGER 20
PRESIDENT 10
CLERK 10
SALESMAN 30
ANALYST 20
MANAGER 30
MANAGER 10
CLERK 30
CLERK 20But that's as far as you can go without changing the results.
For example, all three departments have MANAGERs. If you want only 5 rows of outptu (one for each of the 5 distinct jobs), then which deptno do you want?
If you want the lowest one, here's one way to do that:
WITH got_rnum AS
SELECT job
, deptno
, ROW_NUMBER () OVER ( PARTITION BY job
ORDER BY deptno
) AS rnum
FROM scott.emp
SELECT job
, deptno
FROM got_rnum
WHERE rnum = 1
;Output:
JOB DEPTNO
ANALYST 20
CLERK 10
MANAGER 10
PRESIDENT 10
SALESMAN 30There are other apprioaches to this problem, too. The advantage of this one is that it works well with any number of columns in the output.
Similar Messages
-
Possible to display null item value as 'All' in blank HTML region?
Apex 4.1
Theme 21
Hi There,
I have select list which has null and other values. I have created a blank HTML region with the following text
Report for the year &P2_YEAR. and for geography &P2_GEOG.
Now P2_YEAR works fine because, it is always populated with a year. However, &P2_GEOG has 'All' as null value since we can see the report for all geographies. However, if the all option is selected, the above &P2_GEOG. shows as null. Since its not a PL/SQL proc, I cannot put in a NVL. I am guessing one possible way is to write a PL/SQL code before region and then check if its null and then try to populate a new hidden field and show, something like that. Wondering if there is a way to do it directly in the HTML region?
Thanks,
Sun
Edited by: ryansun on Jul 2, 2012 12:49 AM
Edited by: ryansun on Jul 2, 2012 12:50 AM
Edited by: ryansun on Jul 2, 2012 12:55 AMHi Morten,
in the validation callback you could use apex_util.set_session_state to modify the page items value. We do that ourself in the "Number Field" native item type plug-in.
Regards
Patrick
Member of the APEX development team
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
How do you display an item value based on other items?
Item C's value depends on item A and B. If both A&B are null then C should display null , if A is null but B is not null then display 'Ok', everthing else display ' problem';
3 items on page 5
item A: name p5_A, display as text (saves state). source type is a dabase column
item B: name P5_B, display as text (saves state). source type is a databbase column
item C: name P5_C, display as text (based on PLsql doest not save state), source type pl/sql anonymous block ? like the following
if :P5_A is null and :P5_B is null then :P5_C is null; else if :P5_A is null and :P5_B is not null then :P5_C := 'OK'; else :P5_C := 'Problem'; end if;
Can someone tell me what did I do wrong on these stements unde apex? Thanks a bunch.
TaiAlternatively, you could do a add a computation for that item - same source as mentioned in the previous reply, but each will work.
Also, in your anonymous block, you have:
if :P5_A is null and :P5_B is null then :P5_C is null; else if :P5_A is null and :P5_B is not null then :P5_C := 'OK'; else :P5_C := 'Problem'; end if;should probably be
if :P5_A is null and :P5_B is null then :P5_C := null; elsif :P5_A is null and :P5_B is not null then :P5_C := 'OK'; else :P5_C := 'Problem'; end if;so instead of :P5_C is null , assign it a null - :P5_C := null. Also, else if in pl/sql is written as: elsif
Edited by: tr3nton on Jan 19, 2010 3:03 PM -
Display distinct Master values when using Detail Ordering
Hi People,
I need to be able to produce a report in the following form
Dept Empno
RESEARCH 7369
SALES 7499
7521
RESEARCH 7566
SALES 7654
etc etc
Its basically a Tabular report ordered on Empno BUT without repeating values of Dept when Dname doesn't change. Can anyone tell me how do achieve this?
Regards
AndyAndy,
then try the following
- build a global variabe myDname via a package spec in reports:
PACKAGE Global IS
myDname varchar2(40):='DUMMY';
END;
- write a format trigger on the field dname:
function F_dnameFormatTrigger return boolean is
begin
if global.mydname = :dname then
return (FALSE);
else
global.mydname := :dname;
return (TRUE);
end if;
end;
This seems to work fine. But pay attention. A format trigger fires every time reports try to format the object. So it's possible, that the trigger fires twice for the object (trigger fires when formatting at the end of the page and the reports recognizes, that for eyample the whole record doesn't fit on the page, so the record (and the field) hat to be formatted on the next page again). You must use a counter in the group (summary column with function count and reset at report) and store and compare this counter together with the dname to be sure. It's not very probable, but possible.
Hope this now helps
regards
Rainer -
How to send a list item value to URL to open data related to item value
Hi,
Iam using Apex4.0 and iam facing some problem. Iam unable to send selected list item value to the url specified in the HTMl region.
Here i want to open the data related to list item value in other page.
List item - :Familyp
i want to pass this selected value to the url and when ever user selected the list item and clicks on the url, then it should display the item value related data in new page.
I tried with &FamilyP in url but it's not working. Any one help me plz.
Regards
Vamsi.TataIs it a normal Select list or Multi Select list?
If you have select list that allows you to select multiple options then you cannot pass it through URL. Multi-select /Shuttle keep colon separated list in the item, and this confuses Apex because the Apex URL uses colons for a different purpose. No escaping or URL encoding will help.
If it is normal select list that allows selection of only one option then you can pass through the url. Unless of course the data has a colon in it.
For multi-select, and when the value contains colon, the only way is to save the value in session state, same page item or any other place like Application Item, and then reference it at the other end. Never pass through the URL.
Regards, -
How to Display Parent Form Values in Child Form
Hi,
I have Order Page and Item Page
In the order Page If I select any Item and click on Submit Button, It should open Item Page and results should display in advance table region. In my Item page i have header region(Default double) with 3 fields (dummy) like
Item
Description
org
Now my question is I need to display the Item Value in the Item Page Header region in the Item Column which I was selecting in the Order Page.
I have an order 100 with item A, B , C I select B and click on submit It should open Item Page and in items page i have a column called Item and the value B sholud be populated.
Thanks,
MaheshHello Ajay,
Thanks for your reply..
What Iam doing is Iam capturin the values in session variables like below when submit button is clicked
pageContext.putSessionValue("SItemNo",ItemNo);
And when my item page is opening I need to set this value to that VO Attribute..
Iam trying the below way to set the attr value in PR
String SItemNo=(String) pageContext.getSessionValue("SItemNo");
OAMessageTextInputBean oa = (OAMessageTextInputBean)webBean.findChildRecursive("ItemNo");
oa.setAttributeValue(SItemNo);
But it is giving compilation error
Error(35,9): method setAttributeValue(java.lang.String) not found in class oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean
Please correct me ajay.
Thanks, -
Display Dataset field Value in the footer based on the Group
Hi Guys,
My current SSRS report is displaying multiple projects data. One Project data is rendering into 1 or 2 pages based on the project specific data.
Now, the requirement here is to display the "ProjectName" in the footer of the SSRS report in below format. For instance, if project A data is rendering in 2 pages then the footer in two pages should display project Name A and in the
third page it shows display the Project Name b in the footer of the report.
ProjectName [Insert Reporting Month] Page
# of #
Has anyone come across such requirement. Thanks.
Warm Regards Badal RatraHi Badal,
In SQL Server Reporting Services (SSRS), we cannot use the “Project” filed without specifying a dataset aggregate in page footer. However, we can display the item value in the page footer. Please refer to the following steps:
Add a list in the report. Configure this list with the corresponding dataset.
Configure the list “Group on:” ProjectName.
Add the tablix in the list, add page break “Between each instance of a group” of the list.
Add a text box (TextBox1) with expression below:
=Fields!ProjectName.Valu
Set the visibility of the text box to Hide.
Add a text box in the page footer fill with following expression:
=ReportItems!TextBox1.Value
If you have any questions, please feel free to let me know.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
Displaying item value on basis of pop up lov value
Hi ,
I have created a form on which i have a pop up lov item whose values are getting displayed on basis of a table column.Now my requirement is that when a user select a value(for ex: say an code i.e 123) from pop up lov then on basis of this value an another value pops up which shows the description related to this code.I have this description in another column of same table from which i have displayed pop up lov values.
I tried to implement this by creating a display only item on form and taking source value of this item from sql query returning single value as code is primary key but I am unable to fetch value.I have written the following query:
select model_code from BL_VEHICLE_ENGINE_NAME where catalog_code=:p9_catalog_code
Here p9_catalog_code is the item displaying pop up lov.
when i am specifying a particular value rather than bind value as (select model_code from BL_VEHICLE_ENGINE_NAME where catalog_code=123) then the description corresponding to this value is getting displayed through display only item.
How can i fetch value from pop up lov and utilize that value to display required description.Is displaying description through display only item correct or is there any other way around through which this description could be displayed more effectively.
Thanks
AbhiHi Abhi,
Instead of pop up lov you can use cascade lov ie when u have data like say if u select code from ur table 123 and it has more than one description then u can use cascade lov it will query upon the first lov what u required.
Or coming to ur problem
for code pageitem say p1_code u are using pop lov (you can try select list instead of pop up lov )
and for description u r using display column.
and give the source as return single query only
select descp from table where code=:P1code.
Hopes this helps you
Thanks & Regards
Srikkanth.M -
Set value of a display only item using javascript
I was trying to find an answer in the forum but my searches gave me no results. How do
I set a value of a display only item using javascript (ajax)?
Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------Vikas,
Thanks for a fast responding. The type is Saves State. However, I tried to set the value
of a display only item using:
<script>
function f_setDisplayOnly ()
{$x('P80_X').parentNode.childNodes[4].nodeValue = 1;
</script>without a result (or error). What am I doing wrong?
Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Why cannot I use hidden or display only item to store value for insert?
hi, Gurus:
I have a question:
I implemented a form with report region in a page, the update works OK, but the add function has a problem:
There is a column, offender_ID, which is a foreign key for another table, it should not be null during insert. However, even I pass the offender ID from master page when user click the create button, and it did shows in the form, it must be a text filed to insert successfully, why cannot I use hidden or display only item to store this value for insert? (If I use hidden or display only item, insert won't be successful, apex reports I tried to insert a null value to offender_ID column.)
Many Thanks in advance.
SamHi,
There is a column, offender_ID, which is a foreign key for another table, it should not be null during insert. However, even I pass the offender ID from master page when user click the create button, and it did shows in the form, it must be a text filed to insert successfully, why cannot I use hidden or display only item to store this value for insert? (If I use hidden or display only item, insert won't be successful, apex reports I tried to insert a null value to offender_ID column.)I think both hidden and display items have attributes that can cause problems because of different ways these items function than non-hidden and non-display-only items function. Display Only items have a "Setting" of "Save Session State" Yes/No? That can be a problem.
Would you do this? Make these items regular items instead and see if you can get those working. Then, we will try to change the fields back to hidden or display only.
Howard
Congratulations. Glad you found the solution.
Edited by: Howard (... in Training) on Apr 11, 2013 10:26 AM -
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,
JonJon,
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 -
Setting values to Display Only item during AJAX request
Hello,
Good Morning!
In a master-detail form, in the detail report, I am populating two columns SERVICE_TAX_PCT and SERVICE_TAX_AMOUNT by making an AJAX request after selection of ACCOUNT_CODE. Values are populated with out any issue.
However, as soon as I make those two fields as Display Only, the values are not getting set. Is there a way to set the values to a field in the same time it should be restricted for user to change it?
(APEX 4.2.6)
Thanks,
-AnandHi Anand,
anand_gp wrote:
Hello,
Good Morning!
In a master-detail form, in the detail report, I am populating two columns SERVICE_TAX_PCT and SERVICE_TAX_AMOUNT by making an AJAX request after selection of ACCOUNT_CODE. Values are populated with out any issue.
However, as soon as I make those two fields as Display Only, the values are not getting set. Is there a way to set the values to a field in the same time it should be restricted for user to change it?
(APEX 4.2.6)
check the example
Step 1: Edit your page
under CSS->Inline put the code given below
.row_item_disabled {
cursor: default;
opacity: 0.5;
filter: alpha(opacity=50);
pointer-events: none;
Step 2 : I guess you have Javascript function similar like given below
you have to extract rowid first, for which you want to set the percentage , see line 6
and see line 18, for disabling the column of that row.
<script type="text/javascript">
function f_fetch_tax_percentage(pThis) {
var ajaxRequest;
var ajaxResult;
var row_id = pThis.id.substr(4);
var percentage = 'f05_' + row_id; // replace f05 with the rowid of percentage column
ajaxRequest = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=TAX_DTLS',0);
ajaxRequest.addParam('x01',$v(pThis));
ajaxResult = ajaxRequest.get();
if ( ajaxResult.length > 0 ) {
// set percentage
$('#'+percentage).val(parseFloat(ajaxResult));
// disable percentage column
$("#f05_" + row_id).attr("readonly", true).addClass('row_item_disabled');
</script>
Hope this helps you,
Regards,
Jitendra -
How to display a default value in BI Publisher
Hello friends,
I need to display a report based on supplier wise or dept wise stock.i've taken parameter type as menu and selecting the values from the drop down list for ex(1,2,3...)... what i want is I should display a default value like select item or something like that in drop down list so that any of the above said values are not shown to the reports user...
Please let me know how...
ThanksHello vetsrini,
thanks a lot for the reply... may be I'm not able to put my requiremet straight.. let me try one more time
My requirement is like the end user has to get the report based on whether he want dept wise or supplier wise
so
where sl.supplier=:supp
or d.dept_no=:dept
this is what i've given in the data set
the user gets report data based on either dept wise/supplier wise..
so I've given query in lov as select distinct dept_no from dept and select distinct supplier from suppliers for the two parameters supp and dept and the type as menu...
so I can see the values like (list of query generated values... ).. I want to do this thing like I want to display 'select' in that list...
is it possible?... Please let me know, if possible..
it should show like dept:select,101,102,103,104....) -
Setting an item value before print report in BI Publisher
Hi,
I am having an issue with setting a page item's value once a button (that prints a BI Publisher report) is pressed. The session state for the item is set, however because the page does not re-load no value appears in the item on the page.
I am using a button as a page Item and using a Page Branch with the Branch Point set as On Submit: After Processing(After Computation, Validation, and Processing) with the Page set to 0 and the Request set to PRINT_REPORT=REPORT
Is there any way to set the item value on the page before branching to the report?
Your help is greatly appreciated.
-MarshaMarsha,
You can do that as follows:
1- create a hidden text item (P20_date_hidden) with default value set to sysdate.
2- for your button >> edit >> Buttom display attributes >> attributes >> type in : onFocus= "set_date();" (( note: am using onFocus because it takes places before onClick ))
3- In your page >> edit >> HTML header >> type in :
<script language="JavaScript" type="text/javascript">
function set_date()
v_date = $x('P20_DATE_HIDDEN').value;
$x('P20_DATE_LETTER_SENT').value = v_date;
</script>
Hope this helps,
Sam
Please reward good answers by marking them correct or useful! -
Bug (possibly?): SelectManyShuttle fails to display selected items
Bug (possibly?): SelectManyShuttle fails to display selected items when valuePassThru="true" in ADF 10g
Hello all,
When run, the example below shows a Select Many Shuttle with four choices in the leading list. When items are shuttled to the training list and the page is submitted the trailing list is rendered with no items selected. Is this a bug?
Configuration
This example was constructed using jDeveloper 10.1.3.5.0.
A new application was created using the Web Application [JSF, ADF BC] template although no business components are used.
Steps to Reproduce
1. Create the following backing bean class.
package com.fmcna.adf.test.view;
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
public class ShuttleBean {
public ShuttleBean() {
private List availableItems;
private List selectedItems;
public void setAvailableItems(List availableItems) {
this.availableItems = availableItems;
public List getAvailableItems() {
//populate with a List of SelectItem instances on the inital call to this method
if(this.availableItems==null) {
this.availableItems=generateSelectItemsList();
return availableItems;
public void setSelectedItems(List selectedItems) {
this.selectedItems = selectedItems;
public List getSelectedItems() {
return selectedItems;
* Build a List of SelectItem instances to be used by an af:selectManyShuttle
* @return A List containing SelectItems instances
private List generateSelectItemsList() {
List initialItems = new ArrayList();
initialItems.add(new SelectItem(new Integer(11),"First Choice"));
initialItems.add(new SelectItem(new Integer(22),"Second Choice"));
initialItems.add(new SelectItem(new Integer(33),"Third Choice"));
initialItems.add(new SelectItem(new Integer(44),"Fourth Choice"));
return initialItems;
}2. Configure the ShuttleBean class as a session scoped managed bean as in the following faces-config.xml file.
<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config xmlns="http://java.sun.com/JSF/Configuration">
<managed-bean>
<managed-bean-name>ShuttleBean</managed-bean-name>
<managed-bean-class>com.fmcna.adf.test.view.ShuttleBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<application>
<default-render-kit-id>oracle.adf.core</default-render-kit-id>
</application>
</faces-config>3. Create a JSP page containing an af:selectManyShuttle with a nested f:selectItems component. Wire the values for these components to the properties in the managed bean.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
<f:view>
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252"/>
<title>testShuttle</title>
</head>
<body><h:form>
<af:selectManyShuttle value="#{ShuttleBean.selectedItems}" valuePassThru="true">
<f:selectItems value="#{ShuttleBean.availableItems}"/>
</af:selectManyShuttle>
<af:commandLink text="Postback"/>
</h:form></body>
</html>
</f:view>4. Run the JSP. Validate that the trailing list is initially empty.
5. Shuttle one or more items to the trailing list and click the Postback button. Validate that when the page refreshes the trailing list is again empty.
Thanks for any input you might be able to provide.
Chris Mihalcik
Edited by: user5384858 on Jun 14, 2010 1:06 PMI'm holding my Nano in my hot little hands with ALL of the things you listed, but here's the sad, simple truth: you CAN'T use iTunes to sync everything. It works well for:
1) Music
2) Videos (except sometimes in Vista)
3) Photos (as long as they're not too large)
but is terrible for:
1) calendar
2) contacts
3) To-Do lists
For the latter use something like "iGadget" (www.ipodsoft.com). I also edit/store notes w/iGadget plus it allows you to export files, etc.
I gave up on syncing iTunes w/Outlook long ago. Good luck.
Maybe you are looking for
-
What is the promper format of files using the Document step in UCCX 8
Hello all, I am working a script that is using the document steps in the script editor. The script will allow the user to call in and turn a greeting on and off I have a few sample scripts from version 5 and 7 and do this but I am on verions 8.0 and
-
Hey Everyone, As camera and sensor technology has advanced, so has the ability of digital cameras to record in lower light without an external light source. In the past if you wanted to capture a useable image in low-light conditions you would have t
-
Positioning a responsive composition in a containing DIV
OK, I may be having a fruit loop moment but I've spent 2 days trying to correctly position and size a responsive composition in a basic div. I have some old compositions that I am trying to update from 2013 but when the responsive scaling is selected
-
Cant get audio on my recordings for iphone 4s
cant get audio on my recordings for iphone 4s
-
The program can't start because COMCTL32.dll is missing from your computer
the program can't start because COMCTL32.dll is missing from your computer