Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3363

BOFC rule does not work

$
0
0

Hi,

We have a rule and coefficient for the rule but there is one row that does not work. All filters, and analytics is OK.

Elements of the rule:


Screenshot 1 (Selection)

Screenshot1(selection).png

Screenshot 2 (Scope)

Screenshot 2 (scope).png

 

Screenshot 3 (Processing) 

Screenshot 3 (Processing)  .png

 

Screenshot 4 (Coefficient) 

Screenshot 4 (Coefficient)  .png

Screenshot 5 (Function) 

Screenshot 5 (Function)  .png


Function code:


INSERT INTO [FUNCTION_TABLE] ( fncode, fnarg1, fnarg2, fnarg3, fnarg4, fnvalue )

SELECT DISTINCT

[FUNCTION_CODE],

T98.entity,

0,

0,

0,

CASE WHEN (coalesce((select sum(tt.amount) from [WORKTABLE] tt where (tt.ct_0100_mv = 52428881) AND (tt.flow =7) AND (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl)

AND (tt.accnt = 52428938) AND  (tt.ct_0100_ds in (52428816))  AND (tt.nature = 1)),0))=0 OR ((coalesce((select sum(tt.amount) from [WORKTABLE] tt where (tt.ct_0100_mv in (52428800,52428944,52428881)) AND (tt.flow =1) AND (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl) AND (tt.accnt = 52428938) AND  (tt.ct_0100_ds in (52428816)) AND (tt.nature = 1)),0))+ (coalesce((select sum(tt.amount) from [WORKTABLE] tt where (tt.ct_0100_mv = 52428816) AND (tt.flow =6) AND (tt.ct_0100_ai = 52428916) AND (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl)

AND (tt.accnt = 52428938) AND (tt.ct_0100_ai = 52428916) AND (tt.ct_0100_ds in (52428816)) AND (tt.nature = 1)),0))+(coalesce((select sum(tt.amount) from [WORKTABLE] tt where (tt.ct_0100_mv = 52428836) AND (tt.ct_0100_ai = 52428916)  AND (tt.flow =6) AND  (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl)

AND (tt.accnt = 52428938) AND  (tt.ct_0100_ds in (52428816)) AND (tt.nature = 1)),0)))=0

THEN

0

ELSE

((coalesce((select sum(tt.consamount) from [WORKTABLE] tt where (tt.flow = 1) AND (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl) AND

(tt.accnt = 52428938) AND (tt.ct_0100_mv in (52428800,52428944,52428881)) AND (tt.ct_0100_ds = 4) AND (tt.nature in (52428804,52428852))),0)) + (coalesce((select sum(tt.consamount) from [WORKTABLE] tt where (tt.flow = 6) AND (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl) AND

(tt.accnt = 52428938) AND (tt.ct_0100_mv = 52428816) AND (tt.ct_0100_ai = 52428916) AND (tt.ct_0100_ds = 4) AND (tt.nature = 52428804)),0))+(coalesce((select sum(tt.consamount) from [WORKTABLE] tt where (tt.flow = 6) AND (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl) AND

(tt.accnt = 52428938) AND (tt.ct_0100_mv = 52428836) AND (tt.ct_0100_ai = 52428916) AND (tt.ct_0100_ds = 4) AND (tt.nature = 52428807)),0))) /

((coalesce((select sum(tt.amount) from [WORKTABLE] tt where (tt.ct_0100_mv in (52428800,52428944,52428881)) AND (tt.flow =1) AND (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl) AND (tt.accnt = 52428938) AND  (tt.ct_0100_ds in (52428816)) AND (tt.nature = 1)),0))+ (coalesce((select sum(tt.amount) from [WORKTABLE] tt where (tt.ct_0100_mv = 52428816) AND (tt.flow =6) AND (tt.ct_0100_ai = 52428916) AND (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl)

AND (tt.accnt = 52428938) AND (tt.ct_0100_ai = 52428916) AND (tt.ct_0100_ds in (52428816)) AND (tt.nature = 1)),0))+(coalesce((select sum(tt.amount) from [WORKTABLE] tt where (tt.ct_0100_mv = 52428836) AND (tt.ct_0100_ai = 52428916)  AND (tt.flow =6) AND  (tt.entity = T98.Entity) AND (tt.ct_0100_sl = T98.ct_0100_sl)

AND (tt.accnt = 52428938) AND  (tt.ct_0100_ds in (52428816)) AND (tt.nature = 1)),0)))

END

FROM

[WORKTABLE] T98,

CT_ACCOUNT T02

WHERE

T02.name in ('241500')

AND

T98.accnt = T02.id



Shedules:

Screenshot 6 ( Package data)

Screenshot 6 ( Package data).png

Screenshot 7 (shudule cons.)

Screenshot 7 (shudule cons.).png

Result of function in PL/SQL Developer:

 

Screenshot 8 (SQL)

Screenshot 8 (SQL).png

 

Can you help me please?


Viewing all articles
Browse latest Browse all 3363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>