Posted 30 November 2023, 10:50 am EST - Updated 30 November 2023, 10:55 am EST
Access parameters outside ActiveReportsJs
Posted by: arian on 30 November 2023, 10:50 am EST
-
-
Posted 1 December 2023, 5:47 am EST
Hi Arian,
The viewer has an event ‘reportLoaded’ which gets called when the report gets loaded after the ‘viewer.Load()’ method but before the parameters are passed into the report. However, this event receives the report JSON as an argument you can store this into a variable and then also handle the ‘documentLoaded’ event of the viewer which gets called when the parameters are passed into the report and the report document is loaded into the viewer.
In the handler for the ‘documentLoaded’ event, you can use your report variable to get the various parameters and their values every time the report is loaded with a new parameter value.
Please find attached a simple project implementing the same.
Regards,
Anand -
Posted 1 December 2023, 5:59 am EST - Updated 1 December 2023, 11:28 am EST
Hi Adnand,
Thank you for your reply.
I have one more question. Im writing here not to open new post.
Lets assume we have a report like the one below.
we have one dataset with the data
category, subCategory, amount, totalAmount, itemNo(this is integer starting from 1)Now i want to group by category and subCataegory, but to display amount and totalAmount of biggest itemNo and then in subCategory total to sum totalAmount for each subCategory (also here to take all biggest itemNo for each subCategory)
and then total of all categories again for each subCategory with biggest itemNo.I managed displaying biggest itemNo for category and subCategory with sorting data by itemNo descending and then calling {First(amount)} and {First(totalAmount)} but now i am having problems for sums if i have 2 or more subCategories i cannot manage to sum amount for first item on each subCategory and same for category
I tried these two options:
[code]{Sum(IIF(subCategory = First(subCategory, “subCategory”), IIF(itemNo = Max(itemNo, “subCategory”), totalAmount, 0), 0))}
{Sum(IIF(itemNo = Max(itemNo, “subCategory”), totalAmount, 0), “subCategory”)}[/code]
https://developer.mescius.com/activereportsjs/demos/Reports/LogisticsCost2/purejs
-
Posted 4 December 2023, 6:10 am EST
Hi Arian,
We are not sure we fully understand your requirements, from what we understand you are grouping data into categories and subcategories, in both you want to show the amount and totalAmount of the biggest ‘itemNo’ then in the subCategory you want to show the total sum of totalAmount for each subCategory but only for the biggest itemNo in each subCategory, however, each subCategory will have only one biggest itemNo and the total will appear after the end of each subCategory so it is not clear how you want to show the sum of the same (as there will be only one largest value in each subCategory).
Could you please share a sample database along with a mock report output (for example a sample Excel document) that shows the expected output for your sample data so we can assist you further regarding the same?
Please Note: It is suggested to create a new case for every new issue you have as it helps us avoid any confusion and helps others looking for their related queries on our forums.
Thanks,
Anand