From: http://spservices.codeplex.com/discussions/346508
Did anyone get this figured out? I have run into the same issue. Using 'matchOnId: true' causes the function to return 0 items. I believe I have the solution. I'm using SPServices 0.7.1a so if this has already been fixed in later releases, my apologies.
Looking at line ~1739, we're creating a query string as...
```
camlQuery += "<Eq><FieldRef Name='" + opt.relatedListColumn +
(opt.matchOnId ? "' LookupId='True'/><Value Type='Integer'>" : "'/><Value Type='Text'>") +
escapeColumnValue(columnSelectSelected[0]) + "</Value></Eq>";
```
When matchOnId = true, I beleive we should be filtering on the ID field of the target list and not the opt.relatedListColumn. So, I modified the source code to look like this....
```
camlQuery += "<Eq><FieldRef Name='" +
(opt.matchOnId ? "ID' /><Value Type='Integer'>" : opt.relatedListColumn + "'/><Value Type='Text'>") +
escapeColumnValue(columnSelectSelected[0]) + "</Value></Eq>";
```
I believe this comes up in other places in the code but I haven't gone through it. I wanted to get a second look at my madness before I press on.
Thanks,
Geoff
Comments: I was having the opposite problem. However when I did use matchOnId, instead of pointing to the related column for which the lookup uses, point it to the ID column instead, and you will get the one matching item returned. Keep in mind if the related list has the item deleted and then re-added, the ID will change and the related info will no longer be related unless reselected. I cannot get anything returned when I use MatchOnId: false and point to the lookup column used in my form. I need to return one file (based solely on text matching between the lookup in the form and the Realted column in the related list) , without using ID, as the related list will change regularly, thereby negating the ID orginally used.
Did anyone get this figured out? I have run into the same issue. Using 'matchOnId: true' causes the function to return 0 items. I believe I have the solution. I'm using SPServices 0.7.1a so if this has already been fixed in later releases, my apologies.
Looking at line ~1739, we're creating a query string as...
```
camlQuery += "<Eq><FieldRef Name='" + opt.relatedListColumn +
(opt.matchOnId ? "' LookupId='True'/><Value Type='Integer'>" : "'/><Value Type='Text'>") +
escapeColumnValue(columnSelectSelected[0]) + "</Value></Eq>";
```
When matchOnId = true, I beleive we should be filtering on the ID field of the target list and not the opt.relatedListColumn. So, I modified the source code to look like this....
```
camlQuery += "<Eq><FieldRef Name='" +
(opt.matchOnId ? "ID' /><Value Type='Integer'>" : opt.relatedListColumn + "'/><Value Type='Text'>") +
escapeColumnValue(columnSelectSelected[0]) + "</Value></Eq>";
```
I believe this comes up in other places in the code but I haven't gone through it. I wanted to get a second look at my madness before I press on.
Thanks,
Geoff
Comments: I was having the opposite problem. However when I did use matchOnId, instead of pointing to the related column for which the lookup uses, point it to the ID column instead, and you will get the one matching item returned. Keep in mind if the related list has the item deleted and then re-added, the ID will change and the related info will no longer be related unless reselected. I cannot get anything returned when I use MatchOnId: false and point to the lookup column used in my form. I need to return one file (based solely on text matching between the lookup in the form and the Realted column in the related list) , without using ID, as the related list will change regularly, thereby negating the ID orginally used.