Here is an example channel for download.
The download is a QIE import file. Once downloaded to your computer open QIE and select Application -> Import Configuration and then browse to the file and select open. Select the Channel, Database Connection, and System Variable checkboxes. Also, be sure to check the Import Sample Messages checkbox so as to import the sample messages for testing.
This channel uses a CSV message on the Source node since a Database Query on the Source node will produce a CSV message model. In practice, this can be changed from a CSV message to DBQuery with a relevant query for your needs.
This channel also uses a Template (basic HL7 message in the System Variables) to create the basic HL7 message structure, and then in the first mapping, we call this template to create the HL7 message. The second and third mappings show how to add additional data to the HL7 message using the Standard Mapping Function and Custom Scripts from database queries. Custom scripts would be preferable if you need to apply additional formatting to the data before putting it into the HL7 message otherwise they accomplish the same thing.