Hi there,
Is there a way to manipulate the document properties of a LINQ template from within the template itself? I would like to set the document property “author” with a value from the data source whilst processing the template. Maybe I could call a custom method and pass the template itself to the cutom method as a parameter?
Many thanks,
Dani
@tibitabi
This is exactly the way to go as there are no other options. Please note that to pass a document instance associated with a template to a custom method, this instance should be passed as one of data sources passed to LINQ Reporting Engine first. Also, the custom method should return a value to be used within a tag (the value can be null, for example). Setting up Known External Types may be helpful in working with custom types in general.
Hi Ivan
Works
Is there a way to declare one of the data sources as default data source? Oherwise, I will have to prefix every data element unsed in the template with the data source name which is not necessary if you use only one data source. That would be very helpful.
Many thanks,
Dani
@tibitabi
Sure, here is a relevant quote from API Reference:
The name of the first data source can be omitted (i.e. be an empty string or null
) if you are going to reference the data source’s members but not the data source object itself. Names of the other data sources must be specified and unique.
So you can pass the concerned data source as the first one and pass a document instance as the second one (the latter needs to be named anyway in order to reference it within a template).
Good moring Ivan,
Sorry, didn’t see the quote in the API Reference. But is works as described, many thanks for your support.
Best regards,
Dani
1 Like