Solved

Error message set definition

  • 22 July 2020
  • 3 replies
  • 64 views

Hi,

In vs 4.74 I get an errormessage, which did not appear in vs. 4.69.:

"A function call in the initial data of a set is not allowed. Either use a definition or assign the set in a procedure.",

I see that when opening the declaration the set property is "initial data”, and I used the function elementrange for definition. However, I do not see an option to change "initial data” into "definition”. How can I repair this?

 

icon

Best answer by mateusarakawa 22 July 2020, 22:12

Hi, @Jan Willem ter Weeme.

In my project both options (Declaration and Initial data) appear:

 

I think your set is a local set, i.e., it is inside a procedure, right? Like this one:

 

If I assumed it right, local sets can’t have a declaration, because it only “exists” when the procedure runs. 

So you should remove this function from “initial data”, and you can use it (populate sCalcLoop) in the begginig of your procedure code.

View original

3 replies

Userlevel 5

Hi, @Jan Willem ter Weeme.

In my project both options (Declaration and Initial data) appear:

 

I think your set is a local set, i.e., it is inside a procedure, right? Like this one:

 

If I assumed it right, local sets can’t have a declaration, because it only “exists” when the procedure runs. 

So you should remove this function from “initial data”, and you can use it (populate sCalcLoop) in the begginig of your procedure code.

Hi @mateusarakawa ,

Thanks for the answer, previous versions were not that strickt on the definition.

Thank you @mateusarakawa for providing this excellent answer. @Jan Willem ter Weeme indeed the AIMMS compiler has become more strict.  In previous versions a definition was sometimes allowed on local sets but could cause strange errors. 

 

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator