[Ultimate PDF] Issue with Table Records on Screen When DataSource has a parameter

Forge Component
(13)
Published on 10 Feb by Ricardo Costa
13 votes
Published on 10 Feb by Ricardo Costa

I am having an issue when my datasource has a dynamic parameter.  I have tested with both aggregates and advanced sql.  When I set the filter or parameter to 

table.UserName = "sam", I get the following:



When setting that same parameter to table.UserName = variable1 where variable1 = "sam", I get the following:



Data appears on the webpage as expected for both cases.


Can someone assist me with getting on the right track?




Hi Samuel,

Have you set breakpoints on the aggregate itself and confirmed that variable1 does equal "sam" as expected?

Can you provide some more information surrounding your logic too please?

Thank you.

Cheers,

Jack.


I'm having a similar problem to Samuel

When I enter the ID as a test value in my aggregate or hard code that same ID in a filter, it returns the expected test result on screen. However, when I publish the PDF the dynamic values are all missing. 

Having run the debugger, I can see that the correct input variables are coming through to the web screen but the aggregate returns nothing. Even if I run the debugger with the ID hard coded in a filter as before, it still returns no results in the debugger window, despite the test value populating correctly in service studio. 

If I simply copy and paste the entire preparation into another web screen, the aggregate returns the expected results. This makes me think that the issue is something to do with the UltimatePDF entry point but this is just speculation. 




Jack McMillan wrote:

Hi Samuel,

Have you set breakpoints on the aggregate itself and confirmed that variable1 does equal "sam" as expected?

Can you provide some more information surrounding your logic too please?

Thank you.

Cheers,

Jack.



Jack, I am certain the variable has the value "sam" because data does appear on the webpage in both instances.  The problem is the data does not appear on the pdf.  


Once the data has loaded to the webpage, I click a link that navigates to the this function:



This is where the problem occurs.  The PDF prints exactly what I see on the screen when the variable is "hardcoded" but prints an empty table when it is not.




FYI I resolved this by including a TenantSwitch (system action) before the aggregate. The TenantId input variable was set to Site.TenantId



Richard Ward wrote:

FYI I resolved this by including a TenantSwitch (system action) before the aggregate. The TenantId input variable was set to Site.TenantId




TenantSwitch is normally needed when working with MultiTenancy apps which i guess is the case Richard?


Samuel, why is your question related to Ultimate PDF component?

Leonardo Fernandes wrote:

Samuel, why is your question related to Ultimate PDF component?

Leonardo,


  I am using the component and not getting the expected results.  As I said above, the generated PDF prints fine when my aggregate is hard-coded with a parameter but does not otherwise. I asked in case this was some known issue or to see if I am doing something incorrectly.


Samuel, the PDF rendering looks good. You just need to find why your aggregate is not behaving as expected.

I suggest you to print some debugging information on the PDF so you can debug your problem. It may be related to session variables, or tenant context, as others have mentioned.

Leonardo Fernandes wrote:

Samuel, the PDF rendering looks good. You just need to find why your aggregate is not behaving as expected.

I suggest you to print some debugging information on the PDF so you can debug your problem. It may be related to session variables, or tenant context, as others have mentioned.

Leonardo,


  The aggregate returns the correct data every time.  The problem is the PDF does not render correctly every time.  The aggregate returns the correct data when that filter is hardcoded or dynamic.  The PDF only renders when the aggregate's filter is hardcoded.


That means your dynamic filter is depending on some data that is unavailable when rendering the PDF. You've already proved that the PDF rendering is working properly by hardcoding the filter. So the problem must be in the dynamic filter.

Could you let us know how you've implemented the dynamic filter? Some screenshots of the aggregate might be enough. Also let us know if your application is multi-tenant.