OL Learn

How to set parameter values to be used in dynamic sql in data mapper configuration

Here is my setup
Data Mapper
image
image

Workflow:
image




image

Everything works. Now I would like to get the report for a different contract id than the default.
I can get the parameter in the request by using XMLGet; however I am not sure where and how to populate the value into the ContractID parameter I configured in data mapper and use it to pull data from database for the different contract id.

I am new to this and would appreciate any help I can get.

Thanks

You did everything right. There is, however, a shortcoming in the Create Preview PDF task: it doesn’t allow you to specify runtime parameters, which is what you need here. Fortunately, there’s an easy workaround: immediately before your Create PDF Preview task, add a Execute Data Mapping task, where you can set the Runtime Parameter properly. Set the task’s Output Type to JSON.
So after this task runs, you current job file will be a JSON file containing the proper records.

Then, in the Datamapper tab of your existing Create PDF Preview task, set the source to JSON and the JSON String to %c (a system variable used to read the entire contents of the job file).

That should do it.

Thanks for your reply Phil. I actually abandoned the Preview PDF plugin and used the All in One plugin and was able to get the desired results. I will test out your solution too for my learning.

Here is what my workflow looks like now

One important note for anyone else interested in this issue, I had to change the option in Output management setting of the Output Creation Tab to “Through Workflow” in order for it to send the PDF as a response of the web request

image

Yep, that works fine as well. It requires slightly more overhead than the Create Preview PDF task because it involves the Job Creation and the Output Creation services, but unless you have a very high load of documents to be processed you will probably never notice the difference.