forcase produces ambiguous symbol

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

forcase produces ambiguous symbol

Post 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?
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: forcase produces ambiguous symbol

Post 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.
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: forcase produces ambiguous symbol

Post by AriSilva »

Thanks, Josh,
Best
Ari
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: forcase produces ambiguous symbol

Post by AriSilva »

I´ve tried the complete name (with the dot) and the totocc returns 0 all the time.
Best
Ari
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: forcase produces ambiguous symbol

Post by AriSilva »

But if I use the count function it returns the actual number of cases.
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: forcase produces ambiguous symbol

Post by josh »

Yes, totocc is unreliable with external dictionaries. Stick with count.
Post Reply