Page 1 of 1

Array view

Posted: Thu Jan 30, 2014 3:23 pm
by olivierh
Hello,

I want to make a basic workflow manager to manage the production of report in accordance with deadlines.

In summary , I have two tables stored in MySql

Table 1: Report
Report Name
DeadlineGroup

Table 2 : Timeline
DeadlineGroup
Monthofthereport
Deadline

example

table 1
Analysis report 1
Inspection report 2

table 2
1 January 02/15/2014
1 February 03/15/2014
2 February 03/20/2014
...

in my simplified example above, the group reports 1 and 2 are required respectively for 15 and 20 the following month, but this is obviously not always the same dates

I do a join between the two tables to get the deadline of each report, but I would like to display the results in html as follows

Code: Select all

                                                        january              february                   march ...
Analysis Report                                          15/02                  15/03   
inspection report                                                                                        20/ 03

 
I tried many combinations of loops, but each time I block on positioning due dates in the right columns (months)

Thank you for your help

Re: Array view

Posted: Thu Jan 30, 2014 3:44 pm
by requinix
What do you have so far? It'll probably be easier to work with that then to start from scratch.

Re: Array view

Posted: Thu Jan 30, 2014 3:55 pm
by olivierh
what I have so far is just a table in which I have all the information, i.e

Code: Select all

Report                   Group       Monthofreport           January           February            March
Inspection report       2             February                   03/20
Analysis report           1             January                   02/15

with the deadline always in the same column

I was reading a topic which seems close to mine : viewtopic.php?f=1&t=139049
and for which you design the answer.

1. Start with an empty array
2. Loop through the rows returned by the query
3. If the array does not already have an item for the "report", add it
4. Set the deadline record, like $array[report][Monthofreport] = deadline value

I think I could move forward if I knew how to achieve the step 3

many thanks in advance