custom field with function as expression

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

custom field with function as expression

Post by philmills »

I created a function getAge in global events which calculates a persons age from their id
the id is stored in the users table in the field 'personalcode'
I want to create a custom field that will display the user's age

I can do this in row_rendered like this
getAge($this->personalcode->CurrentValue)
but for tidiness i would rather have it directly in the custom field

What would the correct expression be for that, assuming its possible?


arbei
User
Posts: 9355

Post by arbei »

Read Custom Fields:
The SQL expression must be a valid SQL expression for the database based on the fields of the table/view. Otherwise, the Custom Field cannot be created.

It is not PHP expression.


philmills
User
Posts: 538

Post by philmills »

OK, in that case I have to stick with Row_Rendered


mobhar
User
Posts: 11703

Post by mobhar »

Yes. Using Row_Rendered server event is the closest approach for your case.


adeebss
User
Posts: 1

Post by adeebss »

TIMESTAMPDIFF(YEAR, birthdate, CURDATE())

add custom field then add expression
note: change it (birthdate)


Post Reply