5 Replies Latest reply on Aug 26, 2009 9:06 AM by philmodjunk

    Deleting blank fields

    TreeStar

      Title

      Deleting blank fields

      Post

      FileMaker Pro v8

      I want to remove the blank fields all at once from this record. I can move the individual contents, but when I click 'Done' it reverts back to having 3 empty lines!

       

       Licenses

       

       

      I tried setting the 'slide' function, but it didn't do a thing. any ideas? Thank you!

        • 1. Re: Deleting blank fields
          philmodjunk
            

          It "looks" like you are trying to delete rows from a portal here. In order to delete a portal row, you have to be able to select the row and the portal itself must be configured to permit deleting portal rows.

           

          Enter layout mode, double-click the portal and make sure "allow deleting of portal records" is selected.

          While still in layout mode, resize either the portal or one of the portal fields so a small portion of the portal row is not covered by a field.

          Return to browse mode.

          Click this small "background" portion of the portal row. You should see the entire portal row highlight to show you've selected it.

          Now choose "delete record" from the records menu.

           

          You should get a message: "Permanently delete this one related record". Click delete to delete the portal row record.

           

          An alternate method is to switch to a layout based on the portal records. Then find and delete the blank records there.

          • 2. Re: Deleting blank fields
            ninja
              

            Howdy,

             

            What might be even safer (considering that there may be info in the records that isn't in the portal view) is to go to a layout based on the "portaled" table and view the blank records themselves to verify that they really should be deleted.

             

            You can then delete them with "Delete Record".  I would always opt to do orphan culling from the table in which the orphans reside...perhaps just my preference...but it seems safer overall to verify that the whole record is indeed blank.

             

            JMO

             

            'Kay,  I didn't read Phil's last line, he had already said the same thing.  {note to self: read more, type less, repeat...}

            • 3. Re: Deleting blank fields
              philmodjunk
                

              Ninja,

               

              I've done that thing a time or too myself, but you make a good point about the safety factor in deleting from a portal row. Ultimately, the best method depends on your database design. If all the fields in your portal record are visible in the portal, then deleting directly from the portal can be a simple, safe operation. If you just see a subset of the total fields, then switching to a different layout may be a much better option.

               

              In cases where I permit portal row deletes, I dress things up a bit to minimize user confusion and/or mistakes:

               

              I put a small, square button with "D" as the button text inside the portal row to the right of the last field.

              I attach a a script:

              IF [not isempty(PortalTO:: PortalKeyField)]

                Set Variable [$Row; Get ( PortalRowNumber )]

                Go to Portal Row [Select; $Row]

                Show Custom Dialog ["Confirm Delete"; "Delete Row #" & $Row & ":  " & //list a field or two from the portal]

                If [ get ( lastmessagechoice ) = 1 /* User clicked "Yes" */]

                   Delete Portal Row [No Dialog]

                End IF

              End If

               

              Il add a tool tip with a similar expression to what I used in the above custom dialog (but without the row number variable) to the button and if the portal relationship permits adding new records, I'll use IsEmpty(PortalTO:: PortalKeyField) in a conditional format expression to change the "D" to a shade of grey to give the field a "disabled" look when it's on the last row of the portal.

              • 4. Re: Deleting blank fields
                ninja
                  

                Howdy phil,

                 

                A curiosity on your script...(and here I am posting a sort-of new topic in a solved thread...shame on me)

                 

                If the "D" button is wholly within the portal row, is it really necessary to trap the PortalRowNumber and then go to the portal row?  I do a similar thing for the more 'trusted' users, but without the custom dialog (click and kill).  In these cases, I simply have the button as DeletePortalRow.  After the first couple of weeks after launching, everyone starts blindly hitting "OK" anyway...humans, whatcha gonna do?

                 

                I guess my question is: Would your script with the custom dialog work the same if you simply left out the SetVariable and GoToPortalRow steps?  I guess I'll have to mock that up and try it.

                • 5. Re: Deleting blank fields
                  philmodjunk
                    

                  "I guess my question is: Would your script with the custom dialog work the same if you simply left out the SetVariable and GoToPortalRow steps?  I guess I'll have to mock that up and try it."

                  Good question and I should have added some comments explaining that. The steps are not strictly necessary. The Go to portal row highlights the portal row to help the user see which row is going to be deleted. It's kind of "belt and suspenders" interface design. With my script, the user sees the row highlight, gets a custom dialog that lists row # and data from the row--both tricks are to help the user identify which portal record will be deleted if they confirm the deletion.