Build my own Projection

Is it possible to create my own projection?
Is there an example of this?

I would like to create my own (complicated) calculation based on a projection.

As an example, I looked at the class function Substring in Aurelius.Criteria.Projections. I would like to create a unit with my own calculations that I can use within Aurelius.

Is there a documentation or an example project for this?

The calculations are not based on SQL, but are performed completely stand alone (I even want to put a REST API call there).

Hi @Kaeswurm_Thomas.

Projections are used to be included in the SQL statement. If you don't want to use it in SQL statement, then it wouldn't make sense to use projections.

I would like to use them already in queries built with Aurelius. However, they are not in the database, but are to be calculated in the server.

Use, just like e.g. "Substring" or like date functions e.g. "Year"

But you said such calculations are not based on SQL, could be even a REST API call. I'm confused. Can you give a real example, please?

I mean a function like "Substring", "Contains", ... which I program myself and which is called by Aurelius.

I can use the function in QueryBuilder or general in "ObjectManager.Find" queries.

.Select(Linq['Name'].Substring(1, 5))
.Select(Linq['ProjectDate'].WorkingDaysUntil( '31.05.2023') 

as an an example
.WorkingDayUntil( ADate: TDate) is a self-written function

I believe you will have to create a class helper to TLinqProjection and then implement the functions there yourself?

Yes, a class helper seems to be the right solution here.
I'll try to see if it just works like that.
Do you have any tips?

I see in code that FProjection field is private, and you will need it from the class helper. So for now you need to modify the existing source code by creating a protected read-only property to access the FProjection field. Other than this, just create the class helper and implement the methods.