12
Views
1
Comments
[Advance Query] Datagrid JSON integration issue / mismatch
advancequery
Web icon
Forge asset by oDevFagundes
Application Type
Traditional Web

I am using this nice extension with the option ExecuteSelectReturnJson.

Here an example of the JSON returned by the extension:

[

    {

        "Id": 1.0,

        "CODE": "CC RFID",

        "OMSCHRIJVING": "Deense Container 2",

        "GSCODE": "CC",

        "ACTIEF": "Ja",

        "GSONECODE": 8716532000303.0,

        "VOLGORDE": 999,

        "Datum": "2023-08-22T13:04:59"

    },

    {

        "Id": 13.0,

        "CODE": "CCKAP",

        "OMSCHRIJVING": "CC Kapot",

        "GSCODE": "CCK",

        "ACTIEF": "Ja",

        "GSONECODE": 0.0,

        "VOLGORDE": 5,

        "Datum": "2023-08-22T13:04:59"

    }

]

When I use this in the OutSystems Datagrid compenent, the data is shown in the grid but for field types like Date, DateTime, Boolean the grid sees them as a text.

Datagrid is expecting a JSON containing a data and metadata section like in the example below. Is there an option to have the Advance Query create a JSON like this?

{

    "data": [

        {

            "Relatie": {

                "Id": 221102,

                "Tekst": "Test",

                "IsActief": true,

                "DatumMutatie": "2019-04-19T14:10:59Z",

                "RelatieIdCCBoeking": 0,

                "GeactiveerdOp": ""

            }

        }

    ],

    "metadata": {

        "Relatie": {

            "Id": "Int64",

            "Tekst": "String",

            "IsActief": "Boolean",

            "DatumMutatie": "DateTime",

            "RelatieIdCCBoeking": "Int64",

            "GeactiveerdOp": "DateTime"

        }

    }

}

2025-04-23 09-24-58
oDevFagundes
Champion

Hi Raymond, 

The Advance Query component only exports according to the entity schema.
You can for instance modify a bit your SELECT to get different column names using alias, but you'll never be able to create a nest json.
For that, I would suggest approaching it differently and creating it manually.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.