Unexpected behaviour of show function.
Posted: February 22nd, 2015, 1:54 pm
Hi -
I use a show function to display people from a household roster (ROST_REC) who are eligible for interview. In the code below, Q114A = person number, Q114B = Name, Q114J = status and Q114E = eligibility for interview. Only those with eligibility of 1 are shown. The code below works OK:-
function SelectedWoman();
numeric wno, wid = 0;
wno = show(ROST_REC,Q114A,Q114B, Q114J where Q114E=1,Title("ID","Name", "Interview Status"));
if wno > 0 then
wid = Q114A(seek(Q114E=1, @wno));
endif;
SelectedWoman = wid;
end;
However, I want to add a further criteria, to only show those eligible people who have not yet been interviewed. I've added another item to the end of the roster - Q114K - to do this, and I want to include this in the show function where Q114K=0, ie:-
function SelectedWoman();
numeric wno, wid = 0;
wno = show(ROST_REC,Q114A,Q114B, Q114J where Q114E=1 and Q114K=0,Title("ID","Name", "Interview Status"));
if wno > 0 then
wid = Q114A(seek(Q114E=1 and Q114K=0, @wno));
endif;
SelectedWoman = wid;
end;
But this doesn't work - if I have two eligible people it now only shows the first, regardless of interview status. I think this might have something to do with the new item being at the end of the roster? But I can't figure out what the problem is. I would really value any help with this, as I can't see where I'm going wrong.
Many thanks
Keith
I use a show function to display people from a household roster (ROST_REC) who are eligible for interview. In the code below, Q114A = person number, Q114B = Name, Q114J = status and Q114E = eligibility for interview. Only those with eligibility of 1 are shown. The code below works OK:-
function SelectedWoman();
numeric wno, wid = 0;
wno = show(ROST_REC,Q114A,Q114B, Q114J where Q114E=1,Title("ID","Name", "Interview Status"));
if wno > 0 then
wid = Q114A(seek(Q114E=1, @wno));
endif;
SelectedWoman = wid;
end;
However, I want to add a further criteria, to only show those eligible people who have not yet been interviewed. I've added another item to the end of the roster - Q114K - to do this, and I want to include this in the show function where Q114K=0, ie:-
function SelectedWoman();
numeric wno, wid = 0;
wno = show(ROST_REC,Q114A,Q114B, Q114J where Q114E=1 and Q114K=0,Title("ID","Name", "Interview Status"));
if wno > 0 then
wid = Q114A(seek(Q114E=1 and Q114K=0, @wno));
endif;
SelectedWoman = wid;
end;
But this doesn't work - if I have two eligible people it now only shows the first, regardless of interview status. I think this might have something to do with the new item being at the end of the roster? But I can't figure out what the problem is. I would really value any help with this, as I can't see where I'm going wrong.
Many thanks
Keith