Page 2 of 3
Re: Cannot print table
Posted: Mon May 05, 2025 7:24 am
by nadir
I added the JavaScript code to the custom code section of the parent form but it gave the following error:
screenshot-1.png
Also see the following screenshot:
screenshot-2.png
Re: Cannot print table
Posted: Mon May 05, 2025 7:47 am
by kev1n
At the time the main form is loaded, the iframe does not yet exist.
Therefore, it cannot be accessed at that point.
Solution: Either add a delay, or even better, set the Hash Cookie directly within the iframe.
Re: Cannot print table
Posted: Mon May 05, 2025 1:53 pm
by nadir
How do I directly set the Hash Cookie within the iframe ?
Re: Cannot print table
Posted: Mon May 05, 2025 2:02 pm
by kev1n
Does the iframe retrieve the date from an object on the main form? And if no date is entered, what data should be displayed—for example, a default date like today, yesterday, etc.?
Re: Cannot print table
Posted: Tue May 06, 2025 6:58 am
by nadir
The iframe retrieves date from a date object on the main form. If no date is entered, the date object is set to todays date using JavaScript
Re: Cannot print table
Posted: Tue May 06, 2025 7:45 am
by kev1n
In the iframe, check whether the
date_filter
hash cookie is set. If it isn't, set it to the current date.
Place the following code in the iframe > Custom Code > Browse field:
Code: Select all
if (!nuGetProperty('date_filter')) {
nuSetProperty('date_filter', nuCurrentDate());
}
Re: Cannot print table
Posted: Tue May 06, 2025 2:00 pm
by nadir
I set the code you sent, but it did not help. The print view still shows no rows
Re: Cannot print table
Posted: Tue May 06, 2025 2:10 pm
by kev1n
There are too many factors that could make it not work, and it's time-consuming to keep guessing without seeing the setup, code, etc.
Would it be possible for you to either export your database (with any confidential data removed) or share the form using the cloner tool, along with the associated tables? That way, I can provide more accurate help without making assumptions.
Re: Cannot print table
Posted: Wed May 07, 2025 7:07 am
by nadir
Please see attached SQL database file. The form with issues is under User Home -> Reporting -> Daily Report
ams.zip
Re: Cannot print table
Posted: Wed May 07, 2025 7:35 am
by kev1n
In the form's Custom Code, the default date is explicitly set:
$("#date_filter").val("2021-11-01");
However, in the iframe, a different default date (today's date) is set dynamically:
Code: Select all
if (!nuGetProperty('date_filter')) {
nuSetProperty('date_filter', nuCurrentDate());
}
Since the iframe uses the current date (which may not have corresponding data), the table appears empty, and the Print page shows up blank.
Additionally, when the date is changed, the new value must be saved to the Hash Cookie so that the iframe reflects the update correctly:
Code: Select all
var f = $("#daily_report_iframe")[0].contentWindow;
f.nuSetProperty("date_filter", this.value); // add this line
f.nuGetBreadcrumb();