I am having trouble with a procedure using loop array. I am trying to select matching calf-cow pairs.
This is the code that isn’t working:
local dams,n,m,p
arraybuild dams,"/","",Unique,Select contains “Y"
if arraynumerictotal(dams,”/")=0
alertsheet “No records selected"
return
endif
Select Select contains “Y"
looparray dams,”/”,m
p = lookup(“Cattle Database-Pedigree 3”,Unique,m,UniquePed)
selectadditional DamID = p and Fate contains "AtFoot"
endloop
It says the lookup( function fails to match.
However, the same lookup code, copied, with the m variable manually changed as follows, works perfectly.
m=4106
p = lookup(“Cattle Database-Pedigree 3”,Unique,m,UniquePed)
selectadditional DamID = p and Fate contains “AtFoot”
I have checked the array is formatting correctly, by using the loop array with a message as follows:
arraybuild dams,"/","",Unique,Select contains “Y"
looparray dams,”/",m
message m
endloop
What am I doing incorrectly? and can I fix it?