I have a webpanel in which I select some data in an attempt to send it to a procedure that has as a rule 5 variables that should be sent from the webpanel, in the patterns and entity services part in a transaction that is associated with the webpanel I have created a button with the name of sending and when giving it f4 I have added a code in the event begin code, I have copied this code from the webpanel part because I have activated the multidelete in the transaction and I am using it as an example but I do not want to delete the records I only want to send the selected data to a procedure with the name Deletereceipt, would it be something like this how I should do it? this code gives error does not work for me
Event 'enviar'
Do 'LoadSelectedRows'
If K2BIsAuthorizedActivityName.Udp(!"PEMTN008", !"PEMTN008", K2BStandardActivityType.Delete, !"",!"")
If &SelectedRows.Count > 0
&ConfirmMessage = format('¿Está seguro que quiere eliminar %1 número de recibo procesados?', &SelectedRows.Count)
&ConfirmationSubId = !"Confirm_DoMultipleDelete"
TableConditionalConfirm.Visible = True
Else
msg("K2BT_NoRowsSelectedError")
EndIf
EndIf
EndEvent
Sub 'LoadSelectedRows'
&SelectedRows = new()
For Each line In Grid
If &Selected = True
&SelectedRow = new()
&SelectedRow.PemRenIde = PemRenIde
&SelectedRow.PemRenAnh = PemRenAnh
&SelectedRow.PemRenMes = PemRenMes
&SelectedRow.PemRenNro = PemRenNro
&SelectedRow.PemRenNdc = PemRenNdc
&SelectedRow.PemRenLot = PemRenLot
&SelectedRow.PemRenBen = PemRenBen
&SelectedRow.PemRenLel = PemRenLel
&SelectedRow.PemRenBel = PemRenBel
&SelectedRows.Add(&SelectedRow)
EndIf
EndFor
EndSub
Sub 'Confirm_DoMultipleDelete'
Do 'LoadSelectedRows'
If K2BIsAuthorizedActivityName.Udp(!"PEMTN008", !"PEMTN008", K2BStandardActivityType.Delete, !"",!"")
If &SelectedRows.Count > 0
// Code added in [MultipleDelete.BeginCode] --- START
&DeletedCount = 0
&ErrorCount = 0
For &SelectedRow in &SelectedRows
&MultipleDelete_BC.Load(&SelectedRow.PemRenIde)
//&MultipleDelete_BC.Delete()
&MultipleDelete_BC = Eliminarrecibo.Udp(PemRenAnh,PemRenMes, PemRenLot.ToString(), PemRenNdc.ToString(), PemRenIde)
If &MultipleDelete_BC.Success()
&DeletedCount += 1
Else
&ErrorCount += 1
&ErrorMessage = format('Número de recibo procesado "%1" no pudo ser eliminado por causa de estos errores:', &MultipleDelete_BC.PemRenLot)
For &Message in &MultipleDelete_BC.GetMessages()
&ErrorMessage += newline() + " - " + &Message.Description
EndFor
msg(&ErrorMessage)
EndIf
EndFor
If &ErrorCount > 0
Rollback
msg('Ningún Número de recibo procesado fue eliminado')
Else
Commit
msg(format('%1 número de recibo procesados eliminados', &DeletedCount))
EndIf
Grid.Refresh()
// Code added in [MultipleDelete.BeginCode] --- END
Else
msg("K2BT_NoRowsSelectedError")
EndIf
EndIf
EndSub
Well, this code gives an error when compiling, I think it should not be in the event begin code
error src0062: Expecting 'EndSub' command to close subroutine definition. (Web Panel 'PEMTN008WW' Events, Line: 197, Char: 1, Details)
error src0051: Unexpected expression (Web Panel 'PEMTN008WW' Events, Line: 240, Char: 57, Details)
error: Supported grammar:FOR <variable> IN <array|collection>
You could use the Row Selection property of the action and set it to Multiple , this will create a &SelectedRows variable collection of another &SelectedRow variable, in these will be the information you have in the grid of those who were selected.
Then in the event:
This would call the process for each selected with the values corresponding to each row.