How to Use Workflow Variables in Report Titles
In my workflow I have a form that the user enters a Truck ID and a range of dates using 2 DatePickers. I have my report set up and it works great. However, I want to use the variables entered in the form in the Report Page Header/Title.
My form input variables are:
strSelectTruck = User input of truck ID
strStartDate = Start Date from DatePicker1 as string format
strEndDate = End Date from DatePicker2 as string format
I would like my Report Title to read something like: "Truck & Location Information for Truck: ' TruckID' From ' Start Date' - End Date' "
Is this possible? If so, how do I get it to work? I assume I have to carry those values over in the templateReport process or do I have to a sub-report?
-
Hi Mark,
Create a title for your report is possible, I have recently done it and used it on a Map Title.
First off you'll have to make sure that your date ranges and TruckID coming from the form are exposed as output arguments (my argument was reportYear ). You'll then have to create a variable and use an Assign Task to hold your formatted title, something like TITLE = "Truck & Location Information for Truck: " + TruckID + "From + "StartDate.ToString +" - " +EndDate.ToString .
Once you have created this variable, in the Report Activity (under the Common Client Activities) you can specify a Text Field argument which accepts a dictionnary of text values that can be submitted to the report. You can supply your title string variable using the format below (I know this works for both the PrintMap and Report Activities, not sure about Template Report).
New System.Collections.Generic.Dictionary(Of String, String) From { { "_Title", TITLE }}
Note: you should be able to find the _Title variable in the report designer.
Hope this helps,
-Warren
0 -
Warren,
I am using a Template Report and would like to keep using it vs. builidng a completely new Report. Does anyone know how to pass these values to a Template Report?
-Mark
0 -
Hi Mark,
I did a search and your question should be answered in this post that Latitude replied to, there should even be a workflow example from the code gallery that you can download to reference.
https://support.geocortex.com/SupportForums/Thread.aspx?pageid=0&mid=2&ItemID=20&thread=57163
From my quick skim it is pretty much exactly as I described on the workflow side but you'll just have to add a container for your Report Title in the Report itself.
-Warren
0 -
Warren,
I used this code example to build my workflow and report and got it to work. However, I am having issues adding a second dictionary and handling how that data gets passed to the report.
Here is my sequence to generate the new Dictionary:
/customer/servlet/servlet.FileDownload?file=00P6000000em1TYEAY
My query for the 'AddToDictionary' Value is: "Truck & Location Information for Truck: " + strSelectTruck + "From: " + strStartDate + " - " + strEndDate
In the report I've tried the following for 'DateField':
- _Title
- dictionaryTitle("_Title")
- reportTitle
I'm sure I'm missing something simple.
0 -
Hi Mark
just as a real dictionary has more than one entry, ie word and definition, the dictionary that you have already made just needs another entry ising the 'Add To Dictionary' activity.
Regards
Ralph
0 -
Ralph,
Thanks! That did it. I assumed since I was trying to pass a string,string dictionary itme (vs. a string,object) that I needed a second dictionary.
-Mark
0 -
Hi Mark
you are indeed passing a Dictionary that is holding a collection of Key Value Pairs. In this case both the Key and theValue are strings.
Check out http://www.vcskicks.com/dictionary.php
Regards
Ralph
0 -
Whoops,
Sorry, I posted too late.
Warren
0
Please sign in to leave a comment.
Comments
8 comments