Page 1 of 1

Error in Filter on Lookup Table - Undefined constant DATATYPE_STRING

Posted: Fri Jun 21, 2024 7:50 am
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


Re: Error in Filter on Lookup Table - Undefined constant DATATYPE_STRING

Posted: Fri Jun 21, 2024 9:24 am
by arbei

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