Inserting a Value into otherTable using an App. Proc. from a Date Picker

I'm trying to call an Application Process that will insert an Attribute of a Row, into another table, after selecting a date from a Date Picker cell.
I don't know why this shouldn't be possible. I think I've got all of my "Ducks in a Row", so to speak,
but the Value that is being inserted into the other table is this:.. [object HTMLTableCellElement]
(Ultimately, I'd like my Application Process to include Page element values with the insert as well, but I'm trying to handle one problem at a time)
Here's a list of all the steps I've covered:
1. I've Created an Application Process, (popDevices). The Process Point is "On-Demand". The Type is "PL/SQL Anonymous Block".
The Process is defined as such:
BEGIN
Insert into P_DEVICES
NAME,
IP_ADDRESS,
MODEL
) values
'Unassigned',
'Unassigned',
:P153_MODEL
COMMIT;
END;
2. I've Included the Javascript in the Page HTML Header.
The Javascript is written as such: (minus the tags)
function popDevices(PART_NO)
var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=popDevices',0);
get.add('P153_MODEL',PART_NO);
gReturn = get.get();
get = null;
3. I've included the following in the "Element Attributes" field of the Date-Picker Item (Date_Delivered).
The Region Type is "SQL Query (Updatable Report)"
onChange="javascript:popDevices(PART_NO);"
THE RESULTS
A. A row does get inserted into the other (P_Devices) table,
But the value of the Attribute from the Page Region is not valid.
The Inserted value is this: [object HTMLTableCellElement]
B. I have tried Every conceivable combination of characters in the "Element Attributes" field, such as:
...(PART_NO), (#PART_NO#), (||PART_NO||), (+PART_NO+)
C. The Javascript in the Page HTML Header appears to be correct, since I have written it this same way for other applications without any problems.
D. If this simply cannot be done by referencing the "onChange" Javascript from the "Element Attributes" field,
Then can you help me to write the code into the Select statement of the region.
Thanks for any help you can give me.
-Gary

This may not be the most direct approach to the solution. But, none the less, it is a solution.
For those other novices, like myself, I hope this can be useful at some point in your development:
MY DESIRED RESULT:
A. To Insert into another tablle values derived from both; Page Item (i.e. P153_x) and Attributes of a Row in an Updatable Report from which I have selected the Date-Picker.
B. I want the insert to occur automatically after the user Selects the date from the Date-Picker.
SOLUTIONS:
1. I usea Javascript prompt window to prompt for information and store the information in Pre-Created Page Items.
This is the Javascript as I've entered it into the Page HTML Header region: (Minus the Tags)
function received_javaprompt () {
var Serial_Number = prompt("Enter the Serial Number");
var Bldg_Id = prompt("Enter the Bldg_Id");
var Clst_Id = prompt("Enter the Clst_Id");
$x('P153_SERIAL_NO').value = Serial_Number;
$x('P153_BLDG_ID').value = Bldg_Id;
$x('P153_CLST_ID').value = Clst_Id;
2. I needed to identify the (Manufacturer and Part_No) Column Attribute in the Row from which I selected the Date-Picker.
A. To do this, I enumerated the Columns in the order they were listed in the Select Statement of the region (Click on the Region Definition Tab).
B. Then (Click on the Report Attributes Tab). Count, In the numerical order which these columns are selected, ONLY the columns that are Editable.
C. When I counted down as far as the Column I wanted to capture the value of, Then I made a mental note of that number and used it in the following (2) Javascripts (findMaker and findModel).
3. findMaker (Minus the tags)
function findMaker (pThis) {
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
var Maker = html_GetElement('f15_'+vRow).value
$x('P153_MAKER').value = Maker;
4. findModel (Minus the tags)
function findModel (pThis) {
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
var Model = html_GetElement('f16_'+vRow).value
$x('P153_MODEL').value = Model;
5. I added one more Javascript, to the Page HTML Header, that references the Application Process which will Insert the values into the "Other" table:
function popDevices(P153_SERIAL_NO,P153_BLDG_ID,P153_CLST_ID,P153_MAKER,P153_MODEL)
var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=popDevices',0);
get.add('P153_SERIAL_NO',P153_SERIAL_NO);
get.add('P153_BLDG_ID',P153_BLDG_ID);
get.add('P153_CLST_ID',P153_CLST_ID);
get.add('P153_MAKER',P153_MAKER);
get.add('P153_MODEL',P153_MODEL);
gReturn = get.get();
get = null;
6. I added the "onChange" process to the Element Attributes field of the Table item which utilizes the Date-Picker:
A. Click on the Report Attributes Tab of the Region.
B. Click on the Edit icon of the column which utilized the Date-Picker
C. I added this "onChange" reference to the Element Attributes field, which is found in the Tabular Form section.
onChange="javascript:received_javaprompt();findModel(this);findMaker(this);popDevices((P153_SERIAL_NO).value,(P153_BLDG_ID).value,(P153_CLST_ID).value,(P153_MAKER).value,(P153_MODEL).value);"
7. The Application Process which inserts the collected data into the table is as follows:
(Name= popDevices: Process Point= On-Demand: Type= PL/SQL Anonymous Block)
BEGIN
Insert into P_DEVICES
BLDG_ID,
CLST_ID,
NAME,
IP_ADDRESS,
SERIAL_NO,
MAKER,
MODEL
) values
:P153_BLDG_ID,
:P153_CLST_ID,
'Unassigned',
'Unassigned',
:P153_SERIAL_NO,
:P153_MAKER,
:P153_MODEL
COMMIT;
END;
Well, I hope this may help someone else like me.
I usually arrive at my solutions by getting help here on the Discussion Forum and also Google. Google inevitably points me to a previous Apex Discussion Forum session.
Edited by: garyNboston on Mar 15, 2010 10:55 AM

Similar Messages

  • SQL Server 2012 Management Studio: Creating a Database and a dbo Table. Inserting VALUES into the table. How to insert 8 Values for future use in XQuery?

    Hi all,
    In my SQL Server 2012 Management Studio (SSMS2012), I tried to create a Database (MacLochainnsDB) and a dbo Table (marvel). then I wanted insert 8 VALUES into the Table by using the following code:
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'MacLochlainnsDB')
    DROP DATABASE MacLochlainnsDB
    GO
    CREATE DATABASE MacLochlainnsDB
    GO
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL)
    INSERT INTO marvel
    (avenger_name)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8)
    I got the following error Message:
    Msg 110, Level 15, State 1, Line 5
    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
    How can I correct this problem?
    Please kindly help and advise.
    Thanks in advance,
    Scott Chang
    P. S.
    The reason I tried to create the Database, dbo Table, and then to insert the VALUES is to learn the following thing:
    You can query the entire node tree with the following xquery statement because it looks for the occurrence of any node with the /* search string:
    DECLARE @x xml;
    SET @x = N'<marvel>
    <avenger_name>Captain America</avenger_name>
    </marvel>';
    SELECT @x.query('/*');
    You can query the avenger_name elements from the marvel_xml table with the following syntax:
    SELECT xml_table.query('/marvel/avenger_name')
    FROM marvel_xml;
    It returns the following set of avenger_name elements:
    <avenger_name>Hulk</avenger_name>
    <avenger_name>Iron Man</avenger_name>
    <avenger_name>Black Widow</avenger_name>
    <avenger_name>Thor</avenger_name>
    <avenger_name>Captain America</avenger_name>
    <avenger_name>Hawkeye</avenger_name>
    <avenger_name>Winter Soldier</avenger_name>
    <avenger_name>Iron Patriot</avenger_name>
    You can query the fourth avenger_name element from the marvel_xml table with the following xquery statement:
    SELECT xml_table.query('/marvel[4]/avenger_name')
    FROM marvel_xml;
    It returns the following avenger_name element:
    <avenger_name>Thor</avenger_name>

    Hi Scott,
    The master database records all the system-level information for a SQL Server system, so best practise would be not to create any user-defined
    object within it.
    To change your default database(master by default) of your login to another, follow the next steps so that next time when connected you don't have to use "USE dbname" to switch database.
    Open SQL Server Management Studio
    --> Go to Object explorer(the left panel by default layout)
    --> Extend "Security"
    --> Extend "Logins"
    --> Right click on your login, click "propertites"
    --> Choose the "Default database" at the bottom of the pop-up window.
    --or simply by T-SQL
    Exec sp_defaultdb @loginame='yourLogin', @defdb='youDB'
    Regarding your question, you can reference the below.
    SELECT * FROM master.sys.all_objects where name ='Marvel'
    --OR
    SELECT OBJECT_ID('master.dbo.Marvel') --if non empty result returns, the object exists
    --usually the OBJECT_ID is used if a if statement as below
    IF OBJECT_ID('master.dbo.Marvel') IS NOT NULL
    PRINT ('TABLE EXISTS') --Or some other logic
    What is the sys.all_objects? See
    here.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How to insert column values into database as rows

    Hi,
    I have 8 columns and some not null columns. Based on not null columns I want to insert into table as rows. The 8 columns may contain values or no value. If the first column contains data, then I have to insert into one row. if the second column contains data I have to insert a row and in second column. respectively...So How can I insert column values into rows. Can I write 8 insert statements. (OR) is it possible to insert data from columns using where clause.
    Please help me out....
    Thanks in Advance

    Lines Table:
    line_id, orcl_bank_account_num, product_type, service_type, lease_type,
    funding_type, cpi, billing_frequency_unit_cd , annual_due_date ,
    pricing_start_date, pricing_end_date, install_date, contract_end_date ,
    prdct_replacement_cost_amt, cradle_replacement_amt, supranet_contract,
    issuance_fee, board_inactive_date, header_id, creation_date, last_modified_date,
    created_by_nam, modified_by_nam, activeinactive_flg, prdct_bill_amt_yr1,
    prdct_bill_amt_yr2, prdct_bill_amt_yr3, prdct_bill_amt_yr4, prdct_bill_amt_yr5,
    prdct_bill_amt_yr6, prdct_bill_amt_yr7, prdct_bill_amt_yr8, activation_fee_yr1,
    activation_fee_yr2, activation_fee_yr3, activation_fee_yr4, activation_fee_yr5,
    activation_fee_yr6, activation_fee_yr7, activation_fee_yr8,
    In this table the columns structure is :
    -- PRDCT_BILL_AMT_YR (1 to 8) NUMBER(14,4)
    -- ACTIVATION_FEE_YR (1 to 8) NUMBER(8,2)
    I have one more table:
    PRDCT_INS_AMT               NUMBER(14,4)
    ACTIVATION_FEE_AMT          NUMBER(14,4)
    I want to insert prdct_bill_amt_yr (1 to 8) columns data into PRDCT_INS_AMT column. similarly activation_fee (1 to 8) columns data.
    But the data should be inserted based product_type, service_type, lease_type columns values. (These 3 columns may contain upto 45 combinations).

  • How to eliminate inserting  Duplicate rows into database using JDBC Adapter

    File->Xi->JDBC
    In above Scenario if the file has two rows their values are identical, then how can we eliminated inserting  Duplicate rows into database using JDBC Adapter

    Database is a consumer of a SERVICE (SOA!!!!!!).
    Database plays a business system role here!!!!
    Mapping is part of an ESB service
    Adaptor is a technology adapted to ESB framework to support specific protocol.
    ESB accomplish ESB duties such as transformation, translation, routing. Routing use a protocol accepted by the consumer. In a JDBC consumer it is JDBC protocol and hence it a JDBC adaptor.
    There is clear separation on responsibilities among business system and ESB. ESB do not participate in business decision or try to get into business system data layer.
    So who ever are asking people to check duplicate check as part of mapping (an ESB service) may not understand integration practice.
    Please use an adaptor module which will execute the duplicate check with business system in a plug and play approach and separate that from ESB service so that people can build integration using AGILE approach.
    Thanks

  • Is there possibility to add dimension value into hierarchy using dml or spl

    1 Is there possibility to add dimension value into hierarchy using dml or spl?
    If such possibility exists how to do that.
    2 Is it possible to sort dimension values inside one branch of the hierarchy?

    What version of OLAP are you using and how did you create your AW (e.g., AWM)?
    Assuming that you're used either AWM or the Java API for AWs in 10g, there isn't an OLAP DML for adding a dimension member to a dimension (and have all the meta data kept in sync); you must load dimension members using AWM the Java API for AWs.
    So, make your changes in the the dimension table and process that table.
    For sorting, you can add a sort attribute to the dimension. Add the sort attribute to the model, indicate that it's used for sorting, add the sort attribute to your dimension table and maintain the dimension.

  • Any ideas how I can insert a pdf into word, using the insert object option. However the pdf i want to insert has text and lines annotated, but once inserted the comments don't appear????  any help would be greatly appreciated.

    Any ideas how I can insert a pdf into word, using the insert object option. However the pdf i want to insert has text and lines annotated, but once inserted the comments don't appear????  any help would be greatly appreciated.

    You will need to find a forum for MS Word since that is the software that you are trying to manipulate in this.  If you think the processing/creation of the PDF plays a role then you should ask in the forum for the software that you are using to create the PDF.
    This forum is for issue regarding downloading and installing Adobe trial products, so in any circumstance, your issue does not fit in this forum.

  • Insert a value into bol attribut

    Hiii,
    I will insert a value into a bol attribut with the method "SET_PROPERTY".
    Here is my code so far.
    lr_entity ?= me->typed_context->builheader->collection_wrapper->get_current( ).
    if lr_entity is bound.
          lr_entity->set_property( EXPORTING
                                   iv_attr_name = 'TITLE_KEY'
                                   iv_value = '0100'
    endif.
    The problem here is, I can the in the debug mode, that the value is inserted.
    But by running the debug mode again, the value of the attribut 'TITLE_KEY' is empty.
    My question here is, how can I save the value of attribut?
    Can anybody help me please?
    regards,
    John

    Hallo Ashish,
    I already tried to do this with
    DATA lr_core TYPE REF TO cl_crm_bol_core.
    lr_core = cl_crm_bol_core=>get_instance( ).
    lr_core->modify( ).
    It is also interessting that, after
    lr_core->modify( ).
    I cann't look into the bol entity builheader during debugging.
    Durring debugging, ATTRIBUTE_REF(Container Proxy->DATA REF-> ATTR_REF)
    Do you have any other idea?
    reagards,
    John

  • I do not have a credit card how can I use the App Store from Belize

    I do not have a credit card how can I use the App Store from Belize

    iTunes gift cards.

  • How can I insert a value into the Oracle Date column using JDBC?

    Suppose I have a table TEST created by "create table TEST (c1 INT, c2 Date);"
    Now I want to insert some proper value into the table TEST's column c2. I couldn't do that by TRYing using Java.sql.Date, Java.Util.Date, Java.String.
    Could anyone give me some suggestions by providing the sample code?
    Many thanks for your help!
    Wendy

    What about building the java string:
    "Insert into test (c1,d1) values ("+
    Integer.toString(var)+
    ", TO_DATE("
    formatYourDateVariableWithCalendarMethods
    ",'DD-MON-YYYY')"
    and executing it ??

  • How do I insert multiple values into different fields in a stored procedure

    I am writing a Stored Procedure where I select data from various queries, insert the results into a variable and then I insert the variables into final target table. This works fine when the queries return only one row. However I have some queries that return multiple rows and I am trying to insert them into different fields in the target table. My query is like
    SELECT DESCRIPTION, SUM(AMOUNT)
    INTO v_description, v_amount
    FROM SOURCE_TABLE
    GROUP BY DESCRIPTION;
    This returns values like
    Value A , 100
    Value B, 200
    Value C, 300
    The Target Table has fields for each of the above types e.g.
    VALUE_A, VALUE_B, VALUE_C
    I am inserting the data from a query like
    INSERT INTO TARGET_TABLE (VALUE_A, VALUE_B, VALUE_C)
    VALUES (...)
    How do I split out the values returned by the first query to insert into the Insert Statement? Or do I need to split the data in the statement that inserts into the variables?
    Thanks
    GB

    "Some of the amounts returned are negative so the MAX in the select statement returns 0 instead of the negative value. If I use MIN instead of MAX it returns the correct negative value. However I might not know when the amount is going to be positive or negative. Do you have any suggestions on how I can resolve this?"
    Perhaps something like this could be done in combination with the pivot queries above, although it seems cumbersome.
    SQL> with data as (
      2        select  0 a, 0 b,  0 c from dual   -- So column a has values {0, 1, 4},
      3  union select  1 a, 2 b, -3 c from dual   --    column b has values {0, 2, 5},
      4  union select  4 a, 5 b, -6 c from dual ) --    column c has values {0, -3, -6}.
      5  --
      6  select  ( case when max.a > 0 then max.a else min.a end) abs_max_a
      7  ,       ( case when max.b > 0 then max.b else min.b end) abs_max_b
      8  ,       ( case when max.c > 0 then max.c else min.c end) abs_max_c
      9  from    ( select  ( select max(a) from data ) a
    10            ,       ( select max(b) from data ) b
    11            ,       ( select max(c) from data ) c
    12            from      dual ) max
    13  ,       ( select  ( select min(a) from data ) a
    14            ,       ( select min(b) from data ) b
    15            ,       ( select min(c) from data ) c
    16            from      dual ) min
    17  /
    ABS_MAX_A  ABS_MAX_B  ABS_MAX_C
             4          5         -6
    SQL>

  • How to insert parameter value into multiple columns and rows

    Hi All,
    I have one procedure insert_tab and I am passing
    100~101~102:103~104~105:106~107~108 as a parameter to that procedure. I wanted to insert each numeric value into one column. The output of the table should contain
    Table:
    Col1 Col2 Col3
    100 101 102
    103 104 105
    106 107 108
    Awaiting for your reply..

    That's not more clear for me...
    Anyway, if you really want a procedure for that, try :
    SQL> create table tblstr (col1 number,col2 number,col3 number);
    Table created.
    SQL>
    SQL> create or replace procedure insert_fct (p_string IN varchar2)
      2  as
      3  v_string     varchar2(4000):=p_string||':';
      4  v_substring  varchar2(4000);
      5 
      6  begin
      7      while instr(v_string,':') > 0 loop
      8            v_substring := substr(v_string,1,instr(v_string,':')-1)||'~';
      9            insert into tblstr(col1,col2,col3)
    10            values (substr(v_substring,1,instr(v_substring,'~',1,1)-1),
    11                    substr(v_substring,instr(v_substring,'~',1,1)+1,instr(v_substring,'~',1,2)-instr(v_substring,'~',1,1)-1),
    12                    substr(v_substring,instr(v_substring,'~',1,2)+1,instr(v_substring,'~',1,3)-instr(v_substring,'~',1,2)-1));
    13            v_string:=substr(v_string,instr(v_string,':')+1);
    14      end loop;
    15  end;
    16  /
    Procedure created.
    SQL>
    SQL> show err
    No errors.
    SQL>
    SQL> select * from tblstr;
    no rows selected
    SQL> exec insert_fct('100~101~102:103~104~105:106~107~108')
    PL/SQL procedure successfully completed.
    SQL> select * from tblstr;
          COL1       COL2       COL3
           100        101        102
           103        104        105
           106        107        108
    SQL> exec insert_fct('109~~')
    PL/SQL procedure successfully completed.
    SQL> exec insert_fct('~110~')
    PL/SQL procedure successfully completed.
    SQL> exec insert_fct('~~111')
    PL/SQL procedure successfully completed.
    SQL> select * from tblstr;
          COL1       COL2       COL3
           100        101        102
           103        104        105
           106        107        108
           109
                      110
                                 111
    6 rows selected.
    SQL> Nicolas.

  • Insert float value into ms sql server

    Hi.
    How do I insert a float value into my ms sql db.
    The Code:
    select.setFloat( 4, theForm.getVaerdi() );ERROR:
    "MakeClapetInsertAction.java": Error #: 300 : method setFloat(int, java.lang.Float) not found in interface java.sql.PreparedStatement at line 89, column 12

    setFloat takes a float primitive, not a Float object.
    select.setFloat( 4, theForm.getVaerdi().floatValue() );

  • How to insert a value into a field of binary type?

    I've been using Oracle for a while now but never dealt with BLOB
    or long raw type before. Does anyone here know how to insert a
    record into a field of either blob or long raw type?
    Any suggestions would be very appreicated.
    Thanks.

    pls used the loadfromfile procedure which is in the DBMS_LOB
    package to insert the data from external os file into blob data
    type column.
    Kunjan

  • Insert multiple records into Oracle using Java

    Hi,
    Has anyone tried to insert multiple records into an Oracle table from Java? I have my data in a Java collection.Can I send a Java Collection to an Oracle Package as a PL/SQL Table Type? My problem is I dont want to instantiate a CallableStatement object everytime I do an insert. Instead I want to do that only once and then insert multiple records in one operation.
    Any suggestions will be appreciated,
    Thanks,
    Alex

    Hi Mensa,
    I went thru the code example in your book in chapter 8 (downloaded it from OTN). It looks like the java code for "public class myPLSQLIndexTab" might be a java stored procedure stored in the oracle database?
    Pardon my ignorance because I've never worked on java code in the oracle database itself but how would I call such a program outside the oracle database? For example say I have a batch job that downloads data from a webservice and that batch job is written in java and its sitting on a batch server somewhere on the network. But the java program that inserts data into the database is sitting in the oracle database (also somewhere in the same network). How can the java code sitting on the batch server talk to the java code sitting on the oracle server? Is it the same as calling a pl/sql package using CallableStatement?
    Thanks
    Alex

  • Inserting multiple rows into database using c#

    Hi,
    I have a web form with a customer id and a few checkboxes with different products (productid) and when a user checks the checkbox he must also enter a date for that product. 
    I need to basically do the following insert into Customer  (customerid,productid, purchasedate) values (1,890,18/12/2003)
    insert into Customer  (customerid,productid, purchasedate) values (1,56,12/12/2004)
    For each product checked I need to insert the details into the database with the same customerid.
    The database table looks like this:
    Customer Table
    CustomerId int
    ProductId int
    PurchaseDate datetime
    What is the correct way to do that? Should I change the database table?
    Thanks

    This has nothing to do with C#. Ask in the SQL forum for your database product for bulk insertion options.
    Visual C++ MVP

Maybe you are looking for

  • Security violation exception with Weblogic cluster installation on OIm 9.1

    Hi, I have OIM9.1 installed on weblogic 8.1 SP4 in clustered environment, which more often than not seems to work fine. But some time I get following exception on server console/log file which causes certain provisioning task to be rejected... at web

  • Is it possible to call the TEXT EDITOR in a program?

    Hi, I want a function module which will popup a text editor where the user can write some text and then i can use this text for further processing. do we have any such function modules or text editor which i can call from the program to take long tex

  • How to connect ODSM to OVD?

    Hi, I have OID, OVD, and OIF installed, running on one machine. OPMNCTL shows that ovd appears to be running: Processes in Instance: asinst_1 --------------------------------------------------------------+--------- ias-component | process-type | pid

  • Download songs from a foreign version of Itunes?

    I'm an ex-pat New Zealander living in London. My favourite kiwi band has just released their new album and I depserately want to download it. As far as I can tell at the moment it is only available on the New Zealand version of iTunes. Is there any w

  • The date and time of files created and saved are off

    I notice that under the date modified column, files that I have saved or updated are usually a day off. I checked the date and time in the system preferences and it is correct. is something wrong with the battery?