From 23ca16fb50a30db8662f82346bf8b449434d32cd Mon Sep 17 00:00:00 2001 From: "m.groppe" <m.groppe@adito.de> Date: Tue, 27 Jul 2021 18:02:26 +0200 Subject: [PATCH] [Projekt: xRM-Marketing][TicketNr.: 1082688][CampaignCost: AditoRuntimeException] --- .../netperparticipant_aggregate.value/expression.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/entity/CampaignCost_entity/recordcontainers/db/recordfieldmappings/netperparticipant_aggregate.value/expression.js b/entity/CampaignCost_entity/recordcontainers/db/recordfieldmappings/netperparticipant_aggregate.value/expression.js index 18b449265da..c8a119b9b1b 100644 --- a/entity/CampaignCost_entity/recordcontainers/db/recordfieldmappings/netperparticipant_aggregate.value/expression.js +++ b/entity/CampaignCost_entity/recordcontainers/db/recordfieldmappings/netperparticipant_aggregate.value/expression.js @@ -1,3 +1,6 @@ import("system.result"); -result.string("SUM(CAMPAIGNCOST.NET/(select COUNT(*) from CAMPAIGNPARTICIPANT where CAMPAIGNCOST.CAMPAIGN_ID = CAMPAIGNPARTICIPANT.CAMPAIGN_ID " - +" and CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID = CAMPAIGNSTEP.CAMPAIGNSTEPID))"); \ No newline at end of file + +var countSql =" (select COUNT(*) from CAMPAIGNPARTICIPANT where CAMPAIGNCOST.CAMPAIGN_ID = CAMPAIGNPARTICIPANT.CAMPAIGN_ID " + +" and CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID = CAMPAIGNSTEP.CAMPAIGNSTEPID)"; + +result.string(" SUM(CAMPAIGNCOST.NET/( case when "+countSql+" != 0 then "+countSql+" else 1 end)) "); \ No newline at end of file -- GitLab