1 Links SQL-Table

In this example, taking the box of invoice lines from the previous example, a link to the name of the song is added to the song master.


An adjustment is made on the SQL statement of the SQL-Table, adding the column 'track.trackid' so that it can be used as a value in the link.

Copy
<select>
    <columns>
        track.trackid,
        track.name,
        invoiceline.unitprice,
        invoiceline.quantity
    </columns>
    <from table='invoice'>
        <join table='invoiceline'>
            <on>invoiceline.invoiceid = invoice.invoiceid</on>
            <join table='track' type='left'>
                <on>invoiceline.trackid = track.trackid</on>
            </join>
        </join>
    </from>
    <where>
         invoice.invoiceid = #invoiceid
    </where>
    <order>3 DESC</order>
</select>


The column 'trackid' is added to the output fields, but with the condition of hiding '1 == 1', because it does not matter if the column appears in the form.



The link is added:



Note that the statement contains in the filter 'track.trackid = #trackid' the value of '#trackid' comes from the SQL statement of the SQL-Table.


Result:


In this way, by clicking on the name of the song, the song master object 'track' is opened, of the song clicked on the link.