Hi,
I have to create a contactpage where I have 3 levels (contactarea, office/department, employees) and some rules for the employees, so that specific employees is only shown when an office is shown under a specific business area.
The structure in DW is:
- Contactarea item is created as paragraphs. On the item I can choose which offices to show via. an itemrelationlist where I can point to office pages.
- Office item is created as pages. Employyes is created in an itemlist on theese pages.
On the employee I've also created an itemrelationslist where I can point to contactarea paragraphs, so I'll be able to determine wether or not to show the employee under the specific business area. By doing it like this I think I should be able to do this:
- Business Area 1 (item id = 4)
- Office A
- Employee 1
- Office B
- Employee 2
- Office A
- Business Area 2 (item id = 5)
- Office A
- Employee 3
- Office B
- Employee 4
- Office A
The problem is that (even though I've created an itemrelationslist on the employee pointing to the contactarea) I can't seem to relate the employee to the contactarea.
In the template for the contactarea paragraph I can get the item id for the contact area. Then i loop through the offices and employyes inside like this
foreach (var office in GetLoop("Item.Offices")) {
<h3>@office.GetString("Item.Offices.Name")</h3>
foreach (var employee in office.GetLoop("Item.Offices.Employees")) {
<div>@employee.GetString("Item.Departments.Employees.Areas")</div> /* This is where I would expect to get the value "4" or "5" when pointing to Business Area 1 or Business Area 2, as they have "4" and "5" as item id. Instead I get a new value, each time I delete and create the relation again. This means that I can't really tell if I'm to show the employee or not - because I can't relate the employee to the area, when there's no IDs to compare */
}
}
Please let me know if you don't understand the problem - I'll try to explain it better or send some screenshots from database/paragraph/pages :-)