Load the same Json data source multiple times

Stimulsoft Reports.JS discussion
Post Reply
User avatar
reportier
Posts: 2
Joined: Thu Jun 14, 2018 11:32 am

Load the same Json data source multiple times

Post by reportier »

Hi all

I'm currently working withe the Stimulsoft Designer (version 2018.2.2 from 27 April 2018, JS).

I have an application which has a Rest API with the following endpoints: What I'm trying to do no in the Designer is:
I want to get the list of categories and display the category name as a title, followed by the pet names of that category (table).
Then on the next page, again the category name of the second category, followed by the pet names of that category.

So now I have two JSON data sources (one for the categories list, one pets list).
I also know that I can have variables and use them in the path to the JSON data source. But I think this does not solve my problem.

Basically what I want is that the pets endpoint is called multiple times (1 call by category) when generating the report with the category ID.
Since the categories list returned of the first data source is unknown, I can't just add all category pets data sources by hand. This has to happen automatically when generating the report.

My question right now is:
Is there a way to achieve what I want?
(without coding, only configuration)

Thank you in advance.
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Load the same Json data source multiple times

Post by Lech Kulikowski »

Hello,

Yes, it is possible.
You can add the relation between categories and pets and use master-detail construction. Also, you can set NewPageBefore for master band, in this case, each category ID will be started from new page.

Thank you.
User avatar
reportier
Posts: 2
Joined: Thu Jun 14, 2018 11:32 am

Re: Load the same Json data source multiple times

Post by reportier »

Lech Kulikowski wrote: Sun Jun 17, 2018 8:13 am Hello,

Yes, it is possible.
You can add the relation between categories and pets and use master-detail construction. Also, you can set NewPageBefore for master band, in this case, each category ID will be started from new page.

Thank you.
Hi Lech,

Thank you for you reply.

If I understand you right, this will only work if have have a /pets endpoint that returns all pets from all categories in a single call. Is that right?
But this is something I don't have. I can just get a list of pets per category. So I have to iterate through the categories and do single calls to the /categories/{categories.id}/pets endpoint.

For example:
If /categories endpoint returns me two categories (IDs 1 and 2), then I want to configure Stimulsoft to do two call to to /categories/1/pets and /categories/2/pets.

Right now I'm trying to do that with a sub report for the pets and by changing pets Json data source /categories/{categories.id}/pets (I saw that you can use variables in the data source path name).
But no luck until now.

Is there anything I can do?

Thank you.

PS: This is my my current .mrt file.
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Load the same Json data source multiple times

Post by Lech Kulikowski »

Hello,

> But this is something I don't have. I can just get a list of pets per category. So I have to iterate through the categories and do single calls to the /categories/{categories.id}/pets endpoint.
Right now I'm trying to do that with a sub report for the pets and by changing pets Json data source /categories/{categories.id}/pets (I saw that you can use variables in the data source path name).

Unfortunately, directly in the report in the JS version, it is not possible to implement. You can load all data for categories and pets and then - "... add the relation between categories and pets and use master-detail construction".

Thank you.
Post Reply