Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Execute a report form from a button

Locked
crush
Posts: 14
Joined: Tue Apr 02, 2013 8:49 pm

Execute a report form from a button

Unread post by crush »

Hi,

RIght now, I have an INDEX tab titled 'Reports' that has a button that takes you to the Run Activity form, as in samplenufinancial. However, I would like to instead populate this tab with buttons linking directly to the forms used to generate reports.

I created the button and in the 'Form To Launch via Browse' field, I set the report form.

However, when I click on button, I get the blue screen with the following SQL error:

Code: Select all

SELECT zzsys_variable_id 
zzsys_variable_id is listed as the primary key in the report form.

Any idea how I can get this form to display?

Thanks,
Cassidy
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Execute a report form from a button

Unread post by massiws »

Cassidy,
have you seen this post?

Another way could be something like this:
  • create a HTML object on your form:
    HTML object settings
    HTML object settings
    htmlObject.png (10.31 KiB) Viewed 6611 times
  • in HTML tab insert something like this:

    Code: Select all

    <div>
      <button type="button" onclick="printIt('report_code')">Print Report</button>
    </div>
Hope this helps,
Max
crush
Posts: 14
Joined: Tue Apr 02, 2013 8:49 pm

Re: Execute a report form from a button

Unread post by crush »

Hi Max,

Thank you for your reply.

The problem is that the report needs input; it's not just ready to print. I want to create a button that takes the user to the form, where they can then enter the relevant parameters needed to make the report, and click 'Print to Screen' or any of the other print options to get the report.

Any ideas on how to do that?

Thanks again,
Cassidy
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Execute a report form from a button

Unread post by massiws »

Cassedy,
from any Edit Form, you can run a report using Extra Action Button or a Button Object you created on the form.
The report is run using printIt(pCode) or pdfIt(pCode) Javascript functions (pCode is your report code).

You can use hash variables in the php code you write, to help build the temptable (#dataTable#): you don't need to pass them through anything.
For example, if you need two parameters in your report, you have to set two object on the form to get user input (ie: text_object_1 and text_object_2). In the report code you get the values with:

Code: Select all

$par1 = "#text_object_1#";
$par2 = "#text_object_2#";
$sql = "CREATE TABLE #dataTable# SELECT ... ";
Max
crush
Posts: 14
Joined: Tue Apr 02, 2013 8:49 pm

Re: Execute a report form from a button

Unread post by crush »

Thanks Max, I'll do that.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Execute a report form from a button

Unread post by admin »

Max is a legend.
Locked