How to show an embedded report in a report

  • 1
  • 2
  • Question
  • Updated 5 months ago
  • Answered
Hi 
I am trying to show an Embedded report in a report in another table. (I already have a report link, and can show the embedded report on the table).
Any assistance would be appreciated.

Thanks
Photo of John Vogts

John Vogts

  • 90 Points 75 badge 2x thumb

Posted 1 year ago

  • 1
  • 2
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,924 Points 20k badge 2x thumb
You can do it with script - click on the +/- to expand/collapse the sub-query



Subdatasheet 
https://haversineconsulting.quickbase.com/db/bmnf7nrvf?a=td
(Edited)
Dan, Where is the code to show the embedded report field on clicking the +/- icon? Can you put us under the hood there, please?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,924 Points 20k badge 2x thumb
It looks like I did not post the Pastie link. Here it is:

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=564


Dan, This works like a charm. Thank you so much!
Dan, The +/- functionality works fine until you use the dynamic filters. What am I missing? Once you use a DF to filter out some data, this special field does not respond at all. You have to remove all dynamic filters that have been applied and refresh the screen. Only then it works again. I tried to replace the "on" event with the click event and still the same effect. Any idea what may be causing this?
(Edited)
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,924 Points 20k badge 2x thumb
I think I created the initial demo before dynamic filters were released. I am sure it is simple to modify the script. If you need this functionality feel free to contact me off-world using the information in my profile:

https://getsatisfaction.com/people/dandiebolt
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,924 Points 20k badge 2x thumb
Okay I briefly looked at this. When you invoke a filter QuickBase is making an AJAX call to QBI_TableDashboardUpdate however the pages does not reload:

https://haversineconsulting.quickbase.com/db/bmnf7nrvf
?a=QBI_TableDashboardUpdate
&charset=windows-1252

Since the page does not reload the module.js file does not execute a second time - it only executes once when the page initially loads. You can get your code to react to filter changes by detecting hash changes (changes to the fragment identifier in the address bar):
$(window).on("hashchange", function(event) {
  //rerun script
});
Another way to detect a filter change is to create a mutation observer.

I would have no hesitation implementing this myself but this type of functionality comes close to impinging on native behavior. You might want to read this timely post and heed MC Hammer's advice "U Can't Touch $(this)":

https://community.quickbase.com/quickbase/topics/u-cant-touch-this
When you click on the dynamic filter, the hashchange event is getting fired, no doubt. But I can't rerun the script for the +/- in that event because that's not when I want it to run. AFTER the hashchange event has occurred, when the user clicks on the +/- button, that's when I want the script to run. But once the hashchange event has occurred even if I click on the +/- nothing happens.
Is the hashchange event disabling other events from occurring?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,924 Points 20k badge 2x thumb
When the dynamic filter is invoked the HTML elements associated with the report are regenerated. This regeneration effectively removes the click handlers associated with the +/-  expando that the module.js script inects. Thus the click handler associated with the  +/-  expando has to be added after the dynamic filter regenerates the report and detecting the hashchange event is probably an adequate way to detect that the report has been regenerated.

Getting this particular demo to work with dynamic filters comes close to interacting with native capabilities and might cause problems in the future if and when QuickBase modifies the code behind their dynamic filters implementation.

I am not going to update my demo but I am sure it is straightforward to accomplish. If you want to pursue a solution fee free to contact me off-world using the information in my profile:

https://getsatisfaction.com/people/dandiebolt
Photo of Esther

Esther

  • 702 Points 500 badge 2x thumb
Hi John  in case you want to keep on native QB, (I do no know is there is another ) I am using forms as a report, and in other cases I create a page with the two o more reports that calls to the same record through the embedded reports.


The solution than Dan offers you looks far more complete, that I am talking about.
Photo of John Vogts

John Vogts

  • 90 Points 75 badge 2x thumb
Thanks for the Quick response. I will have a look tonight, if it doesn't work I might use QuickBase actions to achieve what I need.