Function AddIndexTransaction(Table, Column, OldRow, NewRow, RowId)

* Function from Sprezzatura's SENL for adding index transaction from a program

DECLARE SUBROUTINE FSMsg

TransactionRow = ""

SaveRec = @Record
SaveDict = @Dict
SaveId = @Id

Open "DICT." : Table To @Dict Then

	@Id		= RowId
	@Record	= OldRow

	If Num(Column) Then
		OldValue = @Record<Column>
	End Else
		OldValue = Calculate(Column)
	End

	@Record = NewRow

	If Num(Column) Then
		NewValue = @Record<Column>
	End Else
		NewValue = Calculate(Column)
	End

	TransactionRow := Column : @Fm : RowId : @fm : OldValue : @Fm : NewValue : @Fm

	Open "!" : Table To vTable Then

		Lock vTable, 0 Then

			Read Update From vTable, 0 Else Update = @Fm
			Update := TransactionRow
			Write Update On vTable, 0 Then
				Status = 1
			End Else
				Status = 0
			End
			Unlock vTable, 0 Else FSMsg()
		End Else
			Status = 0
		End
	End Else
		Status = 0
	End
End Else
	Status = 0
End

@Id = SaveId
@Dict = SaveDict
@Record = SaveRecord

Return Status

