The code below is correctly finding items containing a particular text string, but it is not finding the associated first source and linked repository pointers (where these exist). No doubt it's the data reference that's the problem... and I will curse when an obvious problem is pointed out but I'm not too proud to ask!
Code: Select all
for ptrItem in allItems() do
if TagSearch:Found(fhGetValueAsText(ptrItem), "#RN") == true then
-- TagSearch is a search function (class) that is returning items correctly, some of which have sources, some of which have repositories
local ptrS = nil
local ptrR = nil
ptrS = fhGetItemPtr(ptrItem, "~.SOUR")
if ptrS:IsNull() then
ptrS = nil
else
ptrR = fhGetItemPtr(ptrS,"~.REPO")
if ptrR:IsNull() then ptrR = nil end
end
UpdateResults{ptrItem, ptrS, ptrR} --UpdateResults updates the plugin result tables
end
end
end