[CS2/CS3 JS] Inserting columns or rows in tables

Anybody here know how to insert or add column(s)/row(s) in tables in Indesign Javascript? Please help... Thanks...

Hi Joaquin,
you might have to take use of the add()-command:
Add a column before the first column:
myTable.columns.add( LocationOptions.BEFORE, myTable.columns[0] );
Add a row after the last row:
myTable.rows.add( LocationOptions.AFTER, myTable.rows[-1] );
Martin

Similar Messages

  • How to insert columns in an existing table?

    iv read the tutorial in this site http://www.w3schools.com/sql/sql_alter.asp but it is not for SQL Server 2000 DB.
    Im using SQL Server 2000 DB. how do i insert column in an existing table?
    i tried to execute the code (String query) below but it doesn't wrk:
    For data type char:
    String query = "ALTER TABLE [dbo].["+tablename+"] ADD [columnname] [char] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL";
    For data type int:
    String query = "ALTER TABLE [dbo].["+tablename+"] ADD [columnname] [int] NOT NULL";________________________
    is what's wrong with the code?

    Best solution would be to look up the exact syntax from the SQL Server 2000 documentation. The tutorial you have there teaches the ANSI Standard SQL. It is surprising that SQL Server 2000 (Microsoft right?) doesn't comply with that (especially since they list it in as one of the ones the tutroial was made to demonstrate).
    I would double and triple check your sintax, whatch your error logs to make sure something else isn't preventing you from changing, and making sure you are logged in to the DB as a user who has the ability to alter tables.

  • How to insert a new Row in table - Need help

    Hi everyone,
    I'm using JHeadstart 10.1.2, UIX pages and STRUTS.
    This is my situation: My page1 has a table (table1) and when I select one line from table1 and press a button, I go to page 2.
    I have an action in the Struts-Config.xml file, so I can pass some parameters to page2, like this:
    <action path="/S2PopUpObstaculos" <=PAGE2 type="oracle.jheadstart.controller.strutsadf.action.JhsDataActionSaveObstaculos" className="oracle.jheadstart.controller.strutsadf.action.JhsDataActionMapping" parameter="/WEB-INF/page/S2PopUpObstaculos.uix" name="DataForm">
    <set-property property="modelReference" value="S2AltaSociais2UIModel"/>
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=${data.S2AltaSociais2UIModel.Obstaculo},${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},${data.S2AltaSociais2UIModel.Obstaculo}"/>
    </action>
    But now, the problem is, if I don't select one Row from table1 and press the button to go to page2, I need to pass diferent parameters to page 2, like this:
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=0,${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},0"/>
    </action>
    Do you have any ideia how to do this? Can ayone help me?
    Thanks,
    Atena
    Message was edited by:
    Atena

    Hi Sascha,
    thanks very much for your replay.
    My project changed and I have another question about this. My page1 has a table (table1) and when I select one line from table1 and press a button, I go to page 2.
    I have an action in the Struts-Config.xml like this in page2 (S2PopUpObstaculos):
    <action path="/S2PopUpObstaculos" type="oracle.jheadstart.controller.strutsadf.action.JhsDataActionSaveObstaculos" className="oracle.jheadstart.controller.strutsadf.action.JhsDataActionMapping" parameter="/WEB-INF/page/S2PopUpObstaculos.uix" name="DataForm">
    <set-property property="modelReference" value="S2AltaSociais2UIModel"/>
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=${data.S2AltaSociais2UIModel.Obstaculo},${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},${data.S2AltaSociais2UIModel.Obstaculo}"/>
    </action>
    But now, the problem is, if I don't select one Row from table1 and press the button to go to page2, I need to pass diferent parameters to page 2, like this:
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=0,${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},0"/>
    </action>
    Do you have any ideia how to do this? Can you help me?
    Thanks,
    Atena

  • How to insert one blank row in table using ODataModel?

    Hi,
    I have a table in which the data is being shown using ODataModel. Now I want to add a new row dynamically when user clicks on 'New' button. For this I know using JsonModel it would be something like below where every field in the table is almost  blank as I want users to enter the data in it and later I want to save the data in the model at server:
    var tableModel = table.getModel();
      var tableData = timeSheetTable.getModel().getData();
      tableData.modelData.push({"workItem":"item5","day1":"","day2":"","day3":"","day4":"","day5":"","day6":"","day7":""});
       tableModel.setData(tableData);
      timeSheetTable.setModel(tableModel);
    How this thing can be achieved using ODataModel? I can't push data like what is shown above.
    I tried searching examples for this but no luck. Any help would appreciated.
    Thanks,
    Supriya Kale

    Hi,
    I have a table in which the data is being shown using ODataModel. Now I want to add a new row dynamically when user clicks on 'New' button. For this I know using JsonModel it would be something like below where every field in the table is almost  blank as I want users to enter the data in it and later I want to save the data in the model at server:
    var tableModel = table.getModel();
      var tableData = timeSheetTable.getModel().getData();
      tableData.modelData.push({"workItem":"item5","day1":"","day2":"","day3":"","day4":"","day5":"","day6":"","day7":""});
       tableModel.setData(tableData);
      timeSheetTable.setModel(tableModel);
    How this thing can be achieved using ODataModel? I can't push data like what is shown above.
    I tried searching examples for this but no luck. Any help would appreciated.
    Thanks,
    Supriya Kale

  • Convert Columns into Rows (internal tables) - Urgent Help Pleasse..

    Hi friends i'm having a little problem and hope you can help me..Here's the situation.
    I have an internal table like shown below
    (Key)                   (Key)               (Key)          (Key)
    PATH_ID     |      GROUP     |      LINE     |     ATRIBUTE          |    VALUE
    ASLN2                1                      1                Company_Code       5146
    ASLN2                1                      1                Account_Code        400405
    ASLN2                1                      1                Profit_Centre          AA00N2
    ASLN2                1                      2                Company_Code       5146
    ASLN2                1                      2                Account_Code       400705
    ASLN2                1                      2                Profit_Centre          AA00N2
    ASLN3                1                      1                Company_Code       5146
    ASLN3                1                      1                Account_Code        400405
    ASLN3                1                      1                Profit_Centre          AA00N2
    ASLN3                1                      2                Company_Code       5146
    ASLN3                1                      2                Account_Code       400705
    ASLN3                1                      2                Profit_Centre          AA00N2
    and i want to convert this internal table to one like below
    PATH_ID      |      GROUP      |      LINE     |      Company Code   |    Account Code    |    Profit Centre
    ASLN2                1                      1                 5146                     400405                   AA00N2
    ASLN2                1                      2                 5146                     400705                   AA00N2
    ASLN3                1                      1                 5146                     400405                   AA00N2
    ASLN3                1                      2                 5146                     400705                   AA00N2
    but i'm a bit of stuck, all those key fields are making me confused...anyone have a marvelous ( ) idea of how to implement this transformation ?
    best regards,
    Ricardo Monteiro

    Itab1 with the structure PATH_ID | GROUP | LINE | ATRIBUTE | VALUE
    Itab2 with structure PATH_ID | GROUP | LINE | ATRIBUTE | VALUE
    Itab3 with the final structure PATH_ID | GROUP | LINE | Company Code | Account Code | Profit Centre
    move itab1 to itab2.
    sort itab2 by path_id group line.
    delete adjacent duplicates from itab2 comparing path_id group line.
    loop at itab2.
      clear itab3.
      move:
         itab2-pathid to itab3-pathid,
         itab2-group to itab3-group,
         itab2-line to itab3-line.  
      loop at itab1where pathid = itab2-pathid
                            and group = itab2-group
                            and line   = itab2-line.
          IF itab1-ATRIBUTE = ' Company_Code'.
             itab3-Company_Code = itab1-attribute.
          elseif itab1-ATRIBUTE = ' Account_Code '.
             itab3-Account_Code = itab1-attribute.
          elseif itab1-ATRIBUTE = ' Profit_Centre ' .
             itab3-profit_center = itab1-attribute.
          endif
      endloop.
      append itab3.
    endloop.
    try this.
    Thanks,
    rajinikanth

  • Inserting columns from internal table to a database table!

    Hi people,
    How do I go about to insert columns from an internal table -intab- into an data base table -dbtab-. These tables contain some similar columns, not all.
    A code example would be much appriciated!
    /Armin

    hi armin,
    INSERT  dbtab      FROM TABLE itab. oder
    INSERT (dbtabname) FROM TABLE itab.
    Extras:
    1. ... CLIENT SPECIFIED
    2. ... ACCEPTING DUPLICATE KEYS
    3. ... CONNECTION con
    Effect
    Mass insert: All lines of the internal table itab are inserted in one single operation. The lines of itab must fulfill the same conditions as the work area wa in variant 1.
    When the command has been executed, the system field SY-DBCNT contains the number of inserted lines.
    The Return Code is set as follows:
    SY-SUBRC = 0:
    All lines successfully inserted. Any other result causes a runtime error.
    Note
    If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0 after the call.
    Addition 1
    ... CLIENT SPECIFIED
    Effect
    As with variant 1.
    Addition 2
    ... ACCEPTING DUPLICATE KEYS
    Effect
    If a line cannot be inserted, the system does not
    terminate with a runtime error but only sets the return value SY-SUBRC to 4. All other lines are inserted after the command is executed.
    hope this helps,
    do reward if it helps,
    priya.

  • 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).

  • Inserting total column and row

    Hello All,
    I'm new to WebI and BOBJ and I'm having some issue with my first report.  I've tried searching the forum for this same issue (or something similar) and came across nothing.  Any help is greatly appreciated!
    I'm having a problem inserting a Grand Total column and row to my report. Here's a sample layout of my report:
    *Tech Type | Project | Role | Key Fig1 | Key Fig 2 | Key Fig 3 | Key Fig 4|*
    Proj 1
    Subtot
    Proj 2
    Subtot
    etc
    In one tab the key figures are grouped by month and I also created four tabs (one tab for each key figure) that lists the key figures by month.
    What I wish to do is insert one row at the end of the report which sums the key figures vertically and a column that adds the key figures horizontally.  I've tried to do SUM but that inserts a row/column after every key fig. I've also tried to do a count and insert a SUM formula with the same effect (a row/column is inserted after every key figure).
    Any suggestions?
    Thanks,
    Joaquim M.

    Joaquim,
    Through your posting it's hard to visualize what is happening, other than you are not satisfied with the results.  Here are the steps for adding a sum to a horizontal grid with perhaps two columns of information (month, figures).  After the grid is presented, left-click once on the data of figures (do not click on the header cell of figures, click on any cell just below the header).  Once you left-click the column will appear with a "grey" highligting.  Next is to click on the "sigma" icon drop-down and choose "Sum".  Once you click sum a new row at the very bottom of your grid should appear, summarizing [figures].
    Thanks,
    John

  • How I can insert one row on table,  with columns settings: readonly = true

    I have a problem. (jdeveloper 11.1.1.2.0)
    How I can insert row on table (EditingMode= clickToEdit), with columns settings: ReadOnly = true.
    When I make click on button create insert, ADF create one row on the table with output text invisible ( ReadOnly = true.)
    I make double click, then output text is visible (ReadOnly = false)
    I dont want make double click. I want output text is visible (ReadOnly = false), when I make click on button create insert
    Thanks

    Hi,
    try changing the edit mode of the table when pressing the button and refresh the button. This of course turns the whole table into editable mode, but this is how it needs to work. Alternatively, you create an input form for the user to edit the new record and show the form in a popup or beneath the table. Then when the user submits the created row data, you refresh the table to shwo the new row
    Frank

  • Inserting a db row from a form with a value passed in from another page

    We have a report (P1) on a table (T1). P1 has a link column (C), and C is the PK on T1. Clicking on a link (i.e., a row) in report P1, takes us to form (P2). P2 is used to allow the user to insert a new row into T1, with the constraint that one of the columns (X) in T1 must have the same value as X had in the linked row on P1. Also, X is a NOT NULL attribute.
    What we are doing is:
    First, passing C to P2 by setting the link name=P2_X_C and the link value=#C#
    Second, in P2, we are setting form element P2_C via a SQL statement:
    SELECT X
    FROM T1
    WHERE C = :P2_X_C
    P2 displays nicely. We set P2_C to display only, and allow the user to enter values for the other columns. The value displayed for X is not NULL and correctly matches the value from P1. However, when we hit the CREATE button on P2, we get error: ORA-01400: cannot insert NULL into "T1"."X". Unable to process row of table T1.
    APEX seems to have an "issue" with having a value in a form "set" and transmitted to the DB on INSERT.
    Any help would be greatly appreciated.

    Hi,
    1 For "Display Only" items that you are not populating directly from a database column, if you want to save the value, you have to ensure that Save Session State is set to Yes and these items are not actually submitted with the page. The same sort of thing would apply to Disabled or Read-Only items as browsers do not submit these items - though these are more tricky to deal.
    2 Passing the PK value is the most common way of identifying which record contains the values you need. Passing other values is also typical - eg, for applying filters for calendars or searches or for setting flags.
    3 For database columns, which should be based on the underlying table's data, you can use the Default Value settings - though be aware that these values do not exist in session state until the page is submitted. That's ok if you don't need to use the value anywhere else on your page
    Andy

  • Inserting a new row in a table

    I want to insert a row between other rows. Means when we insert a row and we see by
    select * from emp;
    then the result shows that inserted value goes to last row. So i want that when we insert a value to a table and do
    select * from emp;
    then inserted value must be between other rows....

    Well, if your teacher won't take the answer "you can't insert rows between other rows, you must use an order by to get your data in a particular order", then he is not the teacher you want to be learning Oracle database concepts from. Because it is the truth. Maybe he is testing your resolve to stick to an answer that you have researched.
    If he's intending it as a "trick" question, you could propose what others here have alluded to - for example, if you have a date field in your table and had, for example, rows with dates Jan 3 2011 and Jan 5 2011, you could insert a record with date Jan 4 2011, then when you select, and use "order by" that column, the data will "appear to be" between the existing 2 records. But, again, this relies on using "order by", the data is not physically or any other way "between" the first 2 records, and is not a practical, real-world way of solving most data ordering issues.
    Now, this is an Oracle forum, and this is the Oracle answer. I do not have experience with any other database so I can't definitively say that this would be the answer in all databases.
    Good luck with your class.

  • Inserting rows in table while logging errors...Urgent

    Hi all,
    i want to insert rows from temp table to main table.
    if temp table contains 100 rows.then all rows must be inserted
    in main table.if their is any exception while insertion,
    insertion must nt stop and erroring rows along with error no must be inserted in
    error log table.
    How to do this ?
    i used forall save exceptions to achieve this .
    but ws able to save only error no. but not errroing rows in error log table.
    is there any efficient way to achieve this?
    can forall be modified in way that it inserts erroring rows also?????

    Hi,
    1.) does dbms_errorlog works fine in this case?If all of your 807 tables having same columns then i think it will work (NOT TESTED).
    By the way are you also trying to insert rows for all tese 807 tables in a single PL/SQL block?
    Please post how you are trying to insert then we can think about it,
    Oracle ERROR_LOG table allows us to have any number of columns.
    From the Oracle Docs:
    The number of columns in this part of the error logging table can be zero, one, or more, up to the number of columns in the DML table. If a column exists in the error logging table that has the same name as a column in the DML table, the corresponding data from the offending row being inserted is written to this error logging table column. If a DML table column does not have a corresponding column in the error logging table, the column is not logged. If the error logging table contains a column with a name that does not match a DML table column, the column is ignored.
    Regards

  • How to insert a button on the column header of a table in webdynpro java

    Hi
    Can anyone tell me how to insert a button on the column header of a table in webdynpro java?
    regards
    sunit

    Hi sunit,
    Instead of adding button in the column header , in the column
    add a fixed top cell.
        right click on the column
        Insert FixedTopCell
        Right click on the fixedTopCell
        insert Editor.
       select button.
    then button will be only in the top most row.
    Hope it will satisfy ur requirement
    Regards
    Smitha

  • How to insert a new row in the middle of an set of rows

    Hi
    How to insert a new  row in the middle of an set of rows ? and How to Reset the line id after the new row added ?
    Regards,
    Sudhir B.

    Hai,
    just try this,
    Instead of using omatrix.Addrow(1,-1) use like
    omatrix.AddRow( RowCount , Position)
    RowCount
    The number of rows to add (default is 1)
    Position
    The position of the new rows (0-based; default is -1, meaning append row to the end)
    After adding rows in matrix For, sno.
    for i=1 to omatrix.visualrowcount
    otext=omatrix.getcellspecific("columnid",i)  '--where columnid is the unique id of the sno column
    otext.value=i
    next i
    Hope this helps you.
    Thanks & Regards,
    Parvatha Solai.N

  • Need help with query for converting columns to rows

    Hello,
    I know this is a very common question asked in the forum. I have searched regading this, i did find some threads, but i was not able to achieve what i require from the answers posted. So anybody please help me.
    I have a table which is having multiple columns as follows:
    Insert into table_1 (X,Y,Z,A,B,C,D,E,F,G,H,I) values (0,0,2,0,0,1,3,0,0,0,0,0);I want to convert the result into a two column, multiple rows i.e., I want the result as follows:
    Col1 Col2
    X      0
    Y     0
    Z      2
    A     0
    B     0
    C     1
    D     3
    E     0
    F     0
    G     0
    H     0
    I      0Please anybody help me in writing the query for this..

    Is this what you are expecting:
    SQL> WITH T AS
      2  (
      3  SELECT 0 X, 0 Y, 2 Z, 0 A, 0 B, 1 C, 3 D, 0 E, 0 F, 0 G, 0 H, 0 I FROM DUAL
      4  )
      5  SELECT  'X' col1, X col2 FROM T
      6  UNION ALL
      7  SELECT  'Y' col1, Y col2 FROM T
      8  UNION ALL
      9  SELECT  'Z' col1, Z col2 FROM T
    10  UNION ALL
    11  SELECT  'A' col1, A col2 FROM T
    12  UNION ALL
    13  SELECT  'B' col1, B col2 FROM T
    14  UNION ALL
    15  SELECT  'C' col1, C col2 FROM T
    16  UNION ALL
    17  SELECT  'D' col1, D col2 FROM T
    18  UNION ALL
    19  SELECT  'E' col1, E col2 FROM T
    20  UNION ALL
    21  SELECT  'F' col1, F col2 FROM T
    22  UNION ALL
    23  SELECT  'G' col1, G col2 FROM T
    24  UNION ALL
    25  SELECT  'H' col1, H col2 FROM T
    26  UNION ALL
    27  SELECT  'I' col1, I col2 FROM T
    28  /
    C       COL2                                                                   
    X          0                                                                   
    Y          0                                                                   
    Z          2                                                                   
    A          0                                                                   
    B          0                                                                   
    C          1                                                                   
    D          3                                                                   
    E          0                                                                   
    F          0                                                                   
    G          0                                                                   
    H          0                                                                   
    C       COL2                                                                   
    I          0                                                                   
    12 rows selected.

Maybe you are looking for