RtBaseline allows us to pull in data from external sources into our report. In this case I'd like to
pull in a list of ingredients based on the recipe which is at the procedure level of my
event frame. Let's go ahead and hop into SQL and take a look at the data that I'd like to bring
in. Here I'm in SQL server management studio and I have a database called batch recipes.
Within that database is a table called recipe. If I open up that table and look at all the rows
you can see that there are rows with a recipe of recipe 1A and there's some ingredients in their
quantities and there is additional information for other recipes with their ingredients and
quantities. I'd like to be able to bring this particular information into my report
when my event frame has a recipe of recipe 1A. This is configured through RtBaseline which is
done on the admin page for RtReports so let me head on over to the RtReports machine and I'll
login to the admin page. This is forward slash admin forward slash admin aspx. I've already set
up the data source here and the data source is called batch data and it's configured to connect
to my SQL server and here's the connection string. You can follow the documentation
on how to set up the relational data source. Once you have a relational data source setup
you need to set up the data set. In this case again my data source is batch data and within
that I have a data set called recipes and my SQL statement is to select all the data
from the batch recipes database from the recipe table where the recipe equals a certain value.
So that recipe equals a certain value as a placeholder that I'm going to need to send
over from RtReports to make sure that I select the correct rows. Let's go into the RtReports editor
and set up that journal action which can pull in the correct information then from this recipes
data set. So go ahead and open up the editor and I'm going to open my potion 1A compliance report
and check it out for editing which it already is. I'm going to add a new journal action, at the
batch level, and I'm going to call it ingredients. Under results definitions I'm going to add a new
one. This is going to be an RtBaseline services data set and I'm going to select recipes because
that was my data set. I noticed here that we have one placeholder that we need to specify. There are
some variables in RtReports that have placeholders and in this case, you can just specify them
directly. S I do square bracket recipe square bracket and I'll click OK. I'll choose an event
frame to test this report and you can see that my recipe is a recipe 1A, so I expect the following
information is going to get pulled into the journal. This will be under journal events,
here's my journal event for ingredients. I'll check my terminal state and here are my events.
If you look here's value of 4 for water, a value of 0.5 for spice, and a value of 1 for sugar.
Now let's bring that into our report. Here's my report, so what I'd like to do is place a
table directly under a recipe 1A that has the list of ingredients. So I'll go to my format
template and find this section in the report and probably right here after this recipe,
so let me go ahead and we'll try insert table and one row is going to be for the header and then the
following rows are going to be iterated on so I only need two rows and then for columns I'd
like one column with the name of the ingredient and one column with the quantity. So, I'm gonna
have two columns. So, for this first row I'll insert the text saying ingredient and the next
one I'll say insert text and this will be quantity and for the second row this needs to be iterated
on so I double click on that and in the iterator we are going to be iterating on the properties
and then within them I'm going to say insert data and the first one is going to be this one here,
and the next one is going to be the quantity. Let me go ahead and save this and I'll refresh
my report and we'll see if it looks like what we want. And that's actually exactly what I wanted
except I'm missing some of the outline, so I'll go back in there move it into the one slightly higher
location, so this one you're here and I'm gonna add the border in, let's make sure it's the same
as the other it's a border of two. Yes, so I’ll view, refresh and here now it's in the correct
location and I've pulled in data from an external SQL source based on the recipe.