Error in Filter on Lookup Table - Undefined constant DATATYPE_STRING

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
dquinlan
User
Posts: 38

Error in Filter on Lookup Table - Undefined constant DATATYPE_STRING

Post by dquinlan »

I have a table called Responses with a field names of UniversityName and Location. I wish to edit the reords and update Location based on a table called Locations. The lookup table has a field called University that I wish to use to filter the dropdown values. UniversityName in Responses, and University in Locations are both VarChar, and have string values such as 'University of Tasmania'
Following the documentation I set a filter on the lookup table dropdown of
(strval($this->UniversityName->CurrentValue) != "") ? "`University` = " . QuotedValue($this->UniversityName->CurrentValue, DATATYPE_STRING) : ""

However this returns an error of
/opt/bitnami/apache/htdocs/intuition/models/Responses.php(546): Undefined constant "PHPMaker2024\intuition\DATATYPE_STRING"

Line 546 is
$this->Location->addMethod("getSelectFilter", fn() => (strval($this->UniversityName->CurrentValue) != "") ? "`University` = " . QuotedValue($this->UniversityName->CurrentValue, DATATYPE_STRING) : "");

Correction, the above error applies to one of the options I tried.

The error is actually
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 'of Tasmania ORDER BY Name ASC' at line 1


arbei
User
Posts: 9719

Post by arbei »

PHP Enumerations is used since v2024, you may use DataType::STRING instead.


Post Reply