MyTetra Share
Делитесь знаниями!
Кол-во уникальных входов по контрагентам
Время создания: 06.07.2020 12:22
Раздел: INFO - JOB - rtneo - Выгрузки
Запись: wwwlir/Tetra/master/base/15940093571uorzwuw9s/text.html на raw.githubusercontent.com

select count(distinct c.name) from rtneo$Contragent c join sec$SessionLogEntry s where c.legalAddress like '%Саянск%' and c.user = s.user

Кол-во уникальных входов по контрагентам


select count(distinct c) from rtneo$Contragent c where c.user is not null and c.legalAddress like '%Черемхово%'



import com.groupstp.rtneo.entity.*

import com.haulmont.cuba.core.global.*;


DataManager dataManager = AppBeans.get(DataManager.NAME)


LoadContext<Contragent> load = LoadContext.create(Contragent.class)

.setQuery(LoadContext.createQuery('select c from rtneo$Contragent c'))

.setView("_minimal");

def countContragentAll = dataManager.getCount(load);


log.debug("Количество контрагентов = ${countContragentAll}");


load.setQuery(LoadContext.createQuery('select distinct c from rtneo$Contragent c where c.user is not null'));

def countContragentUser = dataManager.getCount(load);


log.debug("Количество контрагентов с пользователем = ${countContragentUser}");

load.setQuery(LoadContext.createQuery('select distinct c from rtneo$Contragent c join sec$SessionLogEntry s where c.user = s.user'));

def countUnique = dataManager.getCount(load);


log.debug("Уникальных входов = ${countUnique}");

log.debug("Процент от контрагентов = ${countUnique/countContragentAll*100}%");

log.debug("Процент от контрагентов с пользователем = ${countUnique/countContragentUser*100}%");


Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования