AggregateColumns must not be null or empty

I'm trying to do create the below statement in a Query Entity. (see attached)

"select int_field, text_field from table_name where date_field = (select MAX(date_field) from table_name where id = id)"

I think I'm missing something as it's complaining about aggregatecolumns must not be null or empty.



query entity.txt

OriginalPostID-228561

OriginalPostID-228561

  Discussion posts and replies are publicly visible

Parents
  • the below one should work for you.
    load(
    local!maxDate: a!queryEntity(
    entity: cons!ENTITY,
    query: a!query(
    aggregation: a!queryAggregation(
    aggregationColumns: {
    a!queryAggregationColumn(
    field: "id ",
    isGrouping: true()
    ),
    a!queryAggregationColumn(
    field: "date_field",
    aggregationFunction: "MAX"
    )
    }
    ),
    filter: a!queryFilter(
    field: "id",
    operator: "=",
    value: ri!id
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1,
    sort: a!sortInfo(
    field: "date_field",
    ascending: false()
    )
    )
    )
    ),
    a!queryEntity(
    entity: cons!FJA_PRECLOSE_TASK_ENTITY,
    query: a!query(
    /*selection:a!querySelection(),*/
    filter: a!queryFilter(
    field: "date_field",
    operator: "=",
    value: cast(
    55,
    local!maxDate.data.modTs
    )
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1,
    sort: a!sortInfo(
    field: "date_field",
    ascending: false()
    )
    )
    )
    )
    )
Reply
  • the below one should work for you.
    load(
    local!maxDate: a!queryEntity(
    entity: cons!ENTITY,
    query: a!query(
    aggregation: a!queryAggregation(
    aggregationColumns: {
    a!queryAggregationColumn(
    field: "id ",
    isGrouping: true()
    ),
    a!queryAggregationColumn(
    field: "date_field",
    aggregationFunction: "MAX"
    )
    }
    ),
    filter: a!queryFilter(
    field: "id",
    operator: "=",
    value: ri!id
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1,
    sort: a!sortInfo(
    field: "date_field",
    ascending: false()
    )
    )
    )
    ),
    a!queryEntity(
    entity: cons!FJA_PRECLOSE_TASK_ENTITY,
    query: a!query(
    /*selection:a!querySelection(),*/
    filter: a!queryFilter(
    field: "date_field",
    operator: "=",
    value: cast(
    55,
    local!maxDate.data.modTs
    )
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1,
    sort: a!sortInfo(
    field: "date_field",
    ascending: false()
    )
    )
    )
    )
    )
Children
No Data