delete record in grid

James

Member
Well, the most straightforward way is using the grid toolbar. Select the record and tap the red x icon.

If you don't want the toolbar displayed, you have to make a control bound from a field in the grid with unique values. Then use form logic to run a delete SQL query using the control either when the control changes value or on some other trigger like tapping a button.
 

OliverR

Member
Hi Elie,

I've experimented a bit and managed to achieve this through form logic with a SQL DELETE command. However, the deleted record is not removed from the grid, and even refreshing the grid control by means of a button does not seem to do this. So I do not think that this is a desirable method for you to use, but maybe it will give you an idea. I've attached a .tpe file to this post.

Basically, when clicking on a record in the grid, the record information will be filled in in the bound fields. I've added a Form Logic rule that executes a DELETE statement when the value of the bound field is changed. It's very basic actually.

EDIT: Ah, I see James had the same idea as me. He posted while I was writing this post :)
 

Attachments

James

Member
I had a similar problem with grids before. The refresh bug you discovered prompted my first forum post. :) It looks like refreshing grids involves a race condition because sometimes, just sometimes, the grid would refresh properly. Using the page back button on the first page of the grid forces it to refresh.
 

Jeff Benefiel

New Member
Here is a work around. I add a form logic for the control "OnClick" to "Click" another button control that does the Button Action "DBNewRecord" after the "ExecuteSQL" action. This will refresh the Grid.
 

Jeff Benefiel

New Member
Solution for new brick wall:
1. Create new session for saving info for later restoring.
a. I have 6 fields: var, s1, S2, S3, S4, S5. Var is for knowing what to restore later. S1-5 for saved data from fields.
b. Insert "FT" into Var for use later in new Session (From {19} and To {21} Fields)
2. In my case 2 fields were getting cleared, which are one after the other in the so called Tab Order.
a. Using the second field LostFocus event and that both are filled in ExexcuteSQL
Code:
UPDATE Session4 Set Field2='[*4*]',Field3='[*6*]' WHERE Field1='FT'
b. Add (2) OnClick events to DBNewRecord button to restore the 2 fields that just got cleared by DBNewRecord command using "FT" (Var) to know which needs to be restored.
ExecuteSQL on control 19
Code:
SELECT Field2 FROM Session4 WHERE Field1='FT'
ExecuteSQL on control 21
Code:
SELECT Field3 FROM Session4 WHERE Field1='FT'
 
Top