Parsing Through the Multi Selection Values in a PL/SQL Procedure
Greetings,
This should be an easy one for one of you PL/SQL experts. I'm not, so I am unsure how to code this up.
I have a Multi Selection page item and am passing the value of it to a PL/SQL routine as a parameter. I am able to use the value if I only pass my procedure one value, so I have it working. Just not with multi-values I need the code in the procedure to loop through the values. How do I code that up? The procedure is relatively short and is included below. p_cell is the multi-value parameter.
Oh yes... You probably need to know this. The values are coming in like this - 1-3:2-3:3-3:5:6
Also, the values are the x-y coordinates of a grid I have over an image on the page. The routine removes certain cells (1-3, etc.) from the grid. The grid is created using HTML, so I have to remove lines of HTML to remove a cell from the grid. Just in case that is helpful.
Thx, Tony
= = = = = = =
create or replace
procedure qcis_remove_grid_cell(p_id IN NUMBER,p_cell IN VARCHAR2) as
v_position number;
v_position_from_end number;
v_line_start number;
v_line_end number;
v_length number;
v_html clob;
BEGIN
BEGIN
select imagemap_html into v_html from qcis_im_template_draft
where header_id = p_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN
v_html := NULL;
END;
v_length := length(v_html);
v_position := INSTR(v_html,'alt="'||p_cell||'"');
v_position_from_end := (v_length - v_position) * -1;
v_line_start := INSTR(v_html,'<area shape',v_position_from_end) - 1;
v_line_end := INSTR(v_html,'/>',v_position) +2;
v_html := substr(v_html,1,v_line_start) || substr(v_html,v_line_end);
UPDATE qcis_im_template_draft SET imagemap_html = v_html WHERE header_id = p_id ;
END qcis_remove_grid_cell;
Edited by: cloaked on Nov 1, 2011 8:01 AM
Not sure I understood your need, but it sounded like you need to unscramble a string into a set of rows. If so, I would give you 2 ideas:
1. STRING_TO_TABLE function: http://www.sloug.org/i/doc/api073.htm
2. Other ways (Regular expression or XML): http://apex-at-work.blogspot.com/2011/05/two-ways-using-string-to-table-in-apex.html
Similar Messages
-
How to get the current selected value of a combo box or a option button?
Hello All,
I want to catch the current selected value of a combo box and also of a option button and want save it into different variables in my code. These option button and combo box are in a SAP business one form which I have created through VB dot.net coding.
But I don't know how to do that, can any one send any example code for this.
Regards,
Sudeshna.Hi Sudesha,
If you want to get the selected values you can do it as follows: The Combo Box value you can get from the combo box. If you want to get it on the change event, you must make sure that you check when BeforeAction = False. If you want to get an Option Button value you should check the value in the data source attached to the option button.
Dim oForm As SAPbouiCOM.Form
Dim oCombo As SAPbouiCOM.ComboBox
Dim oData As SAPbouiCOM.UserDataSource
oForm = oApplication.Forms.Item("MyForm")
oCombo = oForm.Items.Item("myComboUID")
oApplication.MessageBox(oCombo.Selected.Value)
oData = oForm.DataSources.UserDataSources.Item("MyDataSourceName")
oApplication.MessageBox(oData.ValueEx)
Hope it helps,
Adele -
Prerequisites for multi selection value help
Hi everyone,
a couple of blogs and forum entries show multi selection value helps in VC. I, on the other hand, have so far been unable to do this. The only option I get in the first step of the value help wizard is the "single selection" type. Even if I start off with a blank form view and add a text input field I cannot choose anything apart from a single selection value help. Is there something I am completely missing? I stumbled upon a note bringing this into connection with OLAP source systems, but I can't quite see why this should change anything since the source system is not selected until step 2 of the wizard.
Any idea on this? Thanks a lot,
TilmanHi Mario,
thanks for the hints, I got it working now, regardless of whether you use an OLAP source system, variables or the respective input port, though. It seems to suffice to connect the query directly to a form view to get the additional options. My problem was then that I had a form view connected to a nested iview. I should be able to connect it to both a query and the iview, though.
Thanks for your help,
Tilman -
How to get the previoulsy selected value in a combobox
How to get the previoulsy selected value in a combobox. i WANT the current and the previously selected value of the combobox.
Just add to combobox ItemListener. When item is changing in itemStateChanged arrives 2 events. ItemEvent.DESELECTED and ItemEvent.SELECTED with corresponding item's values. Just write something like this:
comboBox.addItemListener(new ItemListener() {
Object prevValue;
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
//do what you need with prevValue here
} else {
prevValue = e.getItem();
}); -
On my panel i have a jcombobox in upper half(which displays say the address type.) and few text fields on the lower half(which displays the add details). when the user selects a value in the combo box the text fields are populated based on the selection. The user can change the values displayed in the text fields. So before setting the new values in the text fields the last displayed values need to be saved.
I have an ActionListener for my combo which gives me the currently selected value by calling getSelecetdItem()
How can i get the last selcted value of the combobox without using any variable of my own.To update the last displayed details(the address details say) i need to check what type of address the combo had previousely.....
when i display the panel first time the home address is set by default and i have a variable to hold this value..as the user changes the selection i update the variable...I don't want to use this variable..instead if i can get the last selcted value from the event that would be great...
thanks -
Unable to capture the parameter values from a PL/SQL procedure
hi.
i'm trying to capture the parameter values of a PL/SQL procedure by calling inside a anonymous block but i'm getting a "reference to uninitialized collection error" ORA-06531.
Please help me regarding.
i'm using following block for calling the procedure.
declare
err_cd varchar2(1000);
err_txt VARCHAR2(5000);
no_of_recs number;
out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
cntr_var number:=0;
begin
rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
dbms_output.put_line('The error is ' ||err_cd);
dbms_output.put_line('The error is ' ||err_txt);
dbms_output.put_line('The cntr is ' ||cntr_var);
for incr in 1 .. OUT_SIGN_TAB.count
loop
cntr_var := cntr_var + 1 ;
Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN_TAB(incr).txn_type||','||OUT_SIGN_TAB(incr).objid);
end loop;
end;
Error is thrown on "for incr in 1 .. OUT_SIGN_TAB.count" this line
Following is some related information.
the 3rd parameter of the procedure is a out parameter. it is a type of a PL/SQL table (SEARCH_SIGN_TAB_TYPE) which is available in database as follows.
TYPE "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
TYPE "SEARCH_SIGN_TYPE" AS OBJECT
(ref_no VARCHAR2(22),
ciref_no VARCHAR2(352),
ac_no VARCHAR2(22),
txn_type VARCHAR2(301),
objid VARCHAR2(1024))............We don't have your rt843pq procedure, but when commenting that line out, everything works:
SQL> create TYPE "SEARCH_SIGN_TYPE" AS OBJECT
2 (ref_no VARCHAR2(22),
3 ciref_no VARCHAR2(352),
4 ac_no VARCHAR2(22),
5 txn_type VARCHAR2(301),
6 objid VARCHAR2(1024))
7 /
Type is aangemaakt.
SQL> create type "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
2 /
Type is aangemaakt.
SQL> declare
2 err_cd varchar2(1000);
3 err_txt VARCHAR2(5000);
4 no_of_recs number;
5 out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
6 cntr_var number:=0;
7 begin
8 -- rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
9 dbms_output.put_line('The error is ' ||err_cd);
10 dbms_output.put_line('The error is ' ||err_txt);
11 dbms_output.put_line('The cntr is ' ||cntr_var);
12 for incr in 1 .. OUT_SIGN_TAB.count
13 loop
14 cntr_var := cntr_var + 1 ;
15 Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN
TAB(incr).txntype||','||OUT_SIGN_TAB(incr).objid);
16 end loop;
17 end;
18 /
The error is
The error is
The cntr is 0
PL/SQL-procedure is geslaagd.Regards,
Rob. -
The below mentioned code works sometimes and doesn't most of the time. What is the real best way to update multi select managed metadata fields?
Microsoft.SharePoint.Client.File file = site.GetFileByServerRelativeUrl("/sites/myspsite/Documents/Presentation2.pptx");
clientContext.Load(file);
clientContext.ExecuteQuery();
ListItem currentItem = file.ListItemAllFields;
clientContext.Load(currentItem);
clientContext.ExecuteQuery();
currentItem["Country"] = "-1;#India|1d13cfe9-d6f4-4bd3-a6c7-4b46a81f2a96;#-1;#China|9c1dff73-82db-44b1-8d70-f4258dd24e47;#-1;#USA|b9295c0b-67d4-4dc5-99d4-e88af888de48";
currentItem["Title"] = "Demo Doc";
currentItem.Update();
clientContext.ExecuteQuery();
file.CheckIn("test check-in", CheckinType.MajorCheckIn);
clientContext.ExecuteQuery();
Anuradha!!Hi,
Here are two blog for your reference:
How to Work with Managed Metadata Columns by Using the SharePoint Client Object Model
http://blogs.msdn.com/b/sharepointdev/archive/2011/11/18/how-to-work-with-managed-metadata-columns-by-using-the-sharepoint-client-object-model-kaushalendra-kumar.aspx
SharePoint 2010 Code Tips – Setting a Managed Metadata Field with the Client Object Model
http://sharepointfieldnotes.blogspot.com/2011/08/sharepoint-2010-code-tips-setting.html
Best Regards
Dennis Guo
TechNet Community Support -
How to create multiple rows in a child table from the multi select Lov
Hi
We have Departments and EmployDept and Persons tables and each employee can associate multiple departments and vice versa.While creating a Department page there should be a Multi Select LOV(values from Persons table) with search option for the Persons.From the search panel we can select multiple persons for that department.Suppose we have selected 5 persons and click on submit, then it should create 5 rows in the EmployDept table for 5 persons with that department id.
Any inputs on how to implement this scenario please..Maybe you can get some ideas from here -
http://adfdeveloper.blogspot.com/2011/07/simple-implementation-of-af.html -
Populate text field based on the lov selected value
Hi,
based on the value selected in lov, i want to populate another text field. Below is the code I have written
In PFR:
if(pageContext.isLovEvent())
String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM);
if ("lovCategory".equals(lovInputSourceId))
java.util.Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId);
if(lovResults!=null)
String value =(String)lovResults.get("lovCategory");
amobj.categorycode(value);
AMImpl code:
public void categorycode(String code) {
sundryCodeVOImpl vobj = getsundryCodeVO1();
vobj.setWhereClause( "lookup_code = "+"'"+code+"'");
vobj.reset();
vobj.executeQuery();
String desc = vobj.first().getAttribute("Description").toString();
String attr = vobj.first().getAttribute("Attribute1").toString();
testEOViewImpl vobj1 = gettestEOView1();
vobj1.getCurrentRow().setAttribute("CodeDescription",desc);
vobj1.getCurrentRow().setAttribute("PurchasingCategoryCd",attr);
vobj1.executeQuery();
With this code, the updated values for the attributes CodeDescription, PurchasingCategoryCd are getting inserted into the database table but they are now showing up in the text fields when a value is selected in lov.
Please tell me what is the mistake I'm doing.
Thanks
SunnyI'm using Lov Map to populate the lov field say field A. But I need to populate another field say field B based on the value selected in field A.
to give an example of my requirement. Consider a view object having attributes col1,col2,col3 and having following data.
col1--col2--col3
1-----a-------x
2-----b------y
3-----c------z
I 'll populate the lov of field A with values in col1. when user selects value 1 in field A. automatically field B should show value 'a'. If user selects value 2 in field A, field B should show value 'b' so on.
Thanks
Sunny -
Multi-select prompt for BI Publisher SQL report in Dashboard?
Is there any way to populate a presentation variable from a multi-select dashboard prompt?
I have a BIP report using a SQL data source, and it will be presented on an OBIEE dashboard. Since the only apparent method for prompting a SQL BIP report from a dashboard prompt is to use presentation variables, and it appears that you can only set presentation variables using non-multi-select controls, it looks like there's no way to do this.
Any ideas?Thanks for the response Fabiano.
I tried using BI Answers to feed this report but it ended up being too cumbersome because of the number of queries and the awkward XML data names generated on calculated fields. Those were the main reasons for SQL data sources. I was able to cut the report from 10 queries down to 2, and assign meaningful XML data names. The report runs much faster and works very well. I am using bind variables, but the only way to populate them (apparently) is to use presentation varibles, which are not populated on a multi-select prompt. -
Obtaining the last n values - possible to do non-procedurally?
I'm not sure if the following is possible without using PL/SQL instead garden variety SQL.
I'm looking for the last 4 or less (or some other arbitrary number) of LABVALUES for a PERSON. This is regardless of the time period in which they occur. Eventually I might AVERAGE these or do some other summary operation. The LABDATE might be a standard Oracle date, or might be a number (number of microseconds from 1/1/1960); however, these date forms would NOT be mixed in the same query.
The base query is:
SELECT DISTINCT
PERSON.NAME,
LAB.VALUE,
LAB.DATE
FROM
PERSON,
LAB
WHERE
PERSON.ID = LAB.ID
Does this have to be done procedurally or can it just be done as a SELECT statement
Thanks,
WillEric, Everything looks good assuming that we can go by Person.Id for order by clause, just couple of things,
1. William's spec does not have Person_Id column.
2. William also says he needs last 'n' rows for each Person, however he did not mention whether he passes 'Name' of the Person as a parameter. Following are couple of SQLs, one with Person Name as parameter and another one with out the parameter which brings all the persons with 'n' number of rows for each person.
/* Please note that I have not used analytical fn here, only because we can get away with out having to use it. Just an alternative ONLY. */
SELECT Name, Value, Date
FROM
(Select P.Id
, P.Name
, L.Value
, L.Date
From PERSON P, LAB L
Where P.Id = L.Id
Group By P.Id, P.Name, L.Value, L.Date
Order By P.Id Desc)
WHERE Name = :PersonName -- use Name of Person here as parameter
AND ROWNUM <= :n; -- number of rows required for the given Person
/* Please note that I have not used the group by here as PARTITION
does that for us*/
SELECT Name, Value, Date
FROM
(Select P.Name
, L.Value
, L.Date
, row_number() over(PARTITION BY P.Name ORDER BY L.Id desc) Rn
From PERSON P, LAB L
Where P.Id = L.Id)
WHERE Rn <= :n; -- number of rows for each personThx,
SriDHAR -
IN values in a PL/SQL procedure
Hi Experts,
Please can someone help me with this procedure ? I am trying to write this procedure that I can use to grant privileges dynamically to roles based on the argument.
I am getting the errors while creating it as it fails to assign the values in the CASE statement based on the IN arguments.
CREATE OR REPLACE PROCEDURE GENERATE_GRANTS (OWNNAME IN VARCHAR2, ROLENAME IN VARCHAR2, OP_TYPE VARCHAR2)
AS
SQL_STATEMENT VARCHAR2 (200);
err_code number(10);
err_msg VARCHAR2(200);
OBJTYPES VARCHAR2(200);
BEGIN
CASE OP_TYPE
WHEN 'READ' THEN OBJTYPES := ( 'TABLE', 'VIEW');
WHEN 'READWRITE' THEN OBJTYPES := ( 'TABLE', 'VIEW', 'SEQUENCE', 'PROCEDURE', 'PACKAGE','FUNCTION' );
END CASE;
FOR ITEM IN (SELECT (
decode(
object_type,
'TABLE','GRANT SELECT, INSERT, UPDATE, DELETE ON '|| OWNNAME ||'.',
'VIEW','GRANT SELECT ON '|| OWNNAME ||'.',
'SEQUENCE','GRANT SELECT ON '|| OWNNAME ||'.',
'PROCEDURE','GRANT EXECUTE ON '|| OWNNAME ||'.',
'PACKAGE','GRANT EXECUTE ON '|| OWNNAME ||'.',
'FUNCTION','GRANT EXECUTE ON'|| OWNNAME ||'.' )||object_name||' TO '||ROLENAME
) as GRANT_SQL
FROM dba_objects
WHERE OWNER = OWNNAME
AND OBJECT_TYPE IN OBJTYPES
ORDER BY OBJECT_TYPE)
LOOP
SQL_STATEMENT := ITEM.GRANT_SQL;
BEGIN
EXECUTE IMMEDIATE SQL_STATEMENT;
EXCEPTION
WHEN OTHERS
THEN -- handles all other errors
err_code := SQLCODE;
err_msg := substr(SQLERRM, 1, 200);
DBMS_OUTPUT.PUT_LINE (SQL_STATEMENT);
DBMS_OUTPUT.PUT_LINE (err_code || ' ' || err_msg);
END;
END LOOP;
END;
/a) Your CASE statement has wrong syntax.
b) In order to use OBJECTTYPES the way you wanted would require dynamic SQL.
Use this instead:
CREATE OR REPLACE
PROCEDURE GENERATE_GRANTS(
OWNNAME IN VARCHAR2,
ROLENAME IN VARCHAR2,
OP_TYPE VARCHAR2
AS
BEGIN
FOR ITEM IN (
SELECT decode(
object_type,
'TABLE','GRANT SELECT, INSERT, UPDATE, DELETE ON '|| OWNNAME ||'.',
'VIEW','GRANT SELECT ON '|| OWNNAME ||'.',
'SEQUENCE','GRANT SELECT ON '|| OWNNAME ||'.',
'PROCEDURE','GRANT EXECUTE ON '|| OWNNAME ||'.',
'PACKAGE','GRANT EXECUTE ON '|| OWNNAME ||'.',
'FUNCTION','GRANT EXECUTE ON'|| OWNNAME ||'.'
) || object_name || ' TO '||ROLENAME AS GRANT_SQL
FROM dba_objects
WHERE OWNER = OWNNAME
AND 1 = CASE
WHEN OP_TYPE = 'READ' AND OBJECT_TYPE IN ('TABLE','VIEW') THEN 1
WHEN OP_TYPE = 'READWRITE' AND OBJECT_TYPE IN ('TABLE','VIEW','SEQUENCE','PROCEDURE','PACKAGE','FUNCTION') THEN 1
END
ORDER BY OBJECT_TYPE
LOOP
BEGIN
EXECUTE IMMEDIATE ITEM.GRANT_SQL;
EXCEPTION
WHEN OTHERS
THEN -- handles all other errors
DBMS_OUTPUT.PUT_LINE (ITEM.GRANT_SQL);
DBMS_OUTPUT.PUT_LINE (SQLCODE || ' ' || substr(SQLERRM, 1, 200));
END;
END LOOP;
END;
/SY. -
How to accept user values into a pl/sql procedure or function on every execution
As we accept user values on every execution in a C or a java program, is it possible to do so with a pl/sql procedure or a funtion without using parameters?
I cannot use parameters because it is required to be interactive while accepting the user-values like,
Please enter your date of birth in 'dd/mm/yyyy' format:It depends from where you are calling your PLSQL routine. If it is SQL*Plus then you can use & (ampersand) with the variable to be input at run time.
If you are executing the PLSQL routine from another application (some front end application) then it's not possible. Because when a procedure is executing at server side, the front end application does not have control, and the control is only transfered back to front end application when the PLSQL routine either completes successfully or throws an exception.
In either case, you can not go back to the PLSQL routine.
In this case, what you can do is, write code in your front end application to get that variable value from user and then pass that value to PLSQL routine. -
Getting the corresponding selected value in the textbox
hi..
i had a problem ,i had a jsp page ,with a selectbox and a textbox,the select box is getting the list of formnames from the database,and each form name has a corresponding code in the same table named form
here thru mi program i m getting but i am connecting to the dtabase twice,is there any way to get the same...here is my code...
<%@ page language="java" import="java.sql.*,java.util.*"%>
<%
Connection con=null;
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:satya");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select form_code,form_name from form");
//System.out.println("Hashtable"+h.toString());
%>
<script language="JavaScript">
function url()
document.myform.action="http://localhost:8080/dynamic/servlet/Servlet1";
document.myform.submit();
function fn(code1){
var code;
var code2=code1.value+"code";
//alert(code2);
var str="document.myform."+code2+".value";
code=eval(str);
document.myform.forcode.value=code;
</script>
<form name="myform" method="post">
<select name="selform" onChange="fn(this)">
<% while(rs.next()){
String name=rs.getString(2);
String code=rs.getString(1);
%>
<option value="<%=name%>"><%=name%></option>
<%}%>
</select>
<% rs.close();
rs=st.executeQuery("select form_code,form_name from form");
while(rs.next()){
String name=rs.getString(2);
String code=rs.getString(1);
%>
<input type="hidden" name="<%=name%>code" value="<%=code%>">
<%}%>
<input type="text" name="forcode">
<%
rs.close();
catch(Exception e){
System.out.println(e);
%>
<br><br>
<input type="submit" name="Submit" value="create" onClick="url()">
</form>
</body>
</html>
can any one help me...........
Thanks in advanceI think you are submiting the Form Twice
The first time when you Click the Submit Button, the second time in the url function
you have to remove the OnClikc event from this Line
<input type="submit" name="Submit" value="create" onClick="url()"> -
How to clear the table contents for the new selection values?
Hi,
Im developing some very basic web dynpro applications.I have created one application to demonstrate use of SERVICE CALL.Now in one of the COntext Nodes,I have one attributes as TABLE.I have 2 input fields and when i enter any sel critteria in these 2 fields,the table is populated accordingly.Now when i change the value in the input fields,the new output gets appended in the output TABLE.How do I clear the contents of the OUTPUT table attribute in the method?
Can someone tell me the common methods used with context nodes like REFRESHING,CLEARING etc?How do I know which methods to call for what action of the nodes ...like for binding internal table to any context node we use the method BIND_TABLE...
Any inputs will be highly appreciated.
Thanks!
BR,
SRM tech.Hi,
To clear the contents of the node, use invalidate method.
data: l_node type ref to if_wd_context_node.
l_node = wd_context->get_child_node( 'NODENAME' ).
l_node->invalidate( ). " all the data in the node will be cleared
To clear a single attribute you can use set_attribute_null.
Regards,
Radhika.
Maybe you are looking for
-
Problem in configuration of material master
Dear cons I want to make quality management control key field is a required field in material master. so in T-code- OMSR I selected field selection group-99.& make it as a required field.At the time of creating material master the system activated
-
Exchange Rate amount is not calculating correctly in iProcurement
Hi All, The exchange rate is mismatching when i create a requisition in the iProcurement (11.5.10.2 version).Please find the below test case and suggest me accrodingly. Example: on 06-May-09 and 07-May-09 i have create a requisition in the iProcureme
-
Regarding XK02 transaction in SAP ECC 6.0 Version
Hi All, I am working with an object which calls a transaction <b>XK02</b> to modify the name and contact details fields in Version <b>SAP ECC 6.0</b>. The problem is that, when the transaction is run manually and saved or when an SHDB Recording is c
-
Hi, Any one can plz send the process chain errors in BI.I am in support so plz give some process chain errors. sekhar. Bye.
-
I cannot drag or copy and paste files. 10.5.8
Yesterday my MacBook Pro was working fine. Today I cannot drag files or cut and paste. I have rebooted and repaired permissions. Nothing! i did trash some files late last night, but thought they were jpegs and quictimes. Any fresh help?