#1 2023-03-30 15:53:11

mrbar2000
Member
From: Brazil
Registered: 2016-10-26
Posts: 90

Problem with RowID/ID to Virtual Fields on ORM select

Ab, in the code below I am using the RetrieveDocVariantArray function to perform a database search to bring tables's partial fields.
I need too bring a custom virtual string field with contatenated content.  See the following situations:

    // property ID, nome without virtual field concatenation, executes normally.
    vPaineis := GlobalRepository.Orm.RetrieveDocVariantArray(TPainel, '',
      '(IdProjeto=?)',
      [pId],
      'ID ,Nome');

    // property RowID concatenated with a string, executes normally.
    vPaineis := GlobalRepository.Orm.RetrieveDocVariantArray(TPainel, '',
      '(IdProjeto=?)',
      [pId],
      'RowID ,Nome, "/Projeto/" || RowId AS LINK');

    // property ID concatenated with a string, an error occurs.  i would like use this way
    vPaineis := GlobalRepository.Orm.RetrieveDocVariantArray(TPainel, '',
      '(IdProjeto=?)',
      [pId],
      'ID ,Nome, "/Projeto/" || ID AS LINK');

I need this field to make some type of HATEOAS https://en.wikipedia.org/wiki/HATEOAS

Offline

#2 2023-03-31 06:48:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Problem with RowID/ID to Virtual Fields on ORM select

Are you using an external DB?
My guess is that such requests is using virtual tables.
In such SQLIte3 virtual tables, there is no ID but only RowID field - this is a SQLite3 limitation.

Offline

#3 2023-03-31 10:26:02

mrbar2000
Member
From: Brazil
Registered: 2016-10-26
Posts: 90

Re: Problem with RowID/ID to Virtual Fields on ORM select

Where i found help about The vantages to use sqlite ou external DB. Im using postgree database.

Offline

Board footer

Powered by FluxBB