Date_popup returning value to wrong row
I have looked at the thread below and still cannot get my code to work
Re: prevent certain rows in updateable report from being updated??
I have a tabular form that is used for a mass approval system for managers. In this tabular form the managers are allowed to change 2 fields...that status field which is a static lov and the approval date field. The approval date field will always be null when the user comes into the form so we have this field set automatically to the sysdate. The problem we are encountering is that when we change the date field to something other than sysdate the system will send the new date from the date picker to a different row. I found the thread above and tried to implement it in my code but it is still returning the data to the wrong row. I was trying to decipher the code and wasn't really sure about it so I thought I would put my code here in hopes that someone could help me. (NOTE - I don't really need the decode statement for the date_popup but if I didn't have it I would get an error so the first part of my decode statement shouldn't ever be hit cause we don't have an approval status of P.
Query Code
select
HTMLDB_ITEM.HIDDEN(1,EVAL."EVAL_ID") EVAL,
EVAL."EVAL_ID" EVAL_ID_DISPLAY,
HTMLDB_ITEM.SELECT_LIST(2,nvl(EVAL.APPROVE_MID,'Y'),'Approve;Y,Deny;N') MID_STATUS,
EVAL."EMP_ID",
EVAL."MID_BEHAVIOR_TOT_AVG",
EVAL."MID_PERF_TOT_AVG",
EVAL."FNAME" || ' ' || EVAL."LNAME" NAME,
EVAL."LOCK_FLAG_MID",
NVL(EVAL."SUPERVISOR_NAME", ' ') SUPERVISOR,
decode(EVAL.APPROVE_MID,'p',htmldb_item.text(3,to_char(eval.approve_mid_date,'dd-mon-yyyy'),null,null,'onfocus=this.blur()')||substr(htmldb_item.date_popup(3),1,0),htmldb_item.date_popup(3,NULL,NVL(eval.approve_mid_date,SYSDATE),'dd-mon-yyyy')) mid_date
from "#OWNER#"."EVAL", "#OWNER#"."EMPLOYEE", "#OWNER#"."TEMP_EMP"
WHERE EMPLOYEE."SUPERVISOR" = (SELECT POS_NUM FROM EMPLOYEE WHERE TEMP_EMP.CENUM = :APP_USER AND EMP_ID = TEMP_EMP.EMP_ID) AND EMPLOYEE.EMP_ID = EVAL.EMP_ID
Custom Submit Code
for i in 1..htmldb_application.g_f01.count
loop
update eval
set approve_mid = htmldb_application.g_f02(i)
where eval.eval_id = htmldb_application.g_f01(i);
commit;
IF :P72_DATE_OVERRIDE IS NULL THEN
update eval
set approve_mid_dATE = htmldb_application.g_f03(i)
where eval.eval_id = htmldb_application.g_f01(i);
commit;
ELSE
update eval
set approve_mid_date = :P72_DATE_OVERRIDE
where eval.eval_id = htmldb_application.g_f01(i);
end if;
commit;
end loop;
HELP PLEASE!!!!!
Thanks,
Amber
mtuser,
you have to be a little bit more patient, your initial postings was just a few hours ago.
About your problem, have a look at Re: prevent certain rows in updateable report from being updated??
I think it explains your problem and offers a solution for it.
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/
Similar Messages
-
POPUPKEY_FROM_QUERY returning value to wrong row
Hi,
I'm running Apex 3.0.1. I have a tabular report that I'm trying to add a popup from query that returns the key/code value (instead of the display value).
I can call the pop-up okay, but it's returning the value to the wrong table row. I can see in the naming of the Javascript functions that it's looking at the wrong row. For example, here are 4 rows in display order and the names of the Javascript function calls:
1. javascript:genList0_f15_1()
2. javascript:genList0_f15_3()
3. javascript:genList0_f15_2()
4. javascript:genList0_f15_0()
I can see in the function call that it's passing an index that doesn't match the displayed row number here:
"&p_element_index=" + escape ('1') + So if I click on the LOV icon for row 1 and select one of the LOV values, it will return the value to the second displayed row (zero-based index).
I've read here of some issues with not having all rows make the call (e.g. in this post from Patrick Wolf date_popup returning value to wrong row but all my rows have values.
The tabular report allows sorting by column headers, which I would guess is (at least part of) what's messing the function numbering? The query generates the rows, including the function calls, but the report displays in a different order?
Any suggestions would be greatly appreciated.
Thanks,
Stew
Good luck,
Stew
My Oracle Community blog: http://www.oraclecommunity.net/profiles/blog/list?user=stewstrykerChristina,
You hit the nail on the head! The tabular form region was defined as SQL Query - without the Updateable part! I'm not sure why I didn't have it that way from the start...
Now I just have to find and implement the Javascript that will copy the updated value that's returned by the LOV to the correct column (defined as apex_item.text). That was the only way I could figure how to allow the user to enter a value directly or select from a LOV. Clumsy but functional I believe!
Thanks to you and Scott for the tips.
Stew -
Date_popup returns date to wrong colum...
Hi,
I am using wwv_flow_item.date_popup in a select statement, but the problem is it is always returning the value selected to the wrong row.
I tried many things like putting an order by clause etc, but the same problem.
I have a query as follows:
select list..
from table
union
select list
from dual
order by x;
I also tried without the union, but still the same problem. I upgraded my htmldb version from 1.3.6. to 1.5.0.0, but still the same problem.
Any help is appreciated. If this is a know bug, I shall write my own JS for date popups.
thanks,
ashok manthina.Hi Sergio,
Thanks for the update. Here is the complete query...
select wwv_flow_item.text(1,exam_short_name,10) ExamCode
,wwv_flow_item.text(2,description,50) ExamDescr
,wwv_flow_item.date_popup(4,rownum,exam_date,'DD-MON-YYYY',15) ExamDate
,htf.anchor( 'f?p=101:54:'||:flow_session||'::NO::P54_COURSE_CODE,P54_COURSE_INSTANCE_ID,P54_EXAM_ID:'||:P52_COURSE_CODE||','||:P52_COURSE_INSTANCE_ID||','||exam_id,'<img src="/i/edit_big.gif" border="0">') e
,wwv_flow_item.hidden(6,exam_id) ExamId
,wwv_flow_item.checkbox(7,exam_id) Del
from course_exam
where course_instance_id = :P52_COURSE_INSTANCE_ID
union
select wwv_flow_item.text(1,null,10) ExamCode
,wwv_flow_item.text(2,null,50) ExamDescr
,wwv_flow_item.date_popup(4,rownum,null,'DD-MON-YYYY',15) ExamDate
,null
,wwv_flow_item.hidden(6,null) ExamId
,wwv_flow_item.hidden(7,null) ExamId
from dual
Now when I click on the date popup, and select a value it returns to either a row above or below. I could see the problem with the button that is getting generated. The JS associated with the button does not have the correct row number associated.
For e.g. the date popup button on row 3 has a call to javascript:genCalf04_0(), which obviously is wrong, it should instead be javascript:genCalf04_2()..
Thanks,
Ashok Manthina. -
Jtable return value of selecte row
Hy
I try to return from a class the value of the row selected in a Jtabel by mouse in an other caller class
Now I try a code like this :
table.addMouseListener (new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
JTable target = (JTable)e.getSource();
int row = target.getSelectedRow();
return row; // not possible
how can I take the value of row by return statement ?
thanks in advance
DanDon't use a MouseListener, use a SelectionListener: that's what it's for.
-
Assessable Value and Wrong Value in SEcess in first row in J1IS
Hi,
This is a scenario of Vendor Return when we are returning multiple excisable materials to Vendor.
I have created Return Delivery using movement type in MIGO with choosing the option Part 1 only.
In J1IS,
The First problem is the assessable value which is coming wrongly as 111.11 whereas the gross value of the material is Rs. 100 only with Excise Duty 10% BED, 2% ECess and 1% SEcess & 2% CST.
The second problem is
The duty values are showing correct in the screen e.g., BED 10, ECS 0.2 and AT1 0.1 (according to gross value 100, 10% BED, 2% ECess and 1% SEcess )
There are total five items with the same gross value and other duties (gross value 100, 10% BED, 2% ECess and 1% SEcess)
But as soon as the transaction is saved, the AT1 value against first row changes wrongly from 0.1 to 0.6 and the same is flowing to the table.
Can any one provide some idea to resolve this?
Thanks in advanceHi,
Please check my previous reply on this "Get Excise Invoice" problem thro' the link provided below.
Re: J1IS: u2018Get Excise invoiceu2019 not showing any values
Regards,
Siva -
Problem with return value of stored function
Hi,
I've made a stored function that insert a new row in a table and return the primary key (see at the end of the message the function script).
In VS 2005 with Visual basic, using the designer, I've created a dataset containing a tableAdapter to be able to use the Pl/SQL function.
My problem is I can't get the proper return value. The VB code below works without error except that I get 0 as value.
What's wrong?
Cheers,
Sebastien
VB code
Dim myAddSession As New ICISDataSetTableAdapters.AddSessionTableAdapter
Dim intSessionId As Integer
intSessionId = myAddSession.ADD_SESSION(tbxUsername.Text, _
tempFolder.Substring(tempFolder.LastIndexOf("\") + 1), _
"toto", Environment.GetEnvironmentVariable("COMPUTERNAME"), _
myLevelAccess.icisUserId, myLevelAccess.levelId)
The debugger tells me that the ADD_SESSION function return value is Object.
add_session PL/SQL script:
CREATE OR REPLACE FUNCTION ICISSEC.add_session (
orausername IN icis_session.ora_user_name%TYPE,
ctxsessionid IN icis_session.ctx_session_id%TYPE,
ctxsessionname IN icis_session.ctx_session_name%TYPE,
ctxservername IN icis_session.ctx_server_name%TYPE,
icisuserid IN icis_session.icis_user_id%TYPE,
startlevelid IN icis_session.start_lvl_id%TYPE
RETURN icis_session.ICIS_SESSION_ID%TYPE
IS
tmpvar icis_session.ICIS_SESSION_ID%TYPE;
BEGIN
INSERT INTO icis_session
(ora_user_name, ctx_session_id, ctx_server_name,
icis_user_id, start_lvl_id, ctx_session_name
VALUES (orausername, ctxsessionid, ctxservername,
icisuserid, startlevelid, ctxsessionname
RETURNING icis_session_id
INTO tmpvar;
COMMIT;
RETURN tmpvar;
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END add_session;naama wrote:
that if a value is null to convert it to 0 ? . i mean in the part of the declaration of parameter
Nope, can't do that in the signature. You'll need to handle that by validating the passed parameters at the start of the function.
It's simple enough. In your case you might just as well test for NULL and fail the function like this:
FUNCTION date_post_message(
user_lock_in IN NUMBER,
form_type_in IN NUMBER DEFAULT 0 ,
date_in IN DATE)
RETURN BOOLEAN
IS
v_num NUMBER(1);
BEGIN
dbms_output.put_line('Value of parameters : user_lock_in : '||user_lock_in || ' : form_type_in : '||form_type_in||' : date_in : '||date_in );
IF user_lock_in = 1 THEN
RETURN FALSE;
END IF;
IF form_type_in IS NULL THEN
RETURN FALSE;
ELSIF form_type_in NOT IN (1,2) THEN
RETURN FALSE;
END IF;
RETURN TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN FALSE;
END;In other use cases I would declare a local variable and process it like this:
IF form_type_in IS NULL THEN
l_form_type := 0;
ELSE
l_form_type := form_type_in;
END IF;Obviously the code should use the local variable rather than the parameter.
Validating the values passed in parameters at the start of a function is good practice. If you really want to go to town, read about Design By Contract.
Cheers, APC
Edited by: APC on Nov 9, 2011 1:36 PM
Added example, as requested by OP -
Single Sub Row Query Returns More Than 1 Row!
I am trying to update values in a table from another table and getting the error: Single Sub Row Query Returns More Than 1 Row.
I want table B's PRV_NAME updated into table A's PRV_NAME where A.PRVID = B.PRVID where B.PRV_TYPE = M'
Both tables have all unique PRVID's, however, table B has PRVID's that have the same name. So table B data can look like this:
PRVID PRV_NAME
1234 PHOENIX MED
1235 SAC MED
1236 SAC MED
1237 OVERLAND
etc..
So, as you can see the PRVID's are unique, but not the PRV_NAME's. Is this the reason why I get this error?
I did not build the tables and have no control over what is put in them. If this is the reason for the error, is there any way to resolve this?
For reference, here is the query. Maybe there is something wrong with this?
update msb_prv_source ps
set ps.prv_name =
(select prv00.prv00_prv_name
from prv00_prv prv00
join msb_prv_source ps
on prv00.prv00_prv_id = ps.prvid
where prv00.prv00_prv_type = 'M')
Edited by: user12296489 on Apr 19, 2013 10:46 AMHi,
user12296489 wrote:
I am trying to update values in a table from another table and getting the error: Single Sub Row Query Returns More Than 1 Row. Post your code. It's hard to say what you're doing wrong when I don't know what you're doing.
I want table B's PRV_NAME updated into table A's PRV_NAME where A.PRVID = B.PRVID
Both tables have all unique PRVID's, however, table B has PRVID's that have the same name. So table B data can look like this:
PRVIDIf b.prvid is really unique, then
UPDATE a
SET prv_name = (
SELECT prv_name
FROM b
WHERE a.prvid = b.prvid
;should work, whether the other columns are unique or not.
(Depending on your data and your requirements, you might want to use MERGE rather than UPDATE).
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ {message:id=9360002}
Edited by: Frank Kulash on Apr 19, 2013 2:00 PM
I see you've posted your code now:
update msb_prv_source ps
set ps.prv_name =
(select prv00.prv00_prv_name
from prv00_prv prv00
join msb_prv_source ps
on prv00.prv00_prv_id = ps.prvid
where prv00.prv00_prv_type = 'M')Even if ps.prvid is unique, the sub-query can return more than 1 row if prv00.prv00_prv_id is not unique. When that that's the case, what do you want to happen? Include examples when you post the sample data and desired results. -
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. -
Sys_refcursor not fetching any data although query returns value
hi!!!
I am using sys_refcursor to return columns,and using below procedure to do so.Although data is there in table_1 and table_2.
PROCEDURE test_pro(abc_date N DATE,
cur_get_data OUT sys_refcursor
OPEN cur_get_data
for
select A.col1,B.col2
from table_1 A
where A.dis_date=abc_date
left outer join
table_2 B
on
A.dis_date=B.dis_date;
IF cur_get_data%rowcount=0
then
raise e_error;
END if;
EXCEPTION
when e_error
then
------no_data_found;
when others
then
--------(giving SQL error with error code);
END test_pro;
while running below sql in sql window of pl/sql developer fetching
data
select A.col1,B.col2
from table_1 A
where A.dis_date=abc_date
left outer join
table_2 B
on
A.dis_date=B.dis_date;
but while testing the test_pro in test window of pl/sql developer it is
not fetching any data and raising e_error each time
is there any problem arising using IF cur_get_data%rowcount=0 as each time it is going to exception block..
so can somebody please put some ideas what cud be the possible reason for this??Welcome to the forum!
Unfortunatley you posted to the wrong forum. This question belongs in the SQL and PL/SQL forum.
PL/SQL
>
sys_refcursor not fetching any data although query returns value
but while testing the test_pro in test window of pl/sql developer it is
not fetching any data and raising e_error each time
is there any problem arising using IF cur_get_data%rowcount=0 as each time it is going to exception block..
>
A cursor doesn't fetch data - your code has to do that. The code you posted doesn't have any FETCH statements so no data will be fetched.
There is no problem using 'IF cur_get_data%rowcount=0' but it will always be 0 in your code because you are not fetching any data.
I'm guessing that you are trying to determine if there are any rows for the query. That isn't going to work since a cursor doesn't fetch rows.
You just have to return the cursor to the caller and the caller will have to perform at least one fetch to see if there are any rows.
If the above answers your question the just mark the question ANSWERED. Otherwise, since you have posted in the wrong forum
1. repost the question in the SQL and PL/SQL forum
2. Edit this post to add a link to the new thread in the other forum
3. Mark this question ANSWERED so people will follow up in the other forum.
Thanks. -
[ASK] popup return value only able to be displayed in disabled inputtext
Hi,
I'm using Jdev 10.1.3.
I have an inputtext and a commandbutton that triggers its value by selecting it from a popup window.
The problem is the inputtext will be able to display the returned value only when its "disabled" attribute
set to true. I need this inputtext to be enabled. Am i doing something wrong?
This is what I'm doing:
<af:panelGroup layout="horizontal">
<af:inputText value="#{processScope.glCode}" binding="#{productBean.glCodeInputText}" disabled="true"
id="glCodeValue" partialTriggers="dialogPopUpGlCode"
required="true" requiredMessageDetail="Select a GL Code for this Product"/>
<af:commandButton text="..." shortDesc="GL Code List" action="dialog:glCodePopUp" id="dialogPopUpGlCode"
partialSubmit="true" useWindow="true" immediate="true" windowHeight="300" windowWidth="300"
returnListener="#{productBean.onReturnFromSelectGlCodeDialog}">
</af:commandButton>
</af:panelGroup>Backing bean:
public String onReturnFromSelectGlCodeDialog(ReturnEvent returnEvent){
returnGlCodeId = returnEvent.getReturnValue().toString();
if (returnGlCodeId != null) {
PolicyMaintenanceModuleImpl policyMaintenanceModuleImpl = null;
try {
policyMaintenanceModuleImpl = getPolicyMaintenanceModuleImpl();
Product_ParamGlCodeViewImpl paramGlCodeVo = (Product_ParamGlCodeViewImpl)policyMaintenanceModuleImpl.getProduct_ParamGlCodeView();
paramGlCodeVo.setWhereClause("PARAM_GL_CODE_ID = '"+returnGlCodeId+"'");
paramGlCodeVo.executeQuery();
while (paramGlCodeVo.hasNext()) {
Product_ParamGlCodeViewRowImpl row = (Product_ParamGlCodeViewRowImpl)paramGlCodeVo.next();
returnGlCode = row.getGlCode().toString();
finally {
releaseAM(policyMaintenanceModuleImpl);
((AttributeBinding)getBindings().getControlBinding("GlCode")).setInputValue(returnGlCode);
JSFUtil.setProcessObj("glCode",returnGlCode);
return null;
}Please help..T_T
Thanks a lot..Thanks Shay, I've followed your suggestion but with no luck..
<af:selectInputText required="true" columns="#{bindings.GlCode.displayWidth}"
windowHeight="300" windowWidth="300" simple="true"
action="dialog:glCodePopUp" value=""
binding="#{productBean.selInputTextGlCode}"
returnListener="#{productBean.handleGlCodeReturn}"/>What do I should put in the "value" attribute? I've tried #{bindings.GlCode.inputValue} but if I do that then the selectinputtext will displayed in zero length (just a small vertical grey line) and with no such that green flash light image on the right. Because the main page is an add new form, so for the first time all the input is blank.
This is the handling method in the add-new-page back bean:
public void handleGlCodeReturn(ReturnEvent returnEvent) {
GlCodePopUpBean glCodeBean = (GlCodePopUpBean)returnEvent.getReturnValue();
if(glCodeBean == null)return;
//setter lines
String glCodeId = glCodeBean.getGlCodeId();
String glCode = glCodeBean.getGlCode();
getSelInputTextGlCode().setValue(glCode);
getSelInputTextGlCode().setSubmittedValue(null);
((AttributeBinding)getBindings().getControlBinding("ParamGlCodeId")).setInputValue(glCodeId);
AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
afContext.addPartialTarget(getSelInputTextGlCode());
}I've printed out glCodeId, glCode and getSelInputTextGlCode().getValue() after the setter lines, and all of them printed the right value, but it just not displayed in the inputtext!
I've also tried using processScope - #{processScope.glCode} - and it also failed in displaying the value in the inputtext.
I wonder what's wrong? -
Problem with the return value from a tablemodel after filtering
I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
**** This is the code to fill the jtable
DefaultTableModel modelo=(DefaultTableModel)this.jTable1.getModel();
while(rs.next()){
Object[] fila= new Object[2];
fila[0]=rs.getObject("id_categoria");
fila[1]=rs.getObject("nombre");
modelo.addRow(fila);
this.jTable1.getColumnModel().removeColumn(this.jTable1.getColumnModel().getColumn(0));
// I delete the first column because is a ID, I dont want that the user see it. the value is only for me**** this is the method to filter from the jtextfield
private void FiltrarJtable1() {
TableRowSorter sorter = new TableRowSorter(this.jTable1.getModel());
sorter.setRowFilter(RowFilter.regexFilter("^"+this.jTextField1.getText().toUpperCase(), 1));
this.jTable1.setRowSorter(sorter);
this.jTable1.convertRowIndexToModel(0);
}*** this is the method that return the ID (id_categoria) from the tablemodel
private void SeleccionarRegistro(){
if(this.jTable1.getSelectedRow()>-1){
String str_id =this.jTable1.getModel().getValueAt(this.jTable1.getSelectedRow(),0).toString();
int_idtoreturn=Integer.parseInt(str_id);
this.dispose();
}else{
JOptionPane.showMessageDialog(this,"there are no records selected","Warning!",1);
}Who I can solve this problem?m_ilio wrote:
I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
You're right in that you have to use convertRowIndexToModel(), but you are using it wrong. That method takes as input the index of a row in the view, i.e. the table, and returns the corresponding row in the underlying TableModel. No data is changed by the call, so this:
this.jTable1.convertRowIndexToModel(0);is meaningless by itself.
What you need to do is the following:
int selectedRow = this.jTable1.getSelectedRow(); // This is the selected row in the view
if (selectedRow >= 0) {
int modelRow = this.jTable1.convertRowIndexToModel(selectedRow); // This is the corresponding row in the model
String str_id =this.jTable1.getModel().getValueAt(modelRow, 0).toString();
}Hope this helps. -
FlexComboBox - return value from the dropdown after 5th Index
In QTP - Can i directly find value from FlexComboBox by Index, currently it can show only 5 values in dropdown, ifi do GetItemsCount it gives me total count in FlexComboBox but when i loop thorugh it it can successfully give me values only till idex 5 and then after that it says Object Required, (i am using flex 4.5)
m_ilio wrote:
I have a form (consult that return a value) with a jtextfield and a jtable. when the user types in the textfield, the textfield call a method to filter the tablemodel.
everything works fine, but after filtering the model, the references are lost and the return value does not match with the selected row.
I read that convertColumnIndexToView, convertRowIndexToView, vertColumnIndexToModel and convertRowIndexToModel, solve the problem, but I used all and nothing.
You're right in that you have to use convertRowIndexToModel(), but you are using it wrong. That method takes as input the index of a row in the view, i.e. the table, and returns the corresponding row in the underlying TableModel. No data is changed by the call, so this:
this.jTable1.convertRowIndexToModel(0);is meaningless by itself.
What you need to do is the following:
int selectedRow = this.jTable1.getSelectedRow(); // This is the selected row in the view
if (selectedRow >= 0) {
int modelRow = this.jTable1.convertRowIndexToModel(selectedRow); // This is the corresponding row in the model
String str_id =this.jTable1.getModel().getValueAt(modelRow, 0).toString();
}Hope this helps. -
TWO ERRO ORA-01427: single-row subquery returns more than one row
Hi,
I have a procedure which contains a cursor. If i run the select statement in the cursor separetly, it returns only value and works fine. But the same select statement in the cursor of a procedure throws me the error as below:
TWO ERRO ORA-01427: single-row subquery returns more than one row
Not sure what going on...any help appreciated.
Below is the select statement:
SELECT DISTINCT PSE.PARENT_POSITION_ID,
(SELECT DISTINCT PPD1.SEGMENT2
FROM PER_POSITION_DEFINITIONS PPD1,
HR_ALL_POSITIONS_F HAPF2,
PER_POS_STRUCTURE_ELEMENTS PSE2
WHERE TRUNC(SYSDATE) BETWEEN
HAPF2.EFFECTIVE_START_DATE AND
HAPF2.EFFECTIVE_END_DATE
AND PPD1.POSITION_DEFINITION_ID =
HAPF2.POSITION_DEFINITION_ID
AND
HAPF2.POSITION_ID = PSE2.PARENT_POSITION_ID
AND PSE2.PARENT_POSITION_ID =
PSE.PARENT_POSITION_ID
AND ROWNUM = 1) SEGMENT2,
(SELECT DISTINCT PAPF1.FIRST_NAME || ' ' ||
PAPF1.LAST_NAME CHIEF_NAME
FROM PER_ALL_PEOPLE_F PAPF1,
PER_ALL_ASSIGNMENTS_F PAAF1
WHERE TRUNC(SYSDATE) BETWEEN
PAPF1.EFFECTIVE_START_DATE AND
PAPF1.EFFECTIVE_END_DATE
AND TRUNC(SYSDATE) BETWEEN
PAAF1.EFFECTIVE_START_DATE AND
PAAF1.EFFECTIVE_END_DATE
AND PAAF1.POSITION_ID = PSE.PARENT_POSITION_ID
AND PAPF1.PERSON_ID = PAAF1.PERSON_ID
AND ROWNUM = 1) CHIEF_NAME
FROM PER_POS_STRUCTURE_ELEMENTS PSE,
HR_ALL_POSITIONS_F HAPF,
PER_POSITION_DEFINITIONS PPD
WHERE PSE.SUBORDINATE_POSITION_ID = 52744
AND TRUNC(SYSDATE) BETWEEN HAPF.EFFECTIVE_START_DATE AND
HAPF.EFFECTIVE_END_DATE
AND HAPF.POSITION_ID = PSE.SUBORDINATE_POSITION_ID
AND HAPF.POSITION_DEFINITION_ID = PPD.POSITION_DEFINITION_ID;
Thanks
PK
Edited by: user539616 on Jun 30, 2009 6:30 PMHi,
The cursor has a different parameter? Maybe the query is not exactly the same. Could you check this?
This is your query (formatted):
SELECT DISTINCT PSE.PARENT_POSITION_ID,
(SELECT DISTINCT PPD1.SEGMENT2
FROM PER_POSITION_DEFINITIONS PPD1,
HR_ALL_POSITIONS_F HAPF2,
PER_POS_STRUCTURE_ELEMENTS PSE2
WHERE TRUNC(SYSDATE) BETWEEN HAPF2.EFFECTIVE_START_DATE AND
HAPF2.EFFECTIVE_END_DATE
AND PPD1.POSITION_DEFINITION_ID = HAPF2.POSITION_DEFINITION_ID
AND HAPF2.POSITION_ID = PSE2.PARENT_POSITION_ID
AND PSE2.PARENT_POSITION_ID = PSE.PARENT_POSITION_ID
AND ROWNUM = 1) SEGMENT2,
(SELECT DISTINCT PAPF1.FIRST_NAME || ' ' || PAPF1.LAST_NAME CHIEF_NAME
FROM PER_ALL_PEOPLE_F PAPF1,
PER_ALL_ASSIGNMENTS_F PAAF1
WHERE TRUNC(SYSDATE) BETWEEN PAPF1.EFFECTIVE_START_DATE AND
PAPF1.EFFECTIVE_END_DATE
AND TRUNC(SYSDATE) BETWEEN PAAF1.EFFECTIVE_START_DATE AND
PAAF1.EFFECTIVE_END_DATE
AND PAAF1.POSITION_ID = PSE.PARENT_POSITION_ID
AND PAPF1.PERSON_ID = PAAF1.PERSON_ID
AND ROWNUM = 1) CHIEF_NAME
FROM PER_POS_STRUCTURE_ELEMENTS PSE,
HR_ALL_POSITIONS_F HAPF,
PER_POSITION_DEFINITIONS PPD
WHERE PSE.SUBORDINATE_POSITION_ID = 52744
AND TRUNC(SYSDATE) BETWEEN HAPF.EFFECTIVE_START_DATE AND HAPF.EFFECTIVE_END_DATE
AND HAPF.POSITION_ID = PSE.SUBORDINATE_POSITION_ID
AND HAPF.POSITION_DEFINITION_ID = PPD.POSITION_DEFINITION_ID;Tips: To put formatted code you must use {noformat}{noformat} tags, start tag and end tag are the same,you don't need to put '/' in the close tag.
Regards, -
Get values from selected row in a Table?
Hello.
I'm on VC 7.1 (the trial version downloaded from SDN).
I'm trying to figure out a way to retrieve some values from the currently selected row in a Table element through the output connector.
I have a web-service which returns results to the Table, and I want the user to be able to select one of the rows and then trigger another web-service call with some of the values from that row -- is this possible?
Also, I can't find any documentation that lists what can and can't be done with each UI element, is there something like this some where? (the Modeler's guide doesn't help, and the Reference guide seems to focus on menu items and what the VC screen looks like)
Thanks,
AlonHi Alon
This is a very simple task.
You just need drag the service which you want to execute, after select row, in model.
Drag output connector from table to input connector of service. Then map the parameter.
Regards
Marcos -
How can i get all these values in single row with comma separated?
I have a table "abxx" with column "absg" Number(3)
which is having following rows
absg
1
3
56
232
43
436
23
677
545
367
xxxxxx No of rows
How can i get all these values in single row with comma separated?
Like
output_absg
1,3,56,232,43,436,23,677,545,367,..,..,...............
Can you send the query Plz!These all will do the same
create or replace type string_agg_type as object
2 (
3 total varchar2(4000),
4
5 static function
6 ODCIAggregateInitialize(sctx IN OUT string_agg_type )
7 return number,
8
9 member function
10 ODCIAggregateIterate(self IN OUT string_agg_type ,
11 value IN varchar2 )
12 return number,
13
14 member function
15 ODCIAggregateTerminate(self IN string_agg_type,
16 returnValue OUT varchar2,
17 flags IN number)
18 return number,
19
20 member function
21 ODCIAggregateMerge(self IN OUT string_agg_type,
22 ctx2 IN string_agg_type)
23 return number
24 );
25 /
create or replace type body string_agg_type
2 is
3
4 static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
5 return number
6 is
7 begin
8 sctx := string_agg_type( null );
9 return ODCIConst.Success;
10 end;
11
12 member function ODCIAggregateIterate(self IN OUT string_agg_type,
13 value IN varchar2 )
14 return number
15 is
16 begin
17 self.total := self.total || ',' || value;
18 return ODCIConst.Success;
19 end;
20
21 member function ODCIAggregateTerminate(self IN string_agg_type,
22 returnValue OUT varchar2,
23 flags IN number)
24 return number
25 is
26 begin
27 returnValue := ltrim(self.total,',');
28 return ODCIConst.Success;
29 end;
30
31 member function ODCIAggregateMerge(self IN OUT string_agg_type,
32 ctx2 IN string_agg_type)
33 return number
34 is
35 begin
36 self.total := self.total || ctx2.total;
37 return ODCIConst.Success;
38 end;
39
40
41 end;
42 /
Type body created.
[email protected]>
[email protected]> CREATE or replace
2 FUNCTION stragg(input varchar2 )
3 RETURN varchar2
4 PARALLEL_ENABLE AGGREGATE USING string_agg_type;
5 /
CREATE OR REPLACE FUNCTION get_employees (p_deptno in emp.deptno%TYPE)
RETURN VARCHAR2
IS
l_text VARCHAR2(32767) := NULL;
BEGIN
FOR cur_rec IN (SELECT ename FROM emp WHERE deptno = p_deptno) LOOP
l_text := l_text || ',' || cur_rec.ename;
END LOOP;
RETURN LTRIM(l_text, ',');
END;
SHOW ERRORS
The function can then be incorporated into a query as follows.
COLUMN employees FORMAT A50
SELECT deptno,
get_employees(deptno) AS employees
FROM emp
GROUP by deptno;
###########################################3
SELECT SUBSTR(STR,2) FROM
(SELECT SYS_CONNECT_BY_PATH(n,',')
STR ,LENGTH(SYS_CONNECT_BY_PATH(n,',')) LN
FROM
SELECT N,rownum rn from t )
CONNECT BY rn = PRIOR RN+1
ORDER BY LN desc )
WHERE ROWNUM=1
declare
str varchar2(32767);
begin
for i in (select sal from emp) loop
str:= str || i.sal ||',' ;
end loop;
dbms_output.put_line(str);
end;
COLUMN employees FORMAT A50
SELECT e.deptno,
get_employees(e.deptno) AS employees
FROM (SELECT DISTINCT deptno
FROM emp) e;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 SMITH,JONES,SCOTT,ADAMS,FORD
30 ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES
CREATE OR REPLACE FUNCTION concatenate_list (p_cursor IN SYS_REFCURSOR)
RETURN VARCHAR2
IS
l_return VARCHAR2(32767);
l_temp VARCHAR2(32767);
BEGIN
LOOP
FETCH p_cursor
INTO l_temp;
EXIT WHEN p_cursor%NOTFOUND;
l_return := l_return || ',' || l_temp;
END LOOP;
RETURN LTRIM(l_return, ',');
END;
COLUMN employees FORMAT A50
SELECT e1.deptno,
concatenate_list(CURSOR(SELECT e2.ename FROM emp e2 WHERE e2.deptno = e1.deptno)) employees
FROM emp e1
GROUP BY e1.deptno;
DEPTNO EMPLOYEES
10 CLARK,KING,MILLER
20 SMITH,JONES,SCOTT,ADAMS,FORD
30 ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES
CREATE OR REPLACE TYPE t_string_agg AS OBJECT
g_string VARCHAR2(32767),
STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT t_string_agg)
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT t_string_agg,
value IN VARCHAR2 )
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateTerminate(self IN t_string_agg,
returnValue OUT VARCHAR2,
flags IN NUMBER)
RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT t_string_agg,
ctx2 IN t_string_agg)
RETURN NUMBER
SHOW ERRORS
CREATE OR REPLACE TYPE BODY t_string_agg IS
STATIC FUNCTION ODCIAggregateInitialize(sctx IN OUT t_string_agg)
RETURN NUMBER IS
BEGIN
sctx := t_string_agg(NULL);
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT t_string_agg,
value IN VARCHAR2 )
RETURN NUMBER IS
BEGIN
SELF.g_string := self.g_string || ',' || value;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateTerminate(self IN t_string_agg,
returnValue OUT VARCHAR2,
flags IN NUMBER)
RETURN NUMBER IS
BEGIN
returnValue := RTRIM(LTRIM(SELF.g_string, ','), ',');
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT t_string_agg,
ctx2 IN t_string_agg)
RETURN NUMBER IS
BEGIN
SELF.g_string := SELF.g_string || ',' || ctx2.g_string;
RETURN ODCIConst.Success;
END;
END;
SHOW ERRORS
CREATE OR REPLACE FUNCTION string_agg (p_input VARCHAR2)
RETURN VARCHAR2
PARALLEL_ENABLE AGGREGATE USING t_string_agg;
/
Maybe you are looking for
-
Migration Assistant from old iMac to new iMac
I have just purchased a new iMac and on startup the setup assistant allows me to move all my data and setup from my old iMac to my new iMac. However when I start although both iMacs seem to acknowledge each other the transfer does not occur. I new iM
-
How do I get the bookmarks to automatically appear in the toolbar?
When my computer updated firefox, the entire tookbar disappeared. I want to know how to reinstate the tool bar with my bookmarks.
-
DVD format for X61/X6 Ultrabase
I've just gotten a new X61 with the X6 Ultrabase and DVD burner. Please tell me what DVD media formats are compatible with that drive (for writing and creating system backups). I'd love to use my supply of Memorex DVD+RW disks. They work fine on my
-
Hi All?Iv been having major probs lately with my sound card and software. I get these messages when i load mediasource. [size="3" face="Times New Roman">)your music library is corrupted and cannot be recovered Mediasource will now revert to your most
-
hi, i want to print distinct value example data is given below : Jv.No hl.no col1 col2 col3 col4 col5 1 a12 xx yy zz 11 21 b23 xx yy zz 11 21 actuallly i m not printig the hl.no in his report , for u r reference i will show to u col1 to col 5 values