Matrix problem

bRahmsbRahms Member Posts: 44
hi,

we're making a customized matrix box with as SourceTable Date. The horizontal rules displays the staff members and the matrix is filled with their tasks they have planned that day.

So far, so good, but what we want seems to be harder as we thought. When a staff members plans a task (eg TASK01 from 28/07/07 till 30/07/07), the matrix box only fills in the startdate. What we want, is that the period is filled with the taskname.

Is this possible?

This is what we have to fill in the startdate:
codAgenda := '';
idx := 0;
recAgenda.RESET;
recAgenda.SETCURRENTKEY(EmployeeID,TaskID,StartDateSub);
recAgenda.SETRANGE(StartDateSub,CurrForm.PlanMatrix.MatrixRec."Period Start");
recAgenda.SETRANGE(EmployeeID,ID);
IF recAgenda.FINDFIRST THEN BEGIN
  recTask.SETRANGE(ID, recAgenda.TaskID);
  IF recTask.FINDFIRST THEN BEGIN
     FOR idx := recAgenda.EndDateSub - recAgenda.StartDateSub DOWNTO 0 DO BEGIN
         codAgenda := recAgenda.TaskID;
     END;
    END
END;

Answers

  • ufukufuk Member Posts: 514
    I didn't exactly understand what you said but I think you want to show the tasks in the right side of the matrix and the left side shows the staff members. And you are seeing starting date instead of the tasks??

    If I understood right you have to change to sourceExpr in the left side (starting date?) and place a variable (for the tasks name) which you can get by the rec's starting date,ending date filters on the OnAfterGetRecord of the matrix.
    Ufuk Asci
    Pargesoft
  • bRahmsbRahms Member Posts: 44
    No.

    What I've got
    Staff Member 01
    Task 01 -> Stardate 28/07/07
    -> EndDate 31/07/07

    Matrix:
                    27/07    28/07     29/07     30/07   31/07
    Staff 01                  T01 
    

    What i want:
                  27/07    28/07     29/07     30/07    31/07
    Staff 01                 T01       T01        T01
    
  • bRahmsbRahms Member Posts: 44
    Maybe with a SETFILTER i can 'undo' my range so it can be filled that way?
  • ufukufuk Member Posts: 514
    I didn't understand why you filter recTask instead of looping in recAgenda.
    Have you tried to filter starting date and ending date by setfilter and assign the value to codAgenda in that loop. Something like:

    codAgenda := '';
    idx := 0;
    recAgenda.RESET;
    recAgenda.SETCURRENTKEY(EmployeeID,TaskID,StartDateSub);
    recAgenda.SETFILTER(StartDateSub,'>=%1',CurrForm.PlanMatrix.MatrixRec."Period Start");
    recAgenda.SETFILTER(StartDateSub,'<=%1',CurrForm.PlanMatrix.MatrixRec."Period End");
    recAgenda.SETRANGE(EmployeeID,ID);
    IF recAgenda.FINDFIRST THEN BEGIN
    REPEAT
    codAgenda := recAgenda.TaskID;
    UNTIL recAgenda.NEXT = 0;
    END;
    Ufuk Asci
    Pargesoft
  • krikikriki Member, Moderator Posts: 9,110
    Each cell can only be filled on the moment Navision is displaying it.
    So in the cell of the matrix, you need to put some code to get a value to show.
    See http://www.mibuso.com/howtoinfo.asp?FileID=13 on how to do it.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • bRahmsbRahms Member Posts: 44
    Thank you for your help ufuk (and kriki), but now it starts to fill in the TaskID from the beginning until the end of time instead of the end of the task.

    I'm trying to find an answer on this, if you know an answer, let me know!
  • krikikriki Member, Moderator Posts: 9,110
    bRahms wrote:
    Thank you for your help ufuk (and kriki), but now it starts to fill in the TaskID from the beginning until the end of time instead of the end of the task.

    I'm trying to find an answer on this, if you know an answer, let me know!
    What code do you use to fill a cell?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • bRahmsbRahms Member Posts: 44
    The code ufuk gave me

    PlanMatrix - OnAfterGetRecord()

    codAgenda := '';
    recAgenda.RESET;
    recAgenda.SETCURRENTKEY(EmployeeID,TaskID,StartDateSub);
    recAgenda.SETFILTER(StartDateSub,'<=%1',CurrForm.PlanMatrix.MatrixRec."Period Start");
    //recAgenda.SETFILTER(StartDateSub,'>=%1',CurrForm.PlanMatrix.MatrixRec."Period End"); // doesn't seem to do a thing
    recAgenda.SETRANGE(EmployeeID,ID);
    IF recAgenda.FINDFIRST THEN BEGIN
    REPEAT
    codAgenda := recAgenda.TaskID;
    UNTIL recAgenda.NEXT = 0;
    END;

    Or isn't it that you mean?
  • bRahmsbRahms Member Posts: 44
    Solved with adding an extra IF into the repeat

    IF recAgenda.EndDateSub +1 >= CurrForm.PlanMatrix.MatrixRec."Period End" THEN
Sign In or Register to comment.