We want to link some variable data to our template from a database. Is this possible via an API? For example, we have a product template and our locations in different regions have different pricing for the items displayed on the template. We want to pass a variable into eDoc builder to let it know what Price Bucket to pull the pricing from based on location that is ordering.
There's no way to pull text data for the template from a database in the way you seem to be saying, no.
There are a few options that may get you close though.
1) You can define all the fields in the template as VDP. Your user could then upload a spreadsheet of pricing information. All pricing would have to be on a single row -- it would not be a very pretty spreadsheet.
2) You can define a really long text field that contains all the pricing data. It would expect something like this:
all concatenated into one long string. You would then use vbscript for each actual field:
txtPricingData.Split(";").GetAt(3).Split("=").GetAt(2) -- this would return "5.00"
Finally you'd set this monster variable by passing it in the querystring:
This monster string would be generated from your pricing database and stored somewhere in your storefront as data that should be passed.
3) You can use the API to set up the edoc session, then fill fields with values from your database. You'd have to write a lot of code to get this done.
This assumes that only the pricing is changing otherwsie there really isn't any way to generalize it.