Page 1 of 1

forcase produces ambiguous symbol

Posted: April 29th, 2018, 7:48 pm
by AriSilva
I'm using the forcase instruction to load a case into memory.
The dictionary has several record types, and one of them occurs 9 times.
When I try to access the totoc for this record, I get the following message:
ERROR: Ambiguous symbol 'Y_VISITAS' (2 synonyms found) - please provide qualifiers enough to avoid ambiguity near line 1578 in GLOBAL procedure
In my case Y_VISITAS is the record name, and I do not have any other symbol with such name.

The snipet for the function is

forcase FIPETUR_10_ENTREVISTA_DICT do
do i = 1 until i > totocc(Y_VISITAS)
.....
enddo;
endfor;

What am I doing wrong?

Re: forcase produces ambiguous symbol

Posted: April 29th, 2018, 8:57 pm
by josh
This is an annoyance of CSPro. When you have a record in an external dictionary CSPro creates two symbols with the same name: one for the record and one for the group. You can workaround this by using the of the dictionary followed by a period then the name of the record. This tells CSPro to use the record name. In your case assuming Y_VISITAS is in dictionary FIPETUR_10_ENTREVISTA_DICT then you would use:
totocc(FIPETUR_10_ENTREVISTA_DICT.Y_VISITAS)
And if totocc gives unexpected results then try using count instead.

Re: forcase produces ambiguous symbol

Posted: April 30th, 2018, 6:05 pm
by AriSilva
Thanks, Josh,

Re: forcase produces ambiguous symbol

Posted: May 6th, 2018, 1:52 pm
by AriSilva
I´ve tried the complete name (with the dot) and the totocc returns 0 all the time.

Re: forcase produces ambiguous symbol

Posted: May 6th, 2018, 1:57 pm
by AriSilva
But if I use the count function it returns the actual number of cases.

Re: forcase produces ambiguous symbol

Posted: May 6th, 2018, 8:00 pm
by josh
Yes, totocc is unreliable with external dictionaries. Stick with count.