Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i am going to maintain Vacation Maintanace report
in my table I have only present date only
how to calulate leave days
Create a calendar table with automate script based on the least date and max date.
Example
TempMinDate:
LOAD
Min(Date) AS MinDate
RESIDENT TableName;
LET vDateMin = FieldValue('MinDate', 1);
LET vTodayNum = Num(Today());
DROP TABLE TempMinDate;
SalesDates:
LOAD
($(vDateMin) + (RecNo()) - 1) AS Date,
RecNo() AS DateRecNo
AUTOGENERATE ($(vTodayNum) - $(vDateMin) + 1);
I Have Table like this
ID PresentDATE
1 12/2/2013
2 12/2/2013
1 13/2/2013
1 14/2/2013
2 15/2/2013
i need to calculate leave days
with the next code
TempMinDate:
LOAD
Min(PresentDATE) AS MinDate
RESIDENT TableName;
LET vDateMin = FieldValue('MinDate', 1);
LET vTodayNum = Num(Today());
DROP TABLE TempMinDate;
SalesDates:
LOAD
num($(vDateMin) + (RecNo()) - 1) AS DATE
AUTOGENERATE ($(vTodayNum) - $(vDateMin) + 1);
left join (SalesDates)
LOAD Distinct ID
Resident TableName;
You have the table SalesDate with all dates for each ID
and you can show or sum (depends or your requeriment) in your layout the leave days