This topic is locked
[SOLVED]

:master.field limitations

8/9/2021 6:02:27 PM
PHPRunner General questions
D
digital ant author

TLDR - Are there limitations to the use of :master.field? i.e. only so many detail tables can be displayed on a master page, cannot use on a chart, etc.

Scenario: I have a master page with 6 detail relationships, all using the same master field for the relationship. On the Master view page, I have added the detail pages in four tabs:

  • tab 1 - one detail table list
  • tab 2 - one detail table list
  • tab 3 - one detail chart and one detail custom view list
  • tab 4 - one detail chart and one custom view list.

On tab 4, I am using a Before SQL Query event to modify the WHERE statement on both the custom view and chart. Both the view and the chart also have :master.field WHERE clauses in the SQL statement. The custom view is working as expected, however, the chart is not working. When I echo strSQL on the chart, :master.field is returning no value in the custom WHERE or the SQL statement. Again, this is happening only on the detail chart. :master.field is returning the master field value on the detail custom view list in all locations.

Tabs 1-3 work as expected relating the records displayed to the master record.

Has anyone come across a limitation using :master.field?

Note: I first thought the issue was too many detail pages. I removed the detail custom view list from tab 4 and the detail chart still did not return the :master.field value.

D
digital ant author 8/9/2021

Update: created a custom view, used the same data source as the chart, copied the SQL statement from the chart that is not working to the new custom view. Added the relationship to the master table, copied the code from the BeforeSQL event in the chart to the new custom view and added the view to tab 4. The custom list copied from the chart works, while the chart does not.

admin 8/9/2021

Make sure you are receiving emails from us, we have answered this question a few days ago. Here is the copy below.

:master variables don't work in charts, however there is an easy workaround.
1. Replace :master.ID in your SQL query with :sessoin.master_id
2. Add this snippet to the details - Chart page: Before Process event:
-------------------------------
$masterdata = $pageObject->getMasterRecord();
$_SESSION["master_id"] = $masterdata ? $masterdata["ID"] : "";
-------------------------------
That will do it.

D
digital ant author 8/10/2021

You are correct, the support replies were being filtered. Thank you so much for this workaround and the help!!!