to get a personalized navigation.
to get a personalized navigation.
Hey,
So we have an issue when I have a joinup_Associate_via_Employee on e.g. order, and employeeNo is 0, it will joinup the first associate that's not an employee.
Any way you could add a check to see if the foreign key on the join is actually set?
Cheers!
Solved! Go to Solution.
Working on a fix.
For a query like:
query read_orders($cid : Int!)
{
useCompany(no : $cid)
{
order(first: 10)
{
items
{
orderNo
orderDate
customerNo
supplierNo
employeeNo
joinup_Associate_via_Customer
{
customerNo
supplierNo
employeeNo
name
}
joinup_Associate_via_Supplier
{
customerNo
supplierNo
employeeNo
name
}
joinup_Associate_via_Employee
{
customerNo
supplierNo
employeeNo
name
}
}
}
}
}
The results will be as follows:
{
"data": {
"useCompany": {
"order": {
"items": [
{
"orderNo": 1,
"orderDate": 20210212,
"customerNo": 10002,
"supplierNo": 51004,
"employeeNo": 0,
"joinup_Associate_via_Customer": {
"customerNo": 10002,
"supplierNo": 0,
"employeeNo": 0,
"name": "Me AS"
},
"joinup_Associate_via_Supplier": {
"customerNo": 0,
"supplierNo": 51004,
"employeeNo": 0,
"name": "Abc AS"
},
"joinup_Associate_via_Employee": null
},
{
"orderNo": 2,
"orderDate": 20130203,
"customerNo": 0,
"supplierNo": 0,
"employeeNo": 0,
"joinup_Associate_via_Customer": null,
"joinup_Associate_via_Supplier": null,
"joinup_Associate_via_Employee": null
},
{
"orderNo": 3,
"orderDate": 20130401,
"customerNo": 10004,
"supplierNo": 0,
"employeeNo": 0,
"joinup_Associate_via_Customer": {
"customerNo": 10004,
"supplierNo": 0,
"employeeNo": 0,
"name": "You AS"
},
"joinup_Associate_via_Supplier": null,
"joinup_Associate_via_Employee": null
},
Your observation is correct. The result is not as expected. My only comment is that it joins the first associate that has employeeNo set to 0, which of course is not an employee (should be a customer or supplier), as you mentioned.
We are looking for a solution to fix this problem.
Thank you. I’ve worked around this by automatically fetching the columns from ToColumns on the relation and checking them for 0.
Copyright © 2022 Visma.com. All rights reserved.