Skip to main content

Any pointers on how to achieve this?

 

I have 2x Editable Lists (which have the Add, Delete, Edit, Save, Rereesh buttons etc)

 

In Editable List 1 I have 2 fields:Building Name and BuildingID

In Editable List 2 I have 3 fields:Room Name, RoomID and BuildingID

 

In Editable List 1, I display the Building Names. So when a user clicks the Delete Toolbar, I only want them to be able to delete that Building Name if there are NO underlying rooms with the same Building ID in List 2. If there are rooms still present with that Building ID, then put a message on screen saying "you can't delete this building until all Rooms within that Building have been removed" and DO NOT delete the Building from the smartobject.

 

How do i accomplish this? Is there a rule I can put under "If Delete Toolbar Button is clicked" to do this check?

 

Thanks,

Dear ,

 

U can achieve that by doin the following ,

Add data label into Editable list 1 , 

then on list item click , Execute a smartobject method Get list , execute SMO that is used in Editable list 2 , 

make sure u add a filter , ID (From editable list one) = Building ID from Editable list 2 SMO ,

and return the ID into the data label , 

 

When the user tries to action "delete" button  , 

u need to check , if the data label is empty or equals to 0 , Proceed >> Delete the record because it means it has no childs in the editable list 2,

else if data label >0 , which means that ur SMO get list method returned an ID , that means the record has child record , then execute show msg "u cant delete it"

 

Note : Make sure if ur succeed condition applies and deletion applies , to transfer data to the data label =0 , to make it empty again for the second try for deletion .

 

Hope it helps!

Regards.


Hi Ahmad,

 

Just tried your idea and it works great... However one slight issue.

 

On the view, when i click an item and click delete. it comes up with message saying "you can't delete campus etc etc" and then transfers the 0 to the data label.

 

But because the row IS STILL selected, it then allows you to delete it because we transferred 0.

 

Is there any way of removing the focus from the selected item so that the user is forced to select an item again (and thus enforcing the Item Click rule)???

 

Great step by step, by the way!!


Dear , 

 

This solution might sound weird , but this is the only one that worked for me to unfocus a record ,

ur items are already saved in the DB , so try the following steps ,

 

after u click on delete , in the condition where the msg shows up , add 2 rules after it ,

-remove selected row <-- this will only delete the row as visual list , it wont delete the record from the DB ,

-execute view method List Refresh , <-- this will then reload the data , and the deleted row will come back but unselected (unfocused)

 

Hope it helps!

Regards.


Ahmad,

 

Your hack worked great, it's a great workaround.

Have some kudos bro...


Reply