softDelete User Confirmation

Is there some way to disable the user confirmation on softDelete?

I'm modifying the CSV import script so that we can auto-generate requirements, and I need to be able to remove objects that are no longer present in the CSV file. I've got it working fine, but if there are a large number of deletions, the user is stuck clicking "Yes" way too much.
Matthew Dunn - Thu Dec 10 14:30:58 EST 2009

Re: softDelete User Confirmation
llandale - Thu Dec 10 18:40:08 EST 2009

Don't know about the import script, but I never get prompted when I softDelete and object, even with children with links. Perhaps send the section of code in question.

  • Louie

Re: softDelete User Confirmation
Matthew Dunn - Fri Dec 11 13:30:34 EST 2009

llandale - Thu Dec 10 18:40:08 EST 2009
Don't know about the import script, but I never get prompted when I softDelete and object, even with children with links. Perhaps send the section of code in question.

  • Louie

int lDeletedObj = 0
    Object lObject = null
    for lObject in mDeleteList do
    {
                if ( lObject != null )
                {             
                        if ( table( lObject ) )
                        {
                                deleteTable( lObject )
                        }
                        else if ( row( lObject ) )
                        {
                                deleteRow( lObject )
                        }
                        else if ( !cell( lObject ) )
                        {     
                                softDelete( lObject, true )
                        }
                        
                        lDeletedObj++
                }
        }

 


I'm not really doing anything special with it. mDeleteList is a Skip list with all the objects that should be deleted. The confirmation dialog says the following: "This may delete hidden objects are you sure?"

 

Re: softDelete User Confirmation
Matthew Dunn - Fri Dec 11 13:44:29 EST 2009

Matthew Dunn - Fri Dec 11 13:30:34 EST 2009

int lDeletedObj = 0
    Object lObject = null
    for lObject in mDeleteList do
    {
                if ( lObject != null )
                {             
                        if ( table( lObject ) )
                        {
                                deleteTable( lObject )
                        }
                        else if ( row( lObject ) )
                        {
                                deleteRow( lObject )
                        }
                        else if ( !cell( lObject ) )
                        {     
                                softDelete( lObject, true )
                        }
                        
                        lDeletedObj++
                }
        }

 


I'm not really doing anything special with it. mDeleteList is a Skip list with all the objects that should be deleted. The confirmation dialog says the following: "This may delete hidden objects are you sure?"

 

Of course, as soon as I post a reply, I figure out what I needed. The second parameter is what was causing the confirmation dialog I think. However, I couldn't get my method to work without it, until I realized I was trying to delete items that were already deleted (I had deleted the ancestors already). Here is my solution if anyone is interested:
 

int lDeletedObj = 0
    Object lObject = null
    for lObject in mDeleteList do
    {
                // We check if the object has been deleted, because it's possible that the object may have
                // already been deleted in a previous loop
                if ( ( lObject != null ) && !isDeleted( lObject ) )
                {     
                        if ( table( lObject ) )
                        {
                                deleteTable( lObject )
                        }
                        else if ( row( lObject ) )
                        {
                                deleteRow( lObject )
                        }
                        else
                        {
                                softDelete( lObject )
                        }
                }
                
                lDeletedObj++
        }

Re: softDelete User Confirmation
llandale - Fri Dec 11 16:43:17 EST 2009

Matthew Dunn - Fri Dec 11 13:44:29 EST 2009

Of course, as soon as I post a reply, I figure out what I needed. The second parameter is what was causing the confirmation dialog I think. However, I couldn't get my method to work without it, until I realized I was trying to delete items that were already deleted (I had deleted the ancestors already). Here is my solution if anyone is interested:
 

int lDeletedObj = 0
    Object lObject = null
    for lObject in mDeleteList do
    {
                // We check if the object has been deleted, because it's possible that the object may have
                // already been deleted in a previous loop
                if ( ( lObject != null ) && !isDeleted( lObject ) )
                {     
                        if ( table( lObject ) )
                        {
                                deleteTable( lObject )
                        }
                        else if ( row( lObject ) )
                        {
                                deleteRow( lObject )
                        }
                        else
                        {
                                softDelete( lObject )
                        }
                }
                
                lDeletedObj++
        }

This is the kind of advise I give best. Glad I could help. lol

  • Louie

Actually this really isn't unusual. Verbalizing your problem so that someone else can understand it often clarifies it better you your mind, letting you solve it for yourself. Its a good trouble shooting technique, just don't hit the Send button right away.

Re: softDelete User Confirmation
Mathias Mamsch - Fri Dec 11 18:03:20 EST 2009

Matthew Dunn - Fri Dec 11 13:30:34 EST 2009

int lDeletedObj = 0
    Object lObject = null
    for lObject in mDeleteList do
    {
                if ( lObject != null )
                {             
                        if ( table( lObject ) )
                        {
                                deleteTable( lObject )
                        }
                        else if ( row( lObject ) )
                        {
                                deleteRow( lObject )
                        }
                        else if ( !cell( lObject ) )
                        {     
                                softDelete( lObject, true )
                        }
                        
                        lDeletedObj++
                }
        }

 


I'm not really doing anything special with it. mDeleteList is a Skip list with all the objects that should be deleted. The confirmation dialog says the following: "This may delete hidden objects are you sure?"

 

Are you sure about your loop?

I don't know if you delete single cells (not just entire rows), but the code should fail, when you delete a single cell, since nothing happens in this case, except the deletion counter is increased.

So you might want to remove the "if (!cell lObject)" ...

Regards, Mathias

Re: softDelete User Confirmation
Mathias Mamsch - Fri Dec 11 18:04:36 EST 2009

Mathias Mamsch - Fri Dec 11 18:03:20 EST 2009
Are you sure about your loop?

I don't know if you delete single cells (not just entire rows), but the code should fail, when you delete a single cell, since nothing happens in this case, except the deletion counter is increased.

So you might want to remove the "if (!cell lObject)" ...

Regards, Mathias

Argh... did not see that you already corrected the mistake in the second post. Never mind!