I tried to create the logic that would help me end the roster. But I seem to get this error message (Error: You must assign the result of the function to an alpha near line 1 in APPLIANCES procedure).
Please can anyone help me?
Roster Error
-
Learner
- Posts: 4
- Joined: January 30th, 2017, 10:05 pm
Roster Error
You do not have the required permissions to view the files attached to this post.
-
josh
- Posts: 2403
- Joined: May 5th, 2014, 12:49 pm
- Location: Washington DC
Re: Roster Error
My guess is that APPLIANCES is a numeric variable from your dictionary. You cannot compare a number to a string. "" is of type string. To check if a numeric variable is blank compare it to notappl:
if APPLIANCES = notappl then
...
If that isn't the problem please attach your application. Use the pack application tool to create zip file and send it to us. It is easier for us to figure out the problem if we have the application instead of just a screenshot.
if APPLIANCES = notappl then
...
If that isn't the problem please attach your application. Use the pack application tool to create zip file and send it to us. It is easier for us to figure out the problem if we have the application instead of just a screenshot.
-
Learner
- Posts: 4
- Joined: January 30th, 2017, 10:05 pm
Re: Roster Error
Please find attached to this post my packed application. Thanks for the help.
You do not have the required permissions to view the files attached to this post.
-
josh
- Posts: 2403
- Joined: May 5th, 2014, 12:49 pm
- Location: Washington DC
Re: Roster Error
Looking at your app I can confirm that APPLIANCES is a numeric variable as I guessed. Change your logic to compare it to notappl instead of to "" and it will compile without error:
PROC APPLIANCES
If APPLIANCES = notappl then
numeric finished;
finished = accept("Are you done capturing all the appliances in the household?", "Yes", "No");
if finished = 1 then
endgroup;
else
reenter;
endif;
endif;
If APPLIANCES = notappl then
numeric finished;
finished = accept("Are you done capturing all the appliances in the household?", "Yes", "No");
if finished = 1 then
endgroup;
else
reenter;
endif;
endif;
-
Learner
- Posts: 4
- Joined: January 30th, 2017, 10:05 pm
Re: Roster Error
Thank you very much. The compile was successful but I still don't get the accept options if I choose no option in the appliances field. Please can anything be done about that?
-
josh
- Posts: 2403
- Joined: May 5th, 2014, 12:49 pm
- Location: Washington DC
Re: Roster Error
Since your value set for APPLIANCES does not include notappl when you try to enter blank you are getting an out of range error. You can add notappl to the value set in the dictionary and then the range check will pass and you will see the accept.
-
Learner
- Posts: 4
- Joined: January 30th, 2017, 10:05 pm
Re: Roster Error
Thank You. It worked perfectly now.
