empty custom fields are not working
PHPMaker v2020 allows you to dda blank custom field as usual and sets the expression as ‘’
However when adding a record to a table containg am empty sustom field you get the following error:Failed to execute SQL. Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘’ at line 1 (1064)
Note that Custom Fields will not be inserted or updated, it may be due to some be something else in your table. You may click Tools → Advanced Settings, enable Debug, generate the ewcfg.php again and run your scripts again, check the full error message.
The next question is, what is the purposes you add/include that Custom Field in your Add Page/Form? Can you post the real example of your case?
I’m using custom fields to display some results of sums based on lookups relating to each record.
The required expressions use ExecuteScalar and similar and contain variables which I can’t use in the field’s expression value.Instead I’m using Row_Rendered to define the expressions.
this for example:// Row Rendered event
function Row_Rendered() {
// To view properties of field class, use:
//var_dump($this->);
$GetAppts = ExecuteHtml("SELECT Appointment, NoShow FROM Students_Further_Study_Appointments WHERE Students_Further_Study_Appointments.fk_StudyID=".$this->id->CurrentValue);
$this->Appointments->ViewValue = $GetAppts;
}
Since you are using the Custom Fields only for displaying the values in List Page, then you should not include that Custom Fields in your Add Page and/or Edit Page.
I tested your code using the demo project, e.g. in the orderdetails table,
// Row Rendered event
function Row_Rendered() {
$this->SubTotal->ViewValue = ExecuteHtml("SELECT ID, Trademark from cars where ID = 1");
}
It works properly when you add a new record. The event is not even fired when you add. Therefore,arbei wrote:
Note that Custom Fields will not be inserted or updated, it may be due to some be something else in your table. You may click Tools → Advanced Settings, enable Debug, generate the ewcfg.php again and run your scripts again, check the full error message.You may also check your other server events which may execute a SQL.
Thanks. I’ll try debug