My Products
Help
Robert_ITX
CONTRIBUTOR **

Issue with filters/values when used in variables

by Robert_ITX (Updated ‎22-12-2023 09:52 by Robert_ITX )

I want to update associates by having the filters \ values pair in variables, but I get the following error when trying that: "Input value cannot be null." It's working when I use filter \ value pair in variables, but I see from the documentation that filters/values should be used: "The filter \ value pair is considered deprecated and will be removed in the future. You should use the filters \ values pair instead." The filters \ values pair is working when not used in variables.

 

Example where it doesn't work with filters \ values pair:

 

 

mutation insert($cid : Int!, $filters : [FilterExpression_Associate], $values : [Associate_Input!]!)
{
  useCompany(no: $cid)
  {
    associate_update(
			filters: $filters
			values: $values
		)
    {
      affectedRows
      items
      {
        associateNo
        customerNo
        name
      }
    }
  }
}

Variables:
{
	"cid": 123,
	"filters": [
		{
			"associateNo": {
				"_eq": 1543
			}
		}
	],
	"values": [
		{
			"name": "Test filters/values var cust 1"
		}
	]
}

Response:
{
	"errors": [
		{
			"message": "Input value cannot be null.",
			"path": [
				"useCompany",
				"associate_update"
			]
		}
	],
	"data": {
		"useCompany": {
			"associate_update": null
		}
	},
	"extensions": {
		"vbnxt-trace-id": "00000000000000003f670c7edf83f59c"
	}
}

 

 

 

Example where it works with the filter \ value pair:

 

 

mutation insert($cid : Int!, $filter : FilterExpression_Associate, $value : Associate_Input!)
{
  useCompany(no: $cid)
  {
    associate_update(
			filter: $filter
			value: $value
		)
    {
      affectedRows
      items
      {
        associateNo
        customerNo
        name
      }
    }
  }
}

Variables:
{
	"cid": 123,
	"filter": {
		"associateNo": {
			"_eq": 1543
		}
	},
	"value": {
		"name": "Test filter/value var cust 1"
	}
}

Response:
{
	"data": {
		"useCompany": {
			"associate_update": {
				"affectedRows": 1,
				"items": [
					{
						"associateNo": 1543,
						"customerNo": 16101,
						"name": "Test filter/value var cust 1"
					}
				]
			}
		}
	},
	"extensions": {
		"vbnxt-trace-id": "00000000000000009fa107295b59f602"
	}
}

 

 

 

Example where  filters \ values pair is working when not used in variables:

 

 

mutation insert($cid : Int!)
{
  useCompany(no: $cid)
  {
    associate_update(
			filters: [
				{associateNo : {_eq : 1543}}
			]
			values:[
      {
        name: "test cust without var u1"
				
      }
    ])
    {
      affectedRows
      items
      {
        associateNo
        customerNo
        name
      }
    }
  }
}

Variables:
{
	"cid": 123
}

Response:
{
	"data": {
		"useCompany": {
			"associate_update": {
				"affectedRows": 1,
				"items": [
					{
						"associateNo": 1543,
						"customerNo": 16101,
						"name": "test cust without var u1"
					}
				]
			}
		}
	},
	"extensions": {
		"vbnxt-trace-id": "000000000000000006b69f92f6643284"
	}
}

 

 

 

3 REPLIES 3
Accepted solution
Marius Bancila
VISMA

by Marius Bancila

The fix for this is now in production.

Robert_ITX
CONTRIBUTOR **

by Robert_ITX

Great, thanks for letting me know.

by Marius Bancila

This is a bug. Thank you for reporting it. We will investigate and fix it.