Macro to update "data source" property on the Writer form of a template

My environment: Windows 10, LibreOffice Version: (x64) HSQLDB Version 2.3.2 Split Database

On the “When Loading” event of a writer template, I pick up the template’s location with thisComponent.url from which I can diagnose the location and name of the database I need to reference on the form’s “data source” property.

Browsing through documentation I could not find the syntax to place that diagnosed value to the form’s “data source” property.

Can someone help please?
Thank you


What may be of great help is the use of MRI (have given you this info in past post).

With a quick test on a standalone Writer form was able to modify the source from one to another using the code generated from MRI:

The code is simple and here used registered database names.

@Ratslinger many thanks, that worked fine. Your pic inspires to get MRI, I know you recommended this extension earlier, when I looked at it then I interpreted that I should get ahead on basic LO usage before moving to extensions and learning yet another package. But I will install and study now, I’ve already processed a large part of my old vba code meantime. Thank you for your precious help that has allowed me to move ahead more quickly with more result, and in particular, learn from each hurdle and problem solved to better solve the next one