Copy link to clipboard
Copied
X X does someting
Y Y does someting
Z Z does someting
I want to display the result of this query in a table which is shown below, I can get to show the results with a loop or through explicitly calling the query as getNamesandRoles.displayName[1] and so on, but I can figure out how to loop thru the query in a way that would skip the first row where the ID (i.e. all the scope="row") and populate the data in the other two Td's dynamically so that it we have more users it creates those TD's related to the ID. Can i accomplish this ?
<thead>
<tr>
<th scope="col">SomeroleID</th>
<th scope="col">First</th>
<th scope="col">Last</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">RoleFunction</th>
<td>X</td>
<td>X does someting</td>
</tr>
<tr>
<th scope="row">RoleFunction1</th>
<td>Y</td>
<td>Y does someting </td>
</tr>
<tr>
<th scope="row">RoleFunction</th>
<td>z</td>
<td>Z does someting </td>
</tr>
</tbody>
</table>
Copy link to clipboard
Copied
I'm not sure I understand your question. Is this what you're looking for?
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">SomeroleID</th>
<th scope="col">First</th>
<th scope="col">Last</th>
</tr>
</thead><tbody>
<cfoutput query="queryName">
<tr>
<th scope="row">RoleFunction</th>
<td>#queryName.colA#</td>
<td>#queryName.colB#</td>
</tr>
</cfoutput>
</tbody>
</table>
V/r,
^ _ ^
Copy link to clipboard
Copied
No, that is not what i was looking for. I guess my question is about looping through the query and appending the values sequentially in dynamically created TD's for Some header, Some other header , and Something else entirely. Some way to populate a table but skipping the first TD.
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">SomeroleID</th>
<th scope="col">First</th>
<th scope="col">Last</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Some header </th>
<td>X</td>
<td>X does someting</td>
</tr>
<tr>
<th scope="row">Some other header </th>
<td>Y</td>
<td>Y does someting </td>
</tr>
<tr>
<th scope="row">Something else entirely</th>
<td>z</td>
<td>Z does someting </td>
</tr>
</tbody>
</table>
Copy link to clipboard
Copied
Hi Userfromcoloroado, I have read your question a number of times. I still don't understand what you're asking.
Copy link to clipboard
Copied
I agree, which is why I have not chimed in. It seems like you need to add at least a few more lines to demonstrate the variability you keep referring to.
Copy link to clipboard
Copied
Apologies about being unclear.
DATA from Query getNamesandRoles
DISPLAYNAME JOBROLE
X X does someting
Y Y does someting
Z Z does someting
I want to populate the data in the format of the expected table with a loop so that the <td> for the headers are skipped but we can poplate displayname and Job role.
Thank you.
Copy link to clipboard
Copied
Assuming the column names are roleFunction, displayName and jobRole, then you perhaps want something like
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">Role ID</th>
<th scope="col">Name</th>
<th scope="col">Role</th>
</tr>
</thead>
<tbody>
<cfoutput query="getNamesandRoles">
<tr>
<th scope="row">#getNamesandRoles.roleFunction#</th>
<td>#getNamesandRoles.displayName#</td>
<td>#getNamesandRoles.jobRole#</td>
</tr>
</cfoutput>
</tbody>
</table>
Copy link to clipboard
Copied
Essentially the same thing I suggested. OP indicated negatory. (shrug)
V/r,
^ _ ^
Copy link to clipboard
Copied
The only other thing that I can think of is that the OP is looping within the TR, which doesn't make any sense, to me.
V/r,
^ _ ^