Month

How to get the month values

For example January = 1 , …

The month should be selected in enum

Can you provide ur requirement in detail?

Hi,

Have you looked at MonthsOfYear enum?

I have enum of months of january to december

In that enum i want to compare it with DeliveryDate in Report.

How did i can compare it

i write code of

while select purchtable

where purchtable.deliveryDate == enum(months of year)

You can write the condition as mthOfYr(purchtable.deliveryDate) == MonthsOfYear::January, but you can’t use it directly in a query. It’s much better to create ranges for from and to date, if it’s for a single year only. For example, you could write something like:

date monthStart = mkDate(1, MonthsOfYear::January, year(systemDateGet()));
while select purchtable
where purchTable.DeliveryDate >= monthStart
&& purchTable.DeliveryDate <= dateEndMth(monthStart)

If it was not suitable, you could save month number on purchTable and update it every time when DeliveryDate is changed. Or just go through all PurchTable records and use mthOfYr() as mentioned above.