Script to remove row if a cell is blank

Hello,
Im trying to find a script that will remove a row (shifting subsequent rows up) if one of the cells in the row (there are 2 columns) is blank.
Im creating table based docs using datamerge and there are rows with dataheadings (in column 2) and the datavalues (in column 1) for the rows are imported via the merge. Not every heading has a value so I want a script to remove the rows where no value is present.
I have found scripts that work however due to the end text # markers that are left after the merge I think they see the cell as being populated.
Thanks for you help

@Angus – do you need the markers?
If not, do a TEXT Search/Replace and remove them (replace by nothing).
The code you should enter for the search would be:
<FEFF>
Then run your script.
Uwe

Similar Messages

  • Conditional Formating a row if a cell is blank

    How to Color an entire row if a particular cell in the row is blank ??

    If you don't want extra rows in your table and just want a clean, two-click solution, then AppleScript is good at conditional coloring of rows.
    Here, a script colors rows whose column C (column 3) is blank, like this:
    a
    b
    c
    d
    1
    2
    4
    1
    3
    4
    a
    b
    d
    1
    3
    4
    This is the script:
    property startRow : 2 -- to skip a header row
    property columnToTest : 3 --column C, change as needed, 2 for B, 4 for D, etc.
    property highlightColor : "red"
    tell application "Numbers"
      try
      set t to front document's active sheet's first table whose selection range's class is range
      tell t to repeat with r from startRow to row count
        set v to row r's cells's value
        if v's item columnToTest is missing value then
          set row r's background color to highlightColor
        end if
      end repeat
      end try
    end tell
    To use it all that is needed is:
    Copy and paste into AppleScript Editor
    Click once anywhere in the table (to tell the script what table you mean)
    Click the green triangle 'Run' button.
    (Change color and column as desired in properties.)
    That's all it takes!
    SG

  • UDO: Add and Remove rows to/from Matrix.

    Hi all,
    Yes, I know there are lots of topics about adding and removing rows but I was having trouble with these and I need some expert's opinion.
    I'm working with a Document type UDO, with 1 header table (ADAT_ONR) and 1 child table (ADAT_NR1 -  MatrixUID = "mtx_NR").
    I add the first row when the user chooses the business partner.
    If oMatrix.RowCount = 0 Then
         oMatrix.AddRow()
          oMatrix.AutoResizeColumns()
         oMatrix.Columns.Item("V_LineId").Cells.Item(1).Specific.Value = 1
    End If
    Then, the user has to press the AddRow button to add new rows, and the user can only add 1 new blank row. Later I'll change the row adding behavior to mimic B1s.
                If pVal.BeforeAction = False Then
                    Select Case pVal.ItemUID
                        Case "AddRow"
                            'ItemHandler_Click = AddRow(oCompany, oApplication, oForm, oForm.Items.Item("mtx_NR").Specific.RowCount())
                            oMatrix = oForm.Items.Item("mtx_NR").Specific
                            If oMatrix.RowCount > 0 Then
                                If Trim(oMatrix.Columns.Item("V_PltCode").Cells.Item(oMatrix.RowCount).Specific.Value) = "" Then
                                    oApplication.StatusBar.SetText(TranslateStr(oApplication, MustChoosePallet), BoMessageTime.bmt_Short)
                                    Exit Function
                                End If
                            End If
                            ItemHandler_Click = NewLine(oCompany, oApplication, oForm)
                            Exit Function
        Private Function NewLine(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application, _
            ByRef oForm As SAPbouiCOM.Form) As Boolean
            NewLine = False
            Try
                oMatrix = oForm.Items.Item("mtx_NR").Specific
                Dim Index As Integer = oMatrix.RowCount
                With oForm.DataSources.DBDataSources.Item("@ADAT_NR1")
                    .Clear()
                End With
                oMatrix.AddRow()
                oMatrix.Columns.Item("V_LineId").Cells.Item(Index + 1).Specific.Value = (Index + 1).ToString
                oMatrix.FlushToDataSource()
                oMatrix.LoadFromDataSource()
                oForm.Refresh()
                NewLine = True
            Catch ex As Exception
                oApplication.MessageBox("NewLine(): " & oCompany.GetLastErrorCode.ToString & ", " & ex.Message)
            End Try
        End Function
    When I Add or Update the data, I clear the last blank row, if it exists.
               '// In the Click Event
               If pVal.BeforeAction = True Then
                    Select Case pVal.ItemUID
                        Case "1"
                            If oForm.Mode <> BoFormMode.fm_FIND_MODE Then
                                oMatrix = oForm.Items.Item("mtx_NR").Specific
                                oMatrix.FlushToDataSource()
                                oMatrix.LoadFromDataSource()
                                If Trim(oMatrix.Columns.Item("V_PltCode").Cells.Item(oMatrix.RowCount).Specific.Value) = "" Then
                                    oForm.DataSources.DBDataSources.Item("@ADAT_NR1").RemoveRecord(oMatrix.RowCount - 1)
                                    oMatrix.DeleteRow(oMatrix.RowCount)
                                    'oMatrix.FlushToDataSource()
                                End If
                            End If
                    End Select
    My question is, Is there an easier way to Add and Delete Rows??
    BTW, I still have a problem so solve. With this code, when the user deletes a row the row numbering is incorrect. Example: if I have to rows in a matrix and I delete row nº1, row nº2 will hold the same number...
    Any Ideas?
    Thanks in advanced,
    Vítor Vieira

    Hi Victor,
    there is a Form Data event which you ca use in that try to write the code for adding a row after updating and delete a row while inserting and add a row while traversing.
    sample code.
    Sub FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean)
            Try
                Select Case BusinessObjectInfo.EventType
                    Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD, SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE
                        If BusinessObjectInfo.BeforeAction = True Then
                            objForm = objMain.objApplication.Forms.Item(BusinessObjectInfo.FormUID)
                            oDBs_Head = objForm.DataSources.DBDataSources.Item("@Header")
                            oDBs_Detail= objForm.DataSources.DBDataSources.Item("@Line")
                            objMatrix = objForm.Items.Item("83").Specific
                            If objMatrix.VisualRowCount <> 0 Then
                                objMatrix.DeleteRow(objMatrix.VisualRowCount)
                                objMatrix.FlushToDataSource()
                            End If
                            If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then
                                End If
                        ElseIf BusinessObjectInfo.ActionSuccess = True Then
                            objForm = objMain.objApplication.Forms.Item(BusinessObjectInfo.FormUID)
                            If BusinessObjectInfo.EventType =                    SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE Then
                                objMatrix = objForm.Items.Item("83").Specific
                                objMatrix.AddRow()
                                SetNewLineCharge(objForm.UniqueID, objMatrix.VisualRowCount)
                                objMatrix.FlushToDataSource()
                              End If
                        End If
                    Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD
                        If BusinessObjectInfo.ActionSuccess = True Then
                            oDBs_Head = objForm.DataSources.DBDataSources.Item("@Header")
                           oDBs_Detail = objForm.DataSources.DBDataSources.Item("@Line")
                            objMatrix = objForm.Items.Item("83").Specific
                            objMatrix.AddRow()
                            SetNewLineCharge(objForm.UniqueID, objMatrix.VisualRowCount)
                            objMatrix.FlushToDataSource()
                           End If
                End Select
                End Sub
    Hope this helps,
    OM Prakash

  • Need Script to remove unused elements...

    anyone know of a script to remove:
    all unused paragraph styles
    all unused character styles
    all unused swatches
    all unused table styles
    all unused cell styles
    all unused object styles
    all unused master pages
    Please let me know

    Can you not tag along a running discussion with a totally different subject?
    Please keep the forum tidy and use the Start a discussion link to start a new discussion. It also helps to enter a descriptive title; "please help me" is not one.

  • Temparally remove rows from a ADF table by action event of a jsf page.

    Hello Developers,
    I needed to temporally remove rows of a ADF table when execute action event of corresponding page.
    So in this case my task can describe by following steps,
    (1). I created a ADF table using <af:table> on a jsf page.
    (2). The data populated using a VO.
    (3). Several radio buttons added to the page for temporally remove rows from the table.
    This means one radio button check, it responsible to temporally remove rows which contain empty cell values of a identified column.
    If I check another radio button it should temporally remove identified data included rows but above removed (empty cell included rows) rows should appear in this event
    My ultimate target is temporally remove rows of a table & re call again removed rows another event without again & again query from BC.
    Pleas advice me to archive this task very sealy?
    (Are there have a way to do this using EL or coding in Manage bean ?)
    Thanks in advance..!

    Hi,
    the DCIterator gives you an option to iterate over the fetched rows (the ones you see in the table). You can try call removeAndRetain() on these rows. This will not remove or delete rows but allows you to insert these rows back to the collection.
    JavaDocs:
    * Removes the row from the collection and then retain it for insertion
    * into another location.
    * <p>
    * This method differs from <code>{@link #remove()}</code> in that
    * it just removes the row from the collection. It does not
    * remove the underlying Entity row(s) or database row(s).
    * <p>
    * This method also differs from <code>{@link #removeFromCollection()}</code>
    * in that after the row is removed from the collection, it can be inserted
    * back into the collection at another location.
    void removeAndRetain();
    Frank

  • ADOBE Forms Central - add and remove rows (PDF Form)

    Hello, I am currently evaluating ‘ADOBE Forms Central' to set up a form with editable fields. I have set up a test form in ADOBE Forms Central and was unable to insert an option to add and remove rows similar to the print screen attached. Is this possible to do using ADOBE Forms Central or should I be using
    a different ADOBE application? Thank you, Liz

    A dynamic XFA PDF form can do this. You can create such forms with LiveCycle Designer, which was included with the Windows version of Acrobat Pro prior to version 11. It is now a separate product.
    XFA forms can't be used with FormsCentral, however, only Acroforms can.

  • Update Symbol and Symbol Script without removing from Document library

    Is there a way in fireworks CS5.1 to update a symbol and the corresponding symbol script without removing it from the document library like it suggests in the below article
    http://www.adobe.com/designcenter/fireworks/articles/frwcs3_richsymbol_print.html

    I have done some more research on this question and there appears to be no way to update a symbol script without removing it from the document library, hopefully this bug will be patched in the near future

  • Number of rows inside a cell in table

    Hie all,
              I have a requirement in that I have to create the number of rows inside the cell of table. I did it using the subforms as a body page of a row.
    but facing problems when you have number of rows such as data truncation and overlapping of rows..
    Please help.

    Hi,
    You can also create table inside the cell of the column by following steps:
    1.Select the Cell of the Column in table.
    2.Go to Table -->Insert-->and choose as per your requirement(You can adjust the row ans column as per your requirement).
    3. Go to Pallette-->Border and hide the border if not required.
    This is will not create problem of overlapping or truncation.
    Regards,
    Shweta

  • Adding/removing rows in TABLEVIEW

    Hi. I've got a TABLEVIEW in one of my subscreens. But when load itab into that tableview with 'LOOP AT...'  tableview appears but I can't add rows to it. I can't delete existing rows too. What should I add to my programm to have possibility of adding/removing rows from my tablewiev? Greetings. P.

    Hi Friend,
    To add/delete rows in your table view.
    You have to add/delete rows from internal table fro where you are displaying values.
    You have to write code in PAI..
    In LOOP ... ENDLOOP check the OK_CODE if it is ADD (for eg.) you have to add a blank row to internal table by just passing a blank work area.
    And if it is DELETE (for eg.) delete the row of that index (TABLEVIEW-CURRENT_LINE)...
    for these two excersies you have to readjust lines of tableview...after taking number of lines from internal table (DESCRIBE TABLE INT_EX LINES WS_LINES
    TABLEVIEW-LINES = WS_LINES) write this piece of code in Intialization.
    Hope it will solve the problem.
    Regards
    Krishnendu

  • How to hide rows with merged cells?

    I would like to know how to hide rows on numbers with merged cells, could do it normally at excel but I am not being able to do it at Numbers.
    thanks!

    Felipe,
    To hide a row with Merged Cells, Un-Merge first, then Hide. Select the Merged Cells and Table > Unmerge.
    Note that this is only a problem with vertically merged cells when you want to Hide a Row.
    If you want to Hide a Column, you can't have a Horizontal Merge that involves that Column.
    Jerry

  • How DB adapter works when polling strategy is "remove row selected"?

    How DB adapter works when polling strategy is "delete the rows that were read"?
    I want to know how database adapter works when polling startegy is "remove row".This polling strategy helps for polling the changes to table and remove records after new records are inserted or changes are done to table.Here,i want to understand how DB adapter identifies which record to be deleted.
    For example: there is a table with 100 recorrds.How DB adapter works when polling strategy is "delete the rows that were read"?
    I want to know how database adapter works when polling startegy is "delete the rows that were read".This polling strategy helps for polling the changes to table and remove records after new records are inserted or changes are done to table.Here,i want to understand how DB adapter identifies which record to be deleted.
    For example:
    There is a table EMP with 100 recorrds.Now, i deploy a BPEl process with db adapter polling on table EMP for changes.So that ,if any change happen to records in table that records will be picked up.I use a polling startegy "delete the rows that were read" .
    Now i insert 9 new records and update one existing records.These 10 records should be picked up and then deleted by Db adapter.In this 109 records how DB adapter identifies these 10 records when it polls.How it differentiatess old records with new records when there is no flag field or no sequence id used to identify the new or modified records.
    Please let me know.
    Why i want to know this?
    Some times customer may not allow BPEL process to do any modifications to source table or source database.In this case the options provided by database adapter wizard are not useful.
    If there is any mechanism to identify new or modified records without having a FLAG field or sequence table,then it is possible to have an option like only read the changes from table rather than deleting the records after reading.Which helps in meeting above requirement.
    Please let me know if there is any way to do this.
    thanks
    Arureddy

    Once the record has been read it is deleted. Therefore, you can update rows in this table as many times you like before it is read. Once it is read there will be nothing to update as it will be deleted.
    If you don't want to use a sequence table, you can use a sequence file. You can only use this functionality if the key you are using increments sequentially. e.g. 1,2,3,4. If your key is random, e.g. 2,1,3,5,7,4 then your options are delete or use a processing flag.
    The other option is to create a trigger that inserts a key into a polling table when insert or updates occur. You can then use the delete, which is the most desirable as it uses database locking.
    cheers
    James

  • Import script to remove zeros in Account field

    Dear FDM Experts,
    The problem is our source system always extracts 10 characters but we use 7 characters in HFM.
    Example, Account 0001201010 (10 characters) must be 1201010 (7 characters).
    I want to write an Import Script to remove, if any, all zeros from the left side of the account value at the import stage. We have no Accounts beginning with 0.
    Thanks in advance for your help,
    Carsten

    Thanks! But I got an error message:
    ** Begin FDM Runtime Error Log Entry [2012-04-17-13:24:10] **
    ERROR:
    Code............................................. 13
    Description...................................... Type mismatch: 'FormatNumber'
    At line: 14
    Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
    Component........................................ upsWObjectsDM
    Version.......................................... 1111
    Thread........................................... 2164
    Could you provide me with the full script?

  • A simple script that removes older packages from cache dir

    Hello all,
    I wrote a small bash script that removes packages (from cachedir /var/cache/pacman/pkg), older than the ones available in repositories (eg. if the current version of pacman is 2.6.3, it will remove pacman-2.6.2 from cachedir). It implements the functionality of debian's 'apt-get autoclean'.
    Get it from http://www.kegep.tuc.gr/~manolis/archlinux/cleanold.sh.

    thanks a lot for sharing this 

  • How to remove all columns and cells in numbers

    how to remove all columns and cells in numbers

    Click on the Table's icon in the Sheets list. Press delete.
    Done.
    Regards,
    Barry

  • Problem with a script to remove graphics

    Hello,
    I have tried to build a javascript to remove all graphics whose extension is not ".EPS" (with "EPS" really in upper cases, as it is for Mathtype equations in Word import).
    But It doesn't work and I can't understand why.
    Here is the script:
    //The script intend to remove all graphics whose extension is not ".EPS"
    var myDoc = app.activeDocument;
    var myGraphics = myDoc.allGraphics
    //Remove graphic if graphic extension is different from ".EPS"
    for (var p = 0; p < myGraphics.length; p++) {
        var myImage = myGraphics[p]
        if (CheckExtEps(myImage) != 0){
        myImage.remove ()
    //Compare graphic extension with ".EPS" and return myExtValue = 0 if it matches exactly
    function CheckExtEps(myImage) {
        var  myString = myImage.name
        myExt = myString.substr(myString.lastIndexOf( "." ))
        myExtValue = myExt.localeCompare(".EPS")
        return myExtValue
    When I run this script, ALL the graphics are removed, ".EPS" included.
    I do have ".EPS" graphics in my document and I expected them not to be removed.
    So there is something wrong somewhere, but I don't know what to change.
    Any ideas?
    By the way, I have a more generic question as a beginner:
    I am working with ExtendScript Toolkit. How can I do to check my script step by step?
    For exemple, how can I display my variables values as "myString", "myExt", "myExtValue" at each step?
    Actually, this script is a step for a bigger script I intend to build to deal with Mathtype equations in Word import.
    After not-EPS graphics beeing removed, I wish to relink all remaining equation prewiews to eps in a selected folder, by consecutive order.
    But this is a big piece of scripting to swallow for me, so I'm working slowly, step by step.
    TIA
    Best regards
    Nicolas

    Hello Ariel
    Thank you very much for your help.
    1. I added semicolons at the end of lines, but the script result is the same.
    2. Running line by line, I could see in the Console where is the problem:
    variable "myString" is always undefined.
    Well, I have to get more inside my script...
    Thank's again
    Best regards
    Nicolas
    Nicolas BALBO  
    [email protected]
    22, rue d'Hauteville  75010 PARIS
    Tel : 33 (0)1 42 57 14 31
    Le 18 avr. 2012 à 17:36, Arïel a écrit :
    Re: Problem with a script to remove graphics
    created by Arïel in InDesign Scripting - View the full discussion
    Well, I can't see any semicolons in your script. Maybe that's just the
    email interface, but there should be semicolons at the ends of lines.
    In the ESTK, you can step through a script a line at a time. Just click
    on the downwards pointing arrow instead of the "play" arrow. Each time
    you click, the script will advance one line. In the Console window
    (Windw>Console) you can then type the name of the variable you wish to
    examine.
    Ariel
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4344039#4344039
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4344039#4344039. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in InDesign Scripting by email or at Adobe Forums
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

Maybe you are looking for