Roster Error

Other discussions about CSPro
Forum rules
New release: CSPro 8.0
Post Reply
Learner
Posts: 4
Joined: January 30th, 2017, 10:05 pm

Roster Error

Post by Learner »

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?
Attachments
14861993765681847746140.jpg
14861993765681847746140.jpg (538.97 KiB) Viewed 5865 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Roster Error

Post by josh »

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.
Learner
Posts: 4
Joined: January 30th, 2017, 10:05 pm

Re: Roster Error

Post by Learner »

Please find attached to this post my packed application. Thanks for the help.
Attachments
Costs and Benefits.zip
(191.84 KiB) Downloaded 301 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Roster Error

Post by josh »

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;
Learner
Posts: 4
Joined: January 30th, 2017, 10:05 pm

Re: Roster Error

Post by Learner »

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: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Roster Error

Post by josh »

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

Post by Learner »

Thank You. It worked perfectly now. :D :D :D :D :D :D
Post Reply