A script to delete all table rows containing a specific text

Hello,
I've tried some old scripts but can't get around to the right solution.
I need a script that will delete all rows in a table that contain a specific single-word text, something like "xxx".
Anyone's got an idea?
Thanks

Hi,
To remove a row use row.remove() method.
So iterate through table.rows and remove the one matched a condition.
If we talk about condition you have to be more accurate - what do you mean "a row contain a text":
     ==> 1st cell contains,
     ==> any cell contains.
Entire row contents is an array of its cells.contents, so your 1st row text is:
rows[0].contents.join(" ")     ==> string
Jarek

Similar Messages

  • A script to apply cell style to entire rows containing a specific text

    Hi,
    I am using InDesign CC 2014
    Does anyone know how to apply a cellstyle based on text contents found in a cell in javascript?
    I need to search the document and change cell style in entire row to "cellStyle01" if the text "someText" appear in cell.
    I've found similar script here in forum which apply table style, but don't know how to change it to apply cell style!
    var curDoc = app.activeDocument;
    var allTables = curDoc.stories.everyItem().tables.everyItem();
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "someText";
    var allFounds = allTables.findText();
    app.findTextPreferences = app.changeTextPreferences = null;
    for ( var i = 0; i < allFounds.length; i++ ) {
    var curFound = allFounds[i];
    if ( curFound.length == 1 ) {
    var curFoundParent = curFound[0].parent; 
    // curFoundParent.parent.appliedTableStyle = curDoc.tableStyles.itemByName( "tableStyle" ); 
    curFoundParent.parent.appliedCellStyle = curDoc.cellStyles.itemByName("cellStyle01"); 
    Thanks!

    Hi,
    Try this,
    var doc = app.activeDocument, 
        _tables = doc.stories.everyItem().textStyleRanges.everyItem().getElements(), 
        i, j, k, l, a, _rows,_cells, rowlen; 
    for(i =0;i<_tables.length;i++) 
        for(j =0;j<_tables[i].tables.length;j++) 
            _rows = _tables[i].tables[j].rows; 
            for(k =0;k<_rows.length;k++) 
                _cells = _rows[k].cells; 
                for(l =0;l<_cells.length;l++) 
                    if(_cells[l].contents == "someText") 
                        rowlen = _cells[l].parent.cells.length; 
                        while(rowlen--) 
                              _cells[rowlen].appliedCellStyle = doc.cellStyles.item("cellStyle01"); 
    Regards,
    Chinna

  • Button to delete all empty rows

    I am in the process of creating an interactive form that has a button that add rows for the user to input issues and another button to add follow-ups to those instances. There are 3 different sets of these. However, we do not want to add a delete button to all rows, to allow for accidental deletion of already inputted data.  I would like to create a button that will delete all empty rows, including all subforms.  Either that, or upon saving the document, all empty rows would be deleted - whichever would be easier. Please help!  This seems like it will be a complicated task and I am not that well versed in LiveCycle to be able to figure this out on my own.
    Thank you!

    There is no doubt that looping through nested repeating objects is more complex:
    Here is the script for the first table with follow-up rows:
    // Technical
    var nCount3 = VitalsSubform.Technical._Instance1.count;
    for (var k=0; k<nCount3; k++)
         // this is script to remove the follow-up rows in the first table only
         var nCount6 = xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "]").Table1._Row1.count;
         // loop through the rows in the follow-up table
         for (var i=0; i<nCount6; i++)
              if (xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "].Table1.Row1[" + i + "]").Cell4.rawValue == null)
                   // remove null row
                   xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "]").Table1._Row1.removeInstance(i);
                   // recount nCount in case a row has been deleted
                   nCount6 =xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "]").Table1._Row1.count;
                   // account for the row that is now deleted
                   i = i-1;
         // now remove null statements
         if (xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "]").Table1.Statement.Statement.rawValue == null)
              VitalsSubform.Technical._Instance1.removeInstance(k);
              var nCount3 = VitalsSubform.Technical._Instance1.count;
              k = k-1;
    It is by no means tested and could still be flaky.
    Have you considered a manual 'x'/delete button for the follow-up rows?
    Here is the form: https://acrobat.com/#d=JMGUKXNQ*qMD18S3W5VxSQ
    Niall

  • How can I search a word in a column and erase all the rows containing that word?

    How can I erase all the rows containing a certain word at once?
    Right now I do it manually : I search the word in a certain column with cmd+f, after that it points out where the word is in different rows. And then I manually erase every row but this takes a lot of time when you have 500 row! There must be a way to select all the rows concerned at once and erase them? Thks!

    assuming this is something you don't do very often you can simply use the search feature to identify instances of the search term, and select the row, delete the row then search again.
    The next level would be to add a new column where you identify that the search term exists in a cell of the row, then you sort by the new column:
    B1=IF(IFERROR(FIND("team", A1,1), 0)>0, "FOUND", "")
    my search term is "team" change yours as needed.
    select B1, copy,
    select Column B, paste
    Now sort:
    Inspect the rows to make sure the rows found are REALLY ones you want to remove.  select the ones you want to remove and delete those rows.

  • Script that deletes all the data in the DB

    Somebody has or know a script that delete all the data (but not the tables) of the database???? I have dummy data and know I need the tables clean of data.
    How can I delete it???????? Thank you for you help
    Javier

    You could truncate all the tables with the following commandTRUNCATE TABLE <table_name>;This will delete all the data in the table while keeping the table structure, contraints, indexes, triggers, etc. intact so they wont have to be rebuilt. All foreign keys must be disabled to use the TRUNCATE command.

  • Deleting all tables in a schema

    I am trying to delete all tables in a given schema. Any ideas how to do this via t-sql appreciated.
    tia,
    edm2

    If the tables are not dependent one of the other, then simple query like this:
    DECLARE @sql NVARCHAR(max)
    SELECT @sql = stuff((
    SELECT ', ' + quotename(table_schema) + '.' + quotename(table_name)
    FROM INFORMATION_SCHEMA.Tables
    WHERE table_schema = 'dbo'AND TABLE_TYPE = 'BASE TABLE'
    ORDER BY table_name
    FOR XML path('')
    ), 1, 2, '')
    SET @sql = 'DROP TABLE ' + @sql
    PRINT @sql
    BEGIN TRANSACTION
    EXECUTE (@SQL)
    ROLLBACK TRANSACTION
    If they are related, then the script will be much more complex as you need to drop tables in the right order.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • SQL azure database size not dropping down after deleting all table

    Dear all,
    I have a simple database on Azure for which I have deleted all table data. The size of the database is still showing 5Mb of data and I am charge for that. I have heard that this may happen from cluster index getting fragmented.
    I have run  a querry I found on internet on all my table index to show percentage of fragmentation and all report 0%.
    DBA is not so my job but what could it be or how can I reduce that size ?
    ON premise I would use COMPACT DB but not available in azure like some others DB action
    Thnaks for tips
    regards

    user created objects/data are not the only ones stored in your database. you got system objects and metadata as Mike mentions above.
    are you trying to skip being charged if you're not storing data? looking at the pricing table,  you'll still get charged the $4.995 for the 0-100MB database size range.

  • Hiding table row containing label and item

    Hi there,
    I need some javascript to hide and show the table row containing both a page item and its label, on a wizard-created form page. Before I go off and write my own code, does any of the APEX-provided javascript include this functionality already?
    Thanks,
    Robert

    Hi Robert,
    Take a look at Carl's documentation page -
    http://apex.oracle.com/pls/otn/f?p=38704:2:1838921420011323::NO::P2_ID1:9
    The $x_ItemRow function looks like it does what you want.
    John.

  • Script to delete all attachments

    Hi all
    I was wondering whether there is a script to delete all of the attachments in a pdf form? I know that you can use removeDataObject to delete specific attachments by name, but was wondering whether there was a simple way to delete all of the attachments in one hit?
    Cheers
    Mark

    You just need to loop through the dataObject.
    // DUMP ANY ATTACHMENTS
    var d = event.target.dataObjects;
    if (d != null)
    for (var i = 0; i < d.length; i++)
    // console.println("Data Object[" + i + "]=" + d[i].name);
    event.target.removeDataObject(d[i].name);

  • How to delete all TABLEs in Schema SYS which are created since 09:15?

    Unfortunately a script created lots of tables in the wrong Tablespace (=SYSTEM) and Schema (=SYS).
    How can I delete (in one DDL command) all TABLES which are created inTablespace=SYSTEM and SCHEMA=SYS
    during the last 3 hours resp. since 09:15 of 25th Sep 2011 ?
    Alternatively: How can I move these TABLEs to another Schema (e.g. ATEST) and Tablespace (USERS)?
    Is this possible with Oracle XE or only with Oracle Enterprise?
    Peter

    user559463 wrote:
    Unfortunately a script created lots of tables in the wrong Tablespace (=SYSTEM) and Schema (=SYS).
    How can I delete (in one DDL command) all TABLES which are created inTablespace=SYSTEM and SCHEMA=SYS
    during the last 3 hours resp. since 09:15 of 25th Sep 2011 ?
    Alternatively: How can I move these TABLEs to another Schema (e.g. ATEST) and Tablespace (USERS)?
    Is this possible with Oracle XE or only with Oracle Enterprise?
    PeterYou can query dba_objects and join it with dba_tables where tablespace_name='SYSTEM' , then drop the tables result of the query; the idea is to use the following query;
    SQL> select OWNER, OBJECT_NAME from dba_objects where OBJECT_TYPE='TABLE' and OWNER = 'SYS' and CREATED >= sysdate - 3 / 24;Please consider marking your questions as answered, when it is the case;
    Handle:      user559463 
    Status Level:      Newbie
    Registered:      Feb 18, 2007
    Total Posts:      583
    Total Questions:      266 (186 unresolved)Edited by: orawiss on Sep 26, 2011 4:03 PM

  • Delete internal table rows without using loop statement

    i have an internal table which consists of 100 records.
    i need to keep only first 5 records.
    without using the loop statement i need to delete the rest of the records. how can we achieve this result.
    i.e.  delete itab1 where  "recordno"  > 5.
    regards.
    ZG

    Hi,
    Delete itab [FROM idx1] [TO idx2] {Where (log_exp)]
    To delete several lines at once, you have to specify at least one of the additions FROM, TO, or WHERE. You can only use the additions FROM and TO with standard tables and sorted tables.
    Delete itab [FROM idx1]
    If you specify FROM, all the table rows from the table index idx1 onwards are included.
    Delete itab [TO idx2]
    If you specify TO, all the table rows from the table index idx2 onwards are included.
    PARAMETERS: p_carrid TYPE sflight-carrid,
                p_connid TYPE sflight-connid.
    DATA: BEGIN OF seats,
            fldate    TYPE sflight-fldate,
            seatsocc  TYPE sflight-seatsocc,
            seatsmax  TYPE sflight-seatsmax,
            seatsfree TYPE sflight-seatsocc,
          END OF seats.
    DATA seats_tab LIKE STANDARD TABLE OF seats.
    SELECT fldate seatsocc seatsmax
           FROM sflight
           INTO TABLE seats_tab
           WHERE carrid = p_carrid AND
                 connid = p_connid.
    LOOP AT seats_tab INTO seats.
      seats-seatsfree = seats-seatsmax - seats-seatsocc.
      MODIFY seats_tab INDEX sy-tabix FROM seats.
    ENDLOOP.
    ENDLOOP.
    SORT seats_tab BY seatsfree DESCENDING.
    DELETE seats_tab FROM 5.
    Thanks & Regards,
    ShreeMohan
    Edited by: ShreeMohan Pugalia on Jul 21, 2009 4:28 PM

  • Generate script to delete all schemas

    Hello All,
    I'm going to do a reimport and i want to delete all the schemas in the db....
    I've written this script:
    select 'DROP TABLE schemaname.' || TABLE_NAME || ' CASCADE CONSTRAINTS;'
    from dba_tables
    where owner = 'schemaname'
    order by TABLE_NAME;
    how can i generate the script for all the schemas? The above will only list one schema...
    Basically i want to do another import and get a clean log (as clean as possible).
    Thanks.

    You modify your query to select a distinct list of object owners. In fact you might want to look for some other objects besides tables. If you are only interested in tables you should probably change the subquery to look at dba_tables.
    select 'DROP TABLE '||owner||'.' || TABLE_NAME || ' CASCADE CONSTRAINTS;'
    from dba_tables
    where owner in (select distinct owner from dba_objects
    where owner not in ('SYS','SYSTEM','OUTLN','PUBLIC')
    order by TABLE_NAME;
    You should look the list of owners over very carefully before running the resulting DDL commands. There are other owners, depending on your Oracle version and features in use, that you will not want to touch.
    HTH -- Mark D Powell --

  • How to delete a table row in the context?

    Hi,
    I've got a table in my context that I access with <TABLE-NAME>-<TABLE-COLUMN>[index].
    For example <TABLE-NAME>-<TABLE-COLUMN>.dim delivers the amount of entries in this table.
    Now I want to delete a specific row in this table without any ABAP-code. Is there a possibility to do this?
    I tried to set the .dim = <old dimvalue - 1>, but the row seems to still exist, it's just empty.
    There must be a method like 'delete', or am I wrong...?
    kr, achim

    Alexander,
    could you provide an example please?
    for example, if I have a code like this:
    `repeat j from 1 to MYTABLE-MYCOLUMN1.dim`
       MYTABLE-MYCOLUMN1[j] = "value1";
       MYTABLE-MYCOLUMN2[j] = "value2";
    `end`
    and now assume, I want to delete the last row of the table, what would it look like?
    `MYTABLE.deleteValue(MYCOLUMN1, j)` ???
    kind regards, achim

  • Is there a way to perform a batch delete Azure Table rows given a PartitionKey in a Single Call

    Is there any Efficient way to Perform deletion on Multiple Azure Table rows in a Single Call if I know the PartitionKey ( and RowKeys) - other than designing for "deleting the whole table" ?
    There were many older threads which infers that there is no way other then issuing in a Batch of 100. I want to know the latest POR - Are there any plans to support this scenario in near future ?

    Hi Sir,
    >>Is there any Efficient way to Perform deletion on Multiple Azure Table rows in a Single Call if I know the PartitionKey ( and RowKeys) - other than designing for "deleting the whole table" ?
    Generally, the batch operation is the good choice for deleting the multiple entities . See this similar threads(http://social.msdn.microsoft.com/Forums/azure/en-US/c5cf03b0-2001-4b11-91ce-7888bfc2605e/efficient-delete-multiple-rows-by-partitionkey
    >>There were many older threads which infers that there is no way other then issuing in a Batch of 100. I want to know the latest POR - Are there any plans to support this scenario in near future ?
    Currently, the max number of Batch is 100 in one single request. I suggest you could submit a feature request via this page:
     http://www.mygreatwindowsazureidea.com/forums/34192-windows-azure-feature-voting.
    Regards,
    Will 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Unable to show all table rows

    Hi all.
    I created a query that return all the rows form a table.
    the number of rows in the table is 190.000 and I only see 65000.
    Is there a parameter to control that??
    Regards.

    Hi,
    I am also facing the same issue. I have added the same filter in instanceconfig. But my data volume is around 1 million rows. I changed the query limit filter in the RPD also . The query returns exact rows from database but the queries returned to client are only 3. could you please throw some light on this. Following is the query.
    -------------------- Query Status: Successful Completion
    CWilliams:98ba0000:98ba0008:----2009/11/10 09:41:30
    -------------------- Rows 927866, bytes 513483152 retrieved from database query id: <<61756148>>
    98ba0000:98ba0008:----2009/11/10 09:41:30
    -------------------- Physical query response time 671 (seconds), id <<61756148>>
    98ba0000:98ba0008:----2009/11/10 09:41:30
    -------------------- Physical Query Summary Stats: Number of physical queries 1, Cumulative time 671, DB-connect time 0 (seconds)
    98ba0000:98ba0008:----2009/11/10 09:41:30
    -------------------- Rows returned to Client 3

Maybe you are looking for

  • How to create the Table of Contents in Preview for a pdf file?

    Does anyone know how to use the Preview to create a new table of contents or add a new link to the existing table of contents? Thanks

  • My device does not automatticaly download and I have turned off I cloud

    I am signed into I tunes. I have my I phone connected, but my device does not show up. I had disabled  Icloud and still my device does not show up.  I am trying to sync my pictures to get my available space on my phone to allow more things to be done

  • Best way to connect z5400 to X-fi xtreme mu

    hello all?i have the z5400 logitech speakers and have connected it to my x-fi via? the yellow/green/black cables. i was wondering if there was a better way to do this. if so could you give a link of the cable i should buy?thanks in advance!

  • PannelTabbed auto height

    Hi, I have a pannelTabbed layout with 2 tabs, each tab has dynamic content that can change its height. I need to be able to size the pannelTabbed height automatically based on the content with out showing any scrollbars. I tried the property dimensio

  • Export option grayed out for some "unknown" reason.

    I have several clips I've downloaded from the net (mostly music videos), and some of them I can export into any type of file I like (such as iPod video), but some of them I can't export at all. Is there some kind of copyright protection embedded into