Joined: 04 Aug 2016
Location: United States
Online Status: Offline
Posts: 9
Topic: formula error Posted: 03 Oct 2016 at 7:43am
The below returns the correct calculation for the second and third condition but it will only return 0 for the first even though the records are included in the report. What am I missing?
if{V_ORDER_HIST_LINE.USER_1}="123"Then
formula={@Extension}*0.01
elseif{V_ORDER_HIST_HEAD.USER_1}="456"Then
formula={@Extension}*0.01
elseif{V_ORDER_HIST_HEAD.USER_1}="789"Then
formula={@Extension}*0.006
End if
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Posted: 03 Oct 2016 at 9:03am
First off I am not sure why you did not write the formula like this.
if{V_ORDER_HIST_LINE.USER_1}="123" or {V_ORDER_HIST_HEAD.USER_1}="456" then
formula={@Extension}*0.01 else if{V_ORDER_HIST_HEAD.USER_1}="789"Then
formula={@Extension}*0.006
end if
Also we do not know what {@Extension} does. It may be a data issue.
Joined: 04 Aug 2016
Location: United States
Online Status: Offline
Posts: 9
Posted: 03 Oct 2016 at 9:10am
The reason I did not add the "or" as in your formula below is that not all the formulas are *0.01 some will be 0.006. Sorry I left out that detail.
The {@extension} is the results of qty * $ in the report. So I am taking a result of a qty shipped times an amount and then calculating the commission.
Does that make sense?
Does that {@extension} effect the formula in an adverse way?
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Posted: 03 Oct 2016 at 12:10pm
In the example you showed. The first two lines are multiplied by the same value. It would make it easier to read and maintain if all values that are being multiplied by the same value be in the same if statement.
So have you checked the data to see if when {V_ORDER_HIST_LINE.USER_1}="123" that {@extension} returns a non-zero value?
Joined: 04 Aug 2016
Location: United States
Online Status: Offline
Posts: 9
Posted: 03 Oct 2016 at 12:33pm
Success ! I was using the wrong field on the one condition. They were very close in description and I had chosen the wrong one. Your suggestion to see if it returns a non-zero value made me find it.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum