Forums

Custom Email / Multiple Selections

jformicola 07 Feb, 2020
Hi!

I'm trying to have the data from the below "Read data" show up on a custom email. The issue is that there are multiple values stored in "TrainedTopics" how do I get them all to end up in the email?





  [read_data36] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Data36`.`ID` AS `Data36.ID`, `Data36`.`subject` AS `Data36.subject`, `Data36`.`Notes_For_Trainer` AS `Data36.Notes_For_Trainer`, `Data36`.`Instruction_Resource_1` AS `Data36.Instruction_Resource_1`, `Data36`.`Instruction_Resource_2` AS `Data36.Instruction_Resource_2` FROM `tbltrainedtopics` AS `Data36` WHERE `Data36`.`ID` IN ('2', '3') LIMIT 100;
                )

            [var] => Array
                (
                    [0] => Array
                        (
                            [Data36] => Array
                                (
                                    [ID] => 2
                                    [subject] => MRI - Navigate the Calendar
                                    [Notes_For_Trainer] => difference between navigating and advancing
                                    [Instruction_Resource_1] => http://trainkamson.com/index.php?option=com_content&view=article&id=20
                                    [Instruction_Resource_2] => 
                                )

                        )

                    [1] => Array
                        (
                            [Data36] => Array
                                (
                                    [ID] => 3
                                    [subject] => MRI - Adding a Guest Card
                                    [Notes_For_Trainer] => 
                                    [Instruction_Resource_1] => http://trainkamson.com/index.php?option=com_content&view=article&id=20
                                    [Instruction_Resource_2] => 
                                )

                        )

                )

        )
healyhatman 08 Feb, 2020
{var.join[<br>]:read_data36.[n].Data36.subject}
jformicola 08 Feb, 2020
oh nice, seems crafty, thanks! So that uses the join function to create a list one on each line? I also want to output the resource 1 and resource 2 for each of the subjects too. So I imagine I can use the same code for those two fields and put them in some sort of html to create a table structure right? Will the alignment be off if there is a null in resource 2 for some of the selections?

I'm trying to get this basic structure in the table

Subject | Resource 1 | Resource 2
Subject1 | Resource 1-1 | Resource 2-1
Subject 2 | Resource 1-2| Resource 2-2
etc.
healyhatman 08 Feb, 2020
Well use a table then if you want it in a table🙂
jformicola 08 Feb, 2020
Haha, ok thanks! Sorry, I haven't done most of these things before so I don't know what works. So it sounds like you've given me all the pieces I need (other than an HTML table structure, but I can google that I imagine) I'll try Monday. Thanks for your help!
jformicola 10 Feb, 2020
Hi healyhatman!

This is what I came up with. Seems to work except I can't get there to be borders between each row. I've tried a bunch of things from the internet, but they don't seem to be working. Is there anyway you might be able to help with that? I just want there to be a black line between each row and nothing seems to work...

<head>
<style>
table, th, td {
padding: 10px;
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<table>
<tr>
<th>Subject</th>
<th>Resource 1</th>
<th>Resource 2</th>
</tr>
<tr>
<td> {var.join[<br>]:read_data36.[n].Data36.subject}</td>
<td>{var.join[<br>]:read_data36.[n].Data36.Instruction_Resource_1}</td>
<td >{var.join[<br>]:read_data36.[n].Data36.Instruction_Resource_2}</td>
</tr>
</table>
</body>
jformicola 10 Feb, 2020
What I mean is if it would just show the row/cell borders, that would be perfect.
healyhatman 10 Feb, 2020
Just add style to it, like <td style="border: 1px solid black"> for example
jformicola 11 Feb, 2020
Thanks, but that didn't work. I think I just realized why. It is seeing that whole block as one cell do to the way we're getting our data via the join, no? So I guess I'll just have to live with it?
jformicola 24 Feb, 2020
Hi healyhatman!

I ended up using this same idea for another form I'm using, which creates a printable pdf checklist with the tcpdf function. Is there a way to get a checkbox to display before each line here? Thanks!

<table>
<tbody>
<tr>
<th>Subject</th>
<th>Notes</th>
</tr>
<tr>
<td style="border: 1px solid black;">{var.join[<br />]:read_data19.[n].Data19.subject}</td>
<td style="border: 1px solid black;">{var.join[<br />]:read_data19.[n].Data19.Notes_For_Trainer}</td>
</tr>
</tbody>
</table>
healyhatman 25 Feb, 2020
You can either just put in <input type="checkbox"> or use any of the unicode boxes like ☐
jformicola 25 Feb, 2020
Thanks Healy, I surmised as much, I just can't figure out where to put that into the html above to have the it display before each row (not for a lack of trying either) Any chance you can just tell me where to put it exactly and put me out of misery?
healyhatman 25 Feb, 2020
as part of the join. [<br>boxicon]

Don't forget to put a box in for the first row though
jformicola 26 Feb, 2020
I couldn't get a checkbox unicode or otherwise to work, but the curly brackets did, so that should be fine... thanks!

<td style="border: 1px solid black">{}{var.join[<br>{}]:read_data19.[n].Data19.subject}</td>
<td style="border: 1px solid black">{var.join[<br>]:read_data19.[n].Data19.Notes_For_Trainer}</td>
This topic is locked and no more replies can be posted.