submit the selected records

This public forum is for user-to-user discussions of ASPMaker. Note that this is not support forum.

submit the selected records

Postby lfernandes » Thu Nov 09, 2017 1:11 pm

When adding a custom action to send the records selected by HTTP POST using the following code:
' Page Load event
Sub Page_Load()
'Response.Write "Page Load"
Call ListActions.Add("excluir", "Excluir", True, EW_ACTION_POSTBACK, EW_ACTION_MULTIPLE, "Deseja exluir realmente os registros selecionados?", "glyphicon glyphicon-trash ewIcon")
End Sub
' Row Custom Action event
Function Row_CustomAction(action, rs)
' Return False to abort
if (action = "excluir") then
ew_Execute("UPDATE [TPPropostas] SET [IDStatus] = 7 WHERE [IDProposta]=" & rs("IDProposta"))
ew_Execute("UPDATE [TPPedidos] SET [IDStatus] = 7 WHERE [IDProposta]=" & rs("IDProposta"))
end if
Row_CustomAction = True
End Function

The problem is that the action occurs only on the first of the selected rows. How do I resolve for the action to occur for all selected records?

tks.
lfernandes
 
Posts: 28
Joined: Fri Nov 21, 2014 10:01 pm

Re: submit the selected records

Postby motfs » Fri Nov 10, 2017 6:21 pm

Try to modify the template file "list-script-function.asp" as follows (see the lines change marked with '***):

' Process list action
Function ProcessListAction()
...
' Load recordset
Dim Rs
Set Rs = ew_LoadRecordsetByDbid(sSql, <!--##=gsTblVar##-->.TableDBID)
If Not Rs.EOF Then Rs.MoveFirst

' Call row custom action event
SelectedCount = Rs.RecordCount
SelectedIndex = 0
Do While Not Rs.EOF
SelectedIndex = SelectedIndex + 1
'*** Set row = Rs.Clone

<!--## if (bUserTable && TABLE.TblName == PROJ.SecTbl) { ##-->
'*** user = row("<!--##=PROJ.SecLoginIDFld##-->")
user = Rs("<!--##=PROJ.SecLoginIDFld##-->") '***
If userlist <> "" Then
userlist = userlist & ","
End If
userlist = userlist & user
If UserAction = "resendregisteremail" Then
<!--## if (bResendRegisterEmail) { ##-->
'*** Processed = <!--##=gsTblVar##-->.SendRegisterEmail(row)
Processed = <!--##=gsTblVar##-->.SendRegisterEmail(Rs) '***
<!--## } else { ##-->
Processed = False
<!--## } ##-->
ElseIf UserAction = "resetconcurrentuser" Then
<!--## if (bResetConcurrentUser) { ##-->
Processed = UserProfile.ResetConcurrentUser(user)
<!--## } else { ##-->
Processed = False
<!--## } ##-->
ElseIf UserAction = "resetloginretry" Then
<!--## if (bResetLoginRetry) { ##-->
Processed = UserProfile.ResetLoginRetry(user)
<!--## } else { ##-->
Processed = False
<!--## } ##-->
ElseIf UserAction = "setpasswordexpired" Then
<!--## if (bSetPasswordExpired) { ##-->
Processed = UserProfile.SetPasswordExpired(user)
<!--## } else { ##-->
Processed = False
<!--## } ##-->
Else

<!--## if (SYS.ServerScriptExist("Table","Row_CustomAction")) { ##-->
'*** Processed = Row_CustomAction(UserAction, row)
Processed = Row_CustomAction(UserAction, Rs) '***

<!--## } else { ##-->
Processed = True
<!--## } ##-->
End If
<!--## } else { ##-->

<!--## if (SYS.ServerScriptExist("Table","Row_CustomAction")) { ##-->
'*** Processed = Row_CustomAction(UserAction, row)
Processed = Row_CustomAction(UserAction, Rs) '***
<!--## } else { ##-->
Processed = True
<!--## } ##-->

<!--## } ##-->
If Not Processed Then
Exit Do
End If
Rs.MoveNext
Loop
Rs.Close
Set Rs = Nothing

...

End Function
motfs
 
Posts: 710
Joined: Tue Sep 08, 2015 4:55 pm

Re: submit the selected records

Postby lfernandes » Sun Nov 12, 2017 12:10 am

Perfect!!!! Thanks for the help
lfernandes
 
Posts: 28
Joined: Fri Nov 21, 2014 10:01 pm


Return to General Discussion (ASPMaker)