How to use different length tables to build on other one
Hello everyone,
I am trying to build a sort of calender in which i want to see where my projects start and end by month. For each project, I have the name, the start date and the end date and i have already build my calendar from 2019 to 2050 by month as you can see here :
LET vMin = Num(MakeDate(2019));
LET vMax = Num(MakeDate(2050));
MonthAndYear: Load Opportunity, Date("Project Start Date",'M/YYYY') as Start, Date("Project End Date",'M/YYYY') as End Resident Forecast;
Calendar2: LOAD Date(MonthStart($(vMin),IterNo()-1),'MM-YYYY') as "Month-Year"
AutoGenerate 1
While MonthStart($(vMin),IterNo()-1) <= $(vMax);
TmpTable: Load Opportunity as Project_Name,Start as Start_Date,End as End_Date Resident MonthAndYear;
For i=1 to $(RCount) Let ValueofField = FieldValue('Project_Name', $(i)); For j=1 to NoOfRows('Calendar2') Temp: Load FieldValue('Month-Year',$(j)) as "Month-Year", if(((Num("Month-Year")>=num(Start_Date)) & (Num("Month-Year")<=Num(End_Date))),1,0) as '$(ValueofField)' Resident TmpTable Where Project_Name='$(ValueofField)';
Left Join (Calendar2) load * resident Temp;
Drop Table Temp; Next j; Next i;
Drop Table TmpTable;
My problem is that i have to iterate twice to build my final calendar, first on my project to have the start and end date and second on my month calendar to asign & if the considered month is in the project duration and 0 if not. To do that, i have to have access both my table Calendar2 and TmpTable and i can't do it with resident. I also can't join these table because there are no joining field and they have not the same lenght...
Do you have any idea about how to deal with my problem ?