Page 1 of 1

rule line error runtime error :circular reference, evaluation stack

Posted: Mon Oct 17, 2022 8:07 am
by mrdauduong
hi,

today, i got this error that i never seen that before, so, any help or any exp will be appreciated ! :idea:

thanks !

my trouble
trouble rule.png
trouble rule.png (45.29 KiB) Viewed 3739 times
trouble rule 2.png
trouble rule 2.png (568.71 KiB) Viewed 3739 times

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Tue Oct 18, 2022 3:58 pm
by Emixam
People usually pay me to fix that kind of problem. I feel like every time you have an issue, you post on this forum.

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Tue Oct 18, 2022 5:26 pm
by Wim Gielis
Emixam wrote: Tue Oct 18, 2022 3:58 pm People usually pay me to fix that kind of problem. I feel like every time you have an issue, you post on this forum.
:lol:

Creating 11 topics in the first 20 days is quite a high average.

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Tue Oct 18, 2022 10:41 pm
by lotsaram
Emixam wrote: Tue Oct 18, 2022 3:58 pm People usually pay me to fix that kind of problem. I feel like every time you have an issue, you post on this forum.
Yeah dude seriously no one is going to read through that much code and provide you with a free answer (not even Declan).
A circular reference is exactly what the error says it is. Find it and fix it.

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Wed Oct 19, 2022 5:28 am
by mrdauduong
To be honest, in beginning, my question is only "what is a circular reference rules"
In the forum rule, i saw that i need to be as clear as possible. this is why i try to post all code here.
But this is maybe not a good way to ask a question. Iam sorry about that. :oops:

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Wed Oct 19, 2022 7:29 am
by MarenC
Hi,

as the others have said this is a painstaking find and fix problem.

One other thing I will mention, I am pretty sure that I have seen in the past too many continue statements causing similar problems.

So if you get really stuck after a painstaking trawl through the rules, you might want to look at that and and try and combine into nested if statements.

Maren

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Wed Oct 19, 2022 8:32 am
by mrdauduong
Thank maren for the reponse, problem solved, i found that i compare A with B while B is calculed by A. but i still dont understand why it cause reference circular error.

B = A * coefficient (0,1-1)
i have a condition if (B>A), B, A.

I still need to do this and i need to understand why there are a reference circular here. :ugeek:


Thanks !


So if you get really stuck after a painstaking trawl through the rules, you might want to look at that and and try and combine into nested if statements. ==> this is a good advise, i use continue a lot before but now, i try to use if to replace
MarenC wrote: Wed Oct 19, 2022 7:29 am Hi,

as the others have said this is a painstaking find and fix problem.

One other thing I will mention, I am pretty sure that I have seen in the past too many continue statements causing similar problems.

So if you get really stuck after a painstaking trawl through the rules, you might want to look at that and and try and combine into nested if statements.

Maren

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Wed Oct 19, 2022 1:10 pm
by Steve Rowe
wrt to a circular reference one thing that isn't always obvious until it happens to you the first time is that you need to consider rules and consolidations in the dimension together.

To illustrate this with a silly example.

Say your period dimension has Jan rolling into Year.

and you write a rule

['Measure A' , 'Jan']=N: ['Measure A', 'Full Year'];

Then you create a circular reference since in the rule Jan depends on Full Year and in the consolidation Full Year depends on Jan.

Note though that the below isn't circular (unless Measure B and Measure A are also dependant on each other).
['Measure A' , 'Jan']=N: ['Measure B', 'Full Year'];

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Wed Oct 19, 2022 6:20 pm
by Wim Gielis
Did you google for a second ?
For instance: TM1 rule circular reference
The very first hit is: https://code.cubewise.com/blog/resolvin ... alculation

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Thu Oct 20, 2022 7:48 am
by mrdauduong
Thank for the explain! i have it something in excel formula but this is a first time i have in TM1, i have no idea why a condition can make a reference circular while it work on 1 but not other

probleme is on this line, but this line dont make the trouble in the first case (PR1 MAX)
rule line error.png
rule line error.png (374.7 KiB) Viewed 3578 times

Code: Select all

['PR1_CALCUL_MAX'] = N: 
IF(DB('D_PRICING_SELECT_SIMULATION', !D_PRICING_DIM_VERSION, !D_PRICING_PDTS_GROUPE_PRIX_RELATION,'Value') @= 'Oui'
&ATTRS('D_PRICING_DIM_PDTS', !D_PRICING_PDTS_GROUPE_PRIX_RELATION, 'REF_BENCHMARK')@=''
	,0
	,if(attrs('D_PRICING_PDTS_GROUPE_PRIX_RELATION',!D_PRICING_PDTS_GROUPE_PRIX_RELATION,'type_element')@=''
		,if(DB('D_PRICING_SIMULATION', !D_PRICING_DIM_VERSION, !D_PRICING_DIM_POS, !D_PRICING_DIM_ORGA, !D_PRICING_PDTS_GROUPE_PRIX_RELATION, 'SIM')<DB('D_PRICING_SIMULATION', !D_PRICING_DIM_VERSION, !D_PRICING_DIM_POS, !D_PRICING_DIM_ORGA, !D_PRICING_PDTS_GROUPE_PRIX_RELATION, 'PR1')
		
			,DB('D_PRICING_SIMULATION', !D_PRICING_DIM_VERSION, !D_PRICING_DIM_POS, !D_PRICING_DIM_ORGA, !D_PRICING_PDTS_GROUPE_PRIX_RELATION, 'PR1')
			,DB('D_PRICING_SIMULATION', !D_PRICING_DIM_VERSION, !D_PRICING_DIM_POS, !D_PRICING_DIM_ORGA, !D_PRICING_PDTS_GROUPE_PRIX_RELATION, 'SIM'))
			
		,DB('D_PRICING_SIMULATION', !D_PRICING_DIM_VERSION, !D_PRICING_DIM_POS, !D_PRICING_DIM_ORGA, attrs('D_PRICING_PDTS_GROUPE_PRIX_RELATION',!D_PRICING_PDTS_GROUPE_PRIX_RELATION,'element_base'), 'PR1')));
Anyway, thanks for your help ! now, i know where is the problem, i will just delete it and try to make another way. i'am not very smart on math :mrgreen:

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Thu Oct 20, 2022 8:18 am
by MarenC
Hi,

Bit puzzled why the REF_BENCHMARK ATTRS for D_PRICING_GROUPE_PRIX_RELATION would be asking if it was equal to itself?

If you removed that ATTRS does it work then?

Other than that not enough information to provide an answer and as others have already said, not something anyone has time for really.

Maren

Re: rule line error runtime error :circular reference, evaluation stack

Posted: Thu Oct 20, 2022 12:08 pm
by mrdauduong
Thank maren for the reponse, we can close the topic here.

To answer your question :
- Bit puzzled why the REF_BENCHMARK ATTRS for D_PRICING_GROUPE_PRIX_RELATION would be asking if it was equal to itself? ==> because i have to apply this rule only for the element who have himself in the attribut REF_BENCHMARK
- If you removed that ATTRS does it work then? => it work if i romove that ATTRS, this is why i dont understand :mrgreen:

==> i will try another way to do this thing or use a TI.

Thanks your help !
MarenC wrote: Thu Oct 20, 2022 8:18 am Hi,

Bit puzzled why the REF_BENCHMARK ATTRS for D_PRICING_GROUPE_PRIX_RELATION would be asking if it was equal to itself?

If you removed that ATTRS does it work then?

Other than that not enough information to provide an answer and as others have already said, not something anyone has time for really.

Maren