Показать сообщение отдельно
Старый 18.10.2019, 10:45   #4  
dech is offline
dech
Участник
Аватар для dech
Самостоятельные клиенты AX
 
643 / 347 (13) ++++++
Регистрация: 25.06.2009
Адрес: Омск
Записей в блоге: 3
I see in your code if startDateTime contains current 2019 year then endDateTime should contain the date of 2018 year:
X++:
endDateTime     = DateTimeUtil::addYears(startDateTime, -1);
Here you substract the value of 1 year from startDateTime and assign result to endDateTime. Such conditions do not allow you to get something else than nothing.
Цитата:
Сообщение от Ventainais Посмотреть сообщение
I think the while select statement looks correct.
No, it doesn't look correct. Due to your current conditions in a case when docuRef.TypeId != #SPP you should pull the records for any company (RefCompanyId) and any table (RefTableId). I'm sure you pulled the records with empty TypeId field right for this case. Enclose following code in additional braces and you will see the difference.
X++:
             (docuRef.createdDateTime >= startDateTime   &&
              docuRef.createdDateTime <= endDateTime     &&
              docuRef.TypeId == #SPP) || docuRef.TypeId != #SPP
P.S. if endDateTime is current date and time you can omit this condition and wrinte only
X++:
docuRef.createdDateTime >= startDateTime
__________________
// no comments

Последний раз редактировалось dech; 18.10.2019 в 10:50.