Edit Procedure with selected values

Hi,
I have an edit form where i drugged my view as an adf form.
I created in my Application Module a method called "save()" which what i do is just commit:
try {
getDBTransaction().commit();
} catch (JboException ex) {
getDBTransaction().rollback();
throw ex;
On my form i have some radio buttons. One of them is called LandType, with two options (OptionA and OptionB).
Please note that this is an edit operation so there is a preselected value when i edit a record.
I created some entity level validation which is conditional based on the selection of the above radio button. For example i have 2 input boxes, "InputA" and "InputB". If the user selects "OptionA" the "InputA" is required. If the user selectd "OptionB" then "InputB" is required.
For the create operation everything runs smoothly.
For the edit operation i face this problem.
I have a record with "OptionA" selected and "InputA" with some value ("InputB" is empty)
When i change to "OptionB", i render the "InputB" text box and i get my error message for an empty field("InputB"). If i press again save (calls my commit method in my AppModule) then the radio button from "OptionB" goes back to "OptionA" and if i click again save, it saves the changes!!!
How can i overcome this? I want the new value selected to remain.
Thanks
Antonis

Some glitch in my blogging software currently prevents me from posting it on my blog, but I've uploaded a 10.1.3.3-based example workspace here:
http://otn.oracle.com/products/jdev/tips/muench/condreq/OptionalRequiredFields.zip
This is the example blurb that will eventually appear as example #124 on my blog when I am again able to upload to it.
This example illustrates how to validate and render
conditionally-required attributes. After running the included
CreateTables.sql script to create the
OPTIONAL_REQUIRED_TEST table, run the TestPage.jspx to
see that when a row has its RowType attribute set to the value
A then the ValueA inputText component renders, while if
its RowType attribute is instead set to the value B then
the ValueB inputText field renders. These fields set the
showRequired property to true to show the required field
indicator to the end-user even though the underlying ValueA and
ValueB attribute are not marked as mandatory. The conditional
mandatory validation is performed in the TestEntity entity
object using entity-level method validators. The radio group UI
component is marked to have its autoSubmit property true, and
the ValueChangeListener method in the backing bean for the page
sets a request-scope attribute as a flag to indicate that the row type
is changing. This flag is then referenced by the
ConditionalValidationPageController -- identical in function to
the one you might have seen in Example# 62 "Cascading Lists in JSF" --
which is configured to be used by the TestPage by setting the
ControllerClass property of its page definition. This
customized page controller avoids validating the row if it detects
that the row type is changing. The conditional rendering of the ValueA
or ValueB inputText components is handled declaratively using an
appropriate EL expression for the component's rendered
property. When the autoSubmit radio group (with component id
"RowTypeRadio") causes its partial-page request, the panelForm
component in which the ValueA and ValueB inputText's reside is
declaratively "repainted" by having its partialTriggers
attribute set to that "RowTypeRadio" id value. By performing the
partial-page triggering on the enclosing panelForm component, you
avoid the gotchas related to having PPR events delivered to
currently-unrendered components.

Similar Messages

  • How to change stored procedure with Table Valued Parameter

    I am not sure how to change the normal stored procedure with Table Value Parameter.Do I have to create a separate Table or do I have to create a datatype. Can you please help me with this
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF]
    @dp_id char(32),
    @dv_id char(32),
    @em_number char(12),
    @email varchar(50),
    @emergency_relation char(32),
    @option1 char(16),
    @status char(20),
    @em_id char(35),
    @em_title varchar(64),
    @date_hired datetime
    AS
    BEGIN
    SET NOCOUNT ON;
    MERGE [dbo].[em] AS [Targ]
    USING (VALUES (@dp_id, @dv_id , @em_number, @email, @emergency_relation, @option1, @status, @em_id, @em_title, @date_hired))
    AS [Sourc] (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired)
    ON [Targ].em_id = [Sourc].em_id
    WHEN MATCHED THEN
    UPDATE
    SET dp_id = [Sourc].dp_id,
    dv_id = [Sourc].dv_id,
    em_number = [Sourc].em_number,
    email = [Sourc].email,
    emergency_relation = [Sourc].emergency_relation,
    option1 = [Sourc].option1,
    status = [Sourc].status,
    em_title = [Sourc].em_title,
    date_hired = [Sourc].date_hired
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title,date_hired)
    VALUES ([Sourc].dp_id, [Sourc].dv_id, [Sourc].em_number, [Sourc].email, [Sourc].emergency_relation, [Sourc].option1, [Sourc].status, [Sourc].em_id, [Sourc].em_title, [Sourc].date_hired);
    END;

    It's not clear how you would change the procedure. But assuming that you want to replace the existing scalar parameters with tabular input, this is how you would do it. You first create a table type:
    CREATE TYPE  Insertor_type AS TABLE
        (dp_id                char(32),
         dv_id                char(32),
        em_number            char(12),
        email                varchar(50),
        emergency_relation   char(32),
        option1              char(16),
        status               char(20),
        em_id                char(35),
        em_title             varchar(64),
        date_hired           datetime)
    Then you change the procedure header:
    ALTER PROCEDURE [dbo].[uspInsertorUpdateINF] @tvp Insertor_type READONLY AS
    And finally you change the USING clause:
       USING (SELECT dp_id, dv_id , em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired
              FROM   @tvp) AS [Sourc] ON [Targ].em_id = [Sourc].em_id
    The rest is fine as it is.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Stored procedure with select query

    Hi,
    I have a problem , We have a sysnchronous scenario and executing a stored procedure and a selcect statement .
    it is running fine with little confilt in data is there.
    We we run the scenario it execute the strored procedure and return the value like 500 and under select statement it select entire table which has same flag.
    I want to execute stored procdure and in slect statement one row at a time and then again it will insert to other table in then database.
    currently we are getting value like this.
      <?xml version="1.0" encoding="utf-8" ?>
    - <ns0:MT_SP_JDBC_response xmlns:ns0="http://ns_cfgCountry">
    - <GetNextSiteNumber_response>
      <Result>10000000000400</Result>
      </GetNextSiteNumber_response>
    - <Statement2_response>
    - <row>
      <ID>IN</ID>
      <Description>INDIA</Description>
      <GDate />
      <FLAG>FALSE</FLAG>
      </row>
    - <row>
      <ID>EN</ID>
      <Description>ENGLAND</Description>
      <GDate />
      <FLAG>FALSE</FLAG>
      </row>
    - <row>
      <ID>ZA</ID>
      <Description>SA</Description>
      <GDate />
      <FLAG>FALSE</FLAG>
      </row>
      </Statement2_response>
      </ns0:MT_SP_JDBC_response>
    Regards
    Laxmi Bhushan Jha

    Hi,
    Can u please write your req little clear....
    If you want to selcect and update a table and again select ... what ever it may be.... all these has to be done in the stored procedure only.
    At the end of all ur statements u pass back the value from your Stored Procedure
    Babu

  • Procedure with select from mysql db link problem

    Hi,
    first of all Oracle is new to me so if there are better ways to do this every suggestion would help.
    My problem is simple i cant use select from dblink inside a procedure.
    In Oralce SQL Developer 1.5.5:
    Im using oracle 11g and mysql 5.5.13 with mysql odbc 5.1
    in both db the user is root
    CREATE PUBLIC DATABASE LINK "MYSQL"
    CONNECT TO "root" IDENTIFIED BY "****"
    AUTHENTICATED BY "root" IDENTIFIED BY "****"
    USING 'mysql';
    select * from t1@mysql;
    run; -> result OK
    select "MAXID" from t1@mysql where "TNAME"='first';
    run; -> result OK
    create or replace
    PROCEDURE T1_IDS_PROC AS
    maxi number;
    BEGIN
    select "MAXID" into maxi from t1@mysql where "TNAME"='first';
    END T1_IDS_PROC;
    compile -> not working:
    Fehler(7,3): PL/SQL: SQL Statement ignored
    Fehler(7,47): PL/SQL: ORA-00904: "TNAME": unknown identifier
    How to solve this?

    Thanks for replay,
    yes the owner of the procedure can acces the remote table.
    I can use
    select count(*) into i from t1@mysql
    inside the procedure, but if i use specific columns inside the select i cant compile.
    Why i need double quote?
    I dont know if i need them but i read some tutorial for dblink to mysql and there was explanied
    Oracle use upercase names and Mysql is case sensitive for odbc 5.1 so i have to double qoute mysql names.
    But with or without double qoute it dont work inside procedures ;(

  • Issues with selecting value from XMLType column

    I want to retrieve values from my XMLType column. Can anyone tell me why this works
    select XMLCAST
                XMLQUERY
                   'declare default element namespace  "urn:hl7-org:v3"; (: :)
                    declare namespace voc = "urn:hl7-org:v3/voc"; (: :)
                    $doc/ClinicalDocument/recordTarget/patientRole/patient/name/family'
                    passing CCD_DOC as "doc"
                    returning content
                as VARCHAR2(4000)
         from CCDbut this doesn't?
    select
        ccdid,
        extractvalue(CCD_DOC,'/recordTarget/patientRole/patient/name/given') "given",
        extractvalue(CCD_DOC,'/recordTarget/patientRole/patient/name/family') "family",
        extractvalue(CCD_DOC,'/recordTarget/patientRole/providerOranization/name') "name",
        extractvalue(CCD_DOC, 'title') as Title
    from CCDwhere ClinicalDocument is the root element?
    I don't get any errors from the second one but the three XML-derived columns are null. The values are not retrieved while the values ARE retrieved using the first method.
    Thanks!

    XMLTable..
    select x.*
      from CCD,
           XMLTable
             xmlNamespaces
               default 'urn:hl7-org:v3',
               'urn:hl7-org:v3/voc' as "voc"
             '$doc/ClinicalDocument/recordTarget/patientRole'
             passing CCD_DOD as "doc"
             columns
             given varchar2(128) path 'patient/name/given',
             family varchar2(128) path 'patient/name/family',
             name varchar2(128) path 'providerOranization/name'
           ) x

  • Fields with selection Value

    Hi
    I have used 4 fields in following manner.
    1)Country
    2) Region
    3)City
    4) Postal Code
    When I am selecting country , then Region Fields only shows that value ,which belongs to selcted country. And same for City and Postal Code.

    One nice way to do this is to use Hierarchies.  You can define a hierarchy by country in the data manager, and then using the Java API you can build an iView that performs the functionality that you are referring to, such that when you select the country, then only options available for regions are the ones that pertain to that particular hierarchy node.

  • Stored procedure with select return multiple rows

    hi,
    in transact the stored procedure is . .
    CREATE PROCEDURE MIPROCEDIMIENTO @CODE INT AS
    BEGIN
    SELECT COD, NAME, LASTNAME FROM EMPLOYE WHER COD = @CODE;
    END
    in oracle how?
    please, i speak spanish. .
    thanks

    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10767/procedures_plsql.htm#TDPNG60035
    Sybrand Bakker
    Senior Oracle DBA

  • Entity Framework - Execute Stored Procedures With Table Valued Patameter

    How to pass a table valued parameter to a stored procedure in Entity Framework using ExecuteSqlCommand or SqlQuery method?
    Following is my code - 
    DataTable dataTable=new DataTable();
    dataTable.Columns.Add("col1", typeof(int));
    dataTable.Columns.Add("col2", typeof(bool));
    dbContext.Database.ExecuteSqlCommand("exec stored_proc @tvp",
                            new SqlParameter() { SqlDbType = SqlDbType.Structured, ParameterName = "@tvp", Value = dataTable }
    This throws an exception saying 'The table type parameter '@tvp' must have a valid type name.'

    You must set the TypeName property of the SqlParameter to the name of your table type that you have defined in the database:
    SqlParameter param = new SqlParameter();
    param.SqlDbType = SqlDbType.Structured;
    param.ParameterName = "@tvp";
    param.TypeName = "dbo.YourTableType";
    param.Value = dataTable;
    dbContext.Database.ExecuteSqlCommand("exec stored_proc @tvp", param);
    Of course you must define the table type in the database first:
    CREATE TYPE dbo.YourTableType AS TABLE
    ( col1 int, col1 bit )
    Please remember to the following page on MSDN for more information:
    https://msdn.microsoft.com/en-us/library/bb675163(v=vs.110).aspx
    Hope that helps.
    Please also remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

  • Variants with selection values

    Hi All,
    Need to have a variant for a planning folder which is restricted to a particular value for one of the folder variables.
    Say cost center is the header variable and i need to assign a variant to the user which opens with value of cost cneter as "120111"
    But for some other user variant value changes.
    Can this be done?
    I tried using "maintain set variables" value in table TVARVC and using the parameter in the variant at start of planning folder. But it doesnt work.
    Any suggestions would be appreciated.
    Thanks,
    Vidya.

    Hi All,
    Thanks for your inputs. But our layouts are going to be used by many users and also there will be some users who would require to see all cost centers.
    So we need some variants for the folder which can hold a particular value of cost center.And this would be assigned to the user role.
    Something of the sort BW variant in queries are used.
    Hope the requirement is clear.
    Thanks,
    Vidya.

  • 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

  • How to get all parameter names along with their values in stored procedure which is being executed

    Im using sql server 2012, is there any possible way to get all the parameters of a stored procedure along with the values passed to it.
    I need these things to build a xml. I mean this should happen in the procedure which being executed and it should be common for all the procedures.
    For example, let us suppose we have to procedures,
    uspSave, @name='test' @age=20
    uspDelete @id=2
    now in uspSave procedure, i need to get @name, @age and the values 'test', 20 and in uspDelete, i should get @id with value 2.
    For getting the column names, i tried this,
    select parameter_name from information_schema.PARAMETERS where specific_name=OBJECT_NAME(@@procid)
    now is it possible to loop through the result of above query and can we get the values.

    I think  you need running SQL Server Profiler to capture this info even in SQL Server 2012.
    Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
    Blog : MS SQL Development and Optimization
    Blog : Large
    scale of database and cleansing

  • Copy select value in the textfield from LOV and allow user to edit it

    Hi,
    I have a datablock with 20 records and each record has comments (say field_comments) fields. I would like to allow user to choose predefined comments populated from LOV (say lov_comments) and to append some extra comments after they choose the value from LOV.
    I have created a LOV and added Return type “field_comments” in the column mapping properties. When user clicks on a button, LOV opens up. They select the value from the LOV and the value goes to “field_comment” field. The problem with this approach, user can’t add their comment after selecting from LOV.
    I tried this way too. I created another non-visible textbox (say dummy). In the LOV, I added “dummy” field as returntype. In the dummy field, I have created “POST-CHANGE” trigger which basically says :block. field_comments = :block. Dummy.
    But, the user has to click on other field to view the selected value from the LOV. The values in the “field_comments” is not updated as soon as user click on “OK” button in the LOV.
    I would appreciate it if somebody could give me some input and help to solve my issue. Thank you for your help.
    Thank.

    Well, I tried exactly what you posted and it allowed me to SELECT from LOV and then CHANGE/APPEND new text in front of returned value in the field. It saved to the database and queried without any problems.
    Is your item allowed to INSERT/UPDATE ? If not, then set "Update/Insert Allowed" properties to Yes and attach your LOV to the item and set "Validate from list" to No.
    You may also see if you have any validation being performed on WHEN-VALIDATE-ITEM or POST-CHANGE trigger which will fail since you are editing the values populated from LOV.
    Hope it helps!

  • Submit program with selection screen parameters - getting blank values

    Hi, I'm submitting a program with selection screen parameters. when I pass '000' (I_TPLSCN  )value for Planning Scenario and when this goes to selection screen then I don't see value for Planning scenario as '000'(I_TPLSCN  ) but the value is blank in selection screen. I'm using the below code for this.
    SUBMIT RMCPAMRP WITH MATNR_GL EQ I_MATNR   SIGN 'I'
                      WITH WERKS_GL EQ I_WERKS   SIGN 'I'
                      WITH PLSCN    EQ I_TPLSCN  SIGN 'I'
        via selection-screen        AND RETURN.
    Could anyone please help me how to display value '000' rather than blanks.
    thanks in advance.

    If I_MATNR, I_TPLSCN and I_WERKS are variable then try with
    SUBMIT rmcpamrp
      WITH matnr_gl = i_matnr
      WITH plscn    = i_tplscn
      WITH werks_gl = i_werks
      via selection-screen       
       AND RETURN .
    If I_MATNR, I_TPLSCN and I_WERKS are of type range then try  with
    SUBMIT rmcpamrp
      WITH matnr_gl IN i_matnr
      WITH plscn    IN i_tplscn
      WITH werks_gl IN i_werks
    via selection-screen       
       AND RETURN
    Edited by: Pawan Kesari on Dec 24, 2009 3:33 PM

  • It is possible select a member "field" editable/moveable with mouse?

    I have diferent editable "field" on the stage.
    If the "field" are only "editable" I can select every field with the mouse and write inside of it, but if I make them "editable/moveable" I can't select with the mouse any field but I can pass from one to other only with the key "TAB".
    Do you know if there is a way to select every "Member field" that I want with mouse and without "Tab" when every field is set to editable/moveable?
    Thank.

    Still not sure about your intention, but maybe:
    SQL> create or replace type test_obj as object
                      (s_name varchar2 (30),
                       member function test
                          return varchar2)
    Type created.
    SQL> create or replace type body test_obj
    as
       member function test
          return varchar2
       is
          loc_name       varchar2 (30);
          t_obj test_obj;
       begin
          execute immediate 'select test_obj(''' ||s_name||''') from dual'  into t_obj;        -- is it somehow possible to use s_name here - without using clause
          return t_obj.s_name;
       end;
    end;
    Type body created.
    SQL> declare
       o_test         test_obj := test_obj ('testText');
    begin
       dbms_output.put_line ('s_name: ' || o_test.test);
    end;
    s_name: testText
    PL/SQL procedure successfully completed.

  • SSRS Report with mutli select values in parameters

    Hi All,
    I am creating a SSRS report and displaying the result in tablix. I want to make the report to filter by multi select values from the parameters.
    I have 3 parameters. For all the three parameters, I have set "Default  Values" and "Available Values". Also, modified my result dataset to get the values from parameters using "WHERE ID = @Parameter1" (example) and so
    on..
    3 Parameters types:   1. Yes or No       
    2. Date          3. Values with NULL in the DB
    Problems:
    1. When I am passing the default values "Yes" "No" - it is throwing errors because default values is passed as Yes "AND" No instead of "OR" condition. The value stored in the DB wil have either Yes or No but not both.
    2. When I am querying the date values, it is a DateTime field in the DB. But I have queried like SELECT CONVERT(DATE, EXE_DATE) AS DATE FROM table which is giving only date in SQL but in SSRS displaying date with time.
    3. When I pull the list of values for third Parameter from SQL, it has some NULL values. When I try to use it in SSRS, it is not displaying the NULL value as select option in the list of values
    Any suggestions for the above three problems for SSRS with multi select values as filter will be helpful.
    Maruthu | My Blog

    Hi Maruthi,
    Regarding the three things:
    1.) I believe your first parameter is mutliselect , please convert it to single select.
    Steps: 
    a.) Select the parameter, right click and go to parameter properties
                    b.) Under General Tab in DataType section remove the checkbox for Allow Multiple Value.
    2.) Instead of returning as the date please return string. For example : 
    SELECT CONVERT(VARCHAR, GETDATE(),101)
    Here is the list of conversion : http://www.sqlusa.com/bestpractices/datetimeconversion/
    3.) As such there is no concept of null in SSRS. (Its a relational concept) . We do have nothing , which means empty. In Order to use null please select the Allow null option in the DataType section of the Parameter, This will add an checkbox for null in
    the report preview. Its developer job to handle the null values in there query.
    Regards Harsh

Maybe you are looking for