create Row_CustomAction with where query

hello
i have a case with row_customaction
page_load:
if(CurrentUserLevel() == 1){
$this->CustomActions[“check”]= new ListAction(“check”, “APPROVE”, IsLoggedIn(),
ACTION_POSTBACK, ACTION_MULTIPLE, “Apakah Benar akan Approve?”,
“fa fa-check ew-icon”);
}
else if(CurrentUserLevel() == 2){
$this->CustomActions[“send”]= new ListAction(“send”, “SEND”, IsLoggedIn(),
ACTION_POSTBACK, ACTION_MULTIPLE, “Apakah Benar akan Mengirim Report Keatasan ?”,
“fa fa-check ew-icon”);
}
Row_CustomAction:

if ($action == “send”) { // Check action name
//$myRow = ExecuteRow(“SELECT * FROM MyTable WHERE XXX”);
$rsnew = [“status” => “send”,“aktorsend” => “.CurrentUserName().”]; // Array of field(s) to be updated
$result = $this->update($rsnew, “id = $row[id]”); // Update the current record only (the second argument is WHERE clause for UPDATE statement)
if (!$result) { // Failure
$this->setFailureMessage("Failed to update record, id = " . $row[“id”]);
return FALSE; // Abort and rollback
} elseif ($this->SelectedIndex == $this->SelectedCount) { // Last row
$this->setSuccessMessage(“Berhasil Mengirim Keatasan.”);
}
return TRUE;

}


I want to add logic to the condition if the field >= 40 then
$ rsnew = [“status” => “send”, “aktorsend” => “.CurrentUserName ().”];
if not
$ rsnew = [“status” => “reject”, “aktorsend” => “.CurrentUserName ().”];

apakah menggunakan query:
$myRow = ExecuteRow(“SELECT filed FROM MyTable WHERE ??”);


I’m confused where to do the query?
thank you

newbiephp wrote:

I want to add logic to the condition if the field >= 40 then
$ rsnew = [“status” => “send”, “aktorsend” => “.CurrentUserName ().”];
if not
$ rsnew = [“status” => “reject”, “aktorsend” => “.CurrentUserName ().”];

Wrong syntax: “.CurrentUserName ().”

To add your condition you just use:

$status = (xxx >= 40) ? “send” : “reject”;

no, I want 2 field updates at once, with status updates and field updates on the send actor.
How do I use the syntac 2019 phpmaker.
thanks for help

Then you need to write your own UPDATE statement. If you use MySQL, you can use CASE to set a field to different value, read: https://dev.mysql.com/doc/refman/5.7/en/case.html.