My Products
Help
Florian Haase
PARTNER

Filters on CompanyChangeLog

by Florian Haase

Hi

 

query {
useCompany(no: 4655191) {
companyChangeLog(filter: {_and :[ {logType :{_eq : 1}}, {tableNo :{_eq : 152}}, {columnNo :{_eq : 4084}}, { changedDateTime : {_gte: "2023-09-05T01:10:07"}} ]}, sortOrder: {createdDate: DESC _thenBy: {createdTime: DESC}})
{
items {
logType
tableNo
columnNo
newValue
previousValue
changedDateTime
primaryKey


}
}
}
}

 

results in:

{
"data": {
"useCompany": {
"companyChangeLog": {
"items": [
{
"logType": 2,
"tableNo": 170,
"columnNo": 5703,
"newValue": "2031",
"previousValue": "0",
"changedDateTime": "2023-09-05T12:08:00",
"primaryKey": "(Cap. asset no.) 12950"
},
{
"logType": 2,
"tableNo": 170,
"columnNo": 9575,
"newValue": "21",
"previousValue": "",
"changedDateTime": "2023-09-05T12:08:00",
"primaryKey": "(Cap. asset no.) 12950"
}
]
}
}
},
"extensions": {
"vbnxt-trace-id": "0000000000000000e4efa4f3e7a6f641"
}
}

 It seems like the changeddatetime-filter overrides the other filters.

Is there something wrong with my query?

When I remove the datetimefilter I get the right tableid and column but I also need the filtering on lastchanged...

 

Florian  

5 REPLIES 5

by Marius Bancila

The fix for this has been deployed to production.

by Marius Bancila

Can you try to use the following filter and see if there is any difference?

filter: {
   _and :[ 
      {logType :{_eq : 1}}, 
      {tableNo :{_eq : 152}}, 
      {columnNo :{_eq : 4084}}, 
      _or : [
         {changedDate : {_gte : 20230905}},
         _and : [
            {changedDate : {_eq : 20230905}},
            {changedTime : {_gte : 110}}
         ]
      ]
   ]
}
Florian Haase
PARTNER

by Florian Haase (Updated ‎08-09-2023 10:51 by Florian Haase PARTNER )

Interesting, same problem... 

 

query {
useCompany(no: 4655191) {
companyChangeLog(filter: {
_and :[
{logType :{_eq : 1}},
{tableNo :{_eq : 152}},
{columnNo :{_eq : 4084}},
{_or :[
{changedDate : {_gte : 20230905}},
{_and : [
{changedDate : {_eq : 20230905}},
{changedTime : {_gte : 110}}
]}
]}
]
}, sortOrder: {createdDate: DESC _thenBy: {createdTime: DESC}})
{
items {
logType
tableNo
columnNo
newValue
previousValue
changedDateTime
primaryKey


}
}
}
}
 {
"logType": 2,
"tableNo": 170,
"columnNo": 9575,
"newValue": "21",
"previousValue": "",
"changedDateTime": "2023-09-05T12:08:00",
"primaryKey": "(Cap. asset no.) 12950"
}

But filter on createdDateTime seems to work at least.

Florian Haase
PARTNER

by Florian Haase

Just one idea about that here: The changelog would actually never be changed - is this maybe the root for the problem? I can test to get around this by filtering on createDateTime instead.

 

Florian Haase
PARTNER

by Florian Haase

It seems like that only occurs when the filter does not hit any rows. When both tableno columno logtype and lastchangeddatime filter hit any  rows I get the rows with right filtering