User-defined function: using parameter in error message
Posted: January 26th, 2015, 12:22 pm
Hello there - I'm trying to use a function which can be used multiple times to check if the value of one variable is incorrectly greater than that for another. If that's the case then the user gets an error message asking if they want to review the data. The syntax for my function so far is:-
function CheckStaff (Q1, Q2);
if Q1 <> 99 then
if Q2 > Q1 then
errmsg ("Number trained is greater than number employed! Do you want to review?") select ("Yes", Q2, "No", continue);
endif;
endif;
end;
This would then be placed in the postproc of the relevant fields. But at the moment it's giving me the following error at the line of the error message in the function:-
ERROR: It cannot be a work variable near line 24 in GLOBAL procedure
Which I think means that there is a problem with using the parameter Q2 within the select part of the error message. Could anyone advise me what the correct syntax should be?
Many thanks
Keith
function CheckStaff (Q1, Q2);
if Q1 <> 99 then
if Q2 > Q1 then
errmsg ("Number trained is greater than number employed! Do you want to review?") select ("Yes", Q2, "No", continue);
endif;
endif;
end;
This would then be placed in the postproc of the relevant fields. But at the moment it's giving me the following error at the line of the error message in the function:-
ERROR: It cannot be a work variable near line 24 in GLOBAL procedure
Which I think means that there is a problem with using the parameter Q2 within the select part of the error message. Could anyone advise me what the correct syntax should be?
Many thanks
Keith