How to run below UIRunner code on additional datasource

Hi,

How to run below uirunner code on additional datasource.

uiReportRunner.byReportCode(“collectionCsvOpsReport”)
//.addParam(“ccapac_location”, listData)
.addParam(“ccapac_location”, generateTableId)
.withParametersDialogShowMode(ParametersDialogShowMode.NO)
.withOutputType(ReportOutputType.CSV).runAndShow();

The data store should be defined in the report band. The “Data store” field is available for SQL and JPQL bands:

image

1 Like

Thank you

Hi,

can we set the same for datamanager and collectionsesDl or collectionsesDC

i tried for below code it seem to be working but how to do this for Dl or Dc

 @PersistenceContext(unitName = "slaveadditional") // store name
    @Autowired
    private DataManager dataManager;

I tried adding below code as per documentation but still Dl id working on primary datasource.

@Transactional("slaveadditionalTransactionManager")
    public void loadData()
    {
                    collectionsesDl.setQuery("select e from user e");
                    collectionsesDl.setSort(Sort.by(Sort.Direction.DESC,"id"));
                    collectionsesDl.load();

}

In Jmix, each entity belongs to a single data store (main by default).

So when you load an entity using DataManager (which is used also by loader in view XML), it requests the data store of the entity. No other indication is needed, the entity is stored in the well known data store.

The only case when you need (and can) specify a store when working through DataManager, is when you load KeyValue entities. There is store("storeName") method in the fluent loading API and store="storeName" attribute of the keyValueCollection or keyValueInstance loader.

If you have identical tables in different data stores, you still need to map them to different entities (even if they differ only by the @Store() annotation) to work with them through DataManager.

1 Like