I tried to group below response by name:
{
"document1": [
{
"row": {
"schema": "Schemas",
"view": "CustomerAddress",
"data": {
"rownum": "1",
"CustomerName": "Name1",
"AddrTypeCd": "MailingAddress",
"Addr1": "911 FORBES AVE",
"Addr2": "SUITE XXX",
"CityName": "asdfasfd",
"StateProvCd": "PA",
"PostalCode": "15219"
}
}
},
{
"row": {
"schema": "Schemas",
"view": "CustomerAddress",
"data": {
"rownum": "2",
"CustomerName": "Name1",
"AddrTypeCd": "OfficeAddress",
"Addr1": "911 Watson AVE",
"Addr2": "SUITE XXX",
"CityName": "asdfasfd",
"StateProvCd": "CT",
"PostalCode": "15119"
}
}
}
],
"document2": []
}
I used arrayAggregate method in this way
.groupBy(customerAddreses.col('CustomerName'),
op.arrayAggregate("Customer addresses", customerAddreses.col('Addr1')))
and my current response data look like this:
{
"schemas.customerAddreses.CustomerName": "Name1",
"Customer addresses": [
"911 FORBES AVE",
"911 Watson AVE"
]
}
Is it possible to call arrayAggregate with mutiltiple columns and receive object in Customer addresses array? Below is the response what I want to obtain:
{
"schemas.customerAddreses.CustomerName": "Name1",
"Customer addresses": [
{
"Addr1": "911 FORBES AVE",
"Addr2": "SUITE XXX",
"CityName": "asdfasfd",
"StateProvCd": "PA",
},
{
"Addr1": "911 Watson AVE",
"Addr2": "SUITE XXX",
"CityName": "asdfasfd",
"StateProvCd": "CT"
}
]
}
CustomerAddresswhile anothercustomerAddreses. Not sure how you could get any result.ORDER, please addsortclause (Line14) in the Optic.addressinstead ofdocument1.