Page 1 of 1

Execute a report form from a button

Posted: Fri Oct 18, 2013 4:47 pm
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

Re: Execute a report form from a button

Posted: Sun Oct 20, 2013 7:07 pm
by massiws
Cassidy,
have you seen this post?

Another way could be something like this:
  • create a HTML object on your form:
    htmlObject.png
  • 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

Re: Execute a report form from a button

Posted: Wed Oct 30, 2013 9:31 pm
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

Re: Execute a report form from a button

Posted: Thu Oct 31, 2013 1:09 am
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

Re: Execute a report form from a button

Posted: Sun Nov 10, 2013 11:37 pm
by crush
Thanks Max, I'll do that.

Re: Execute a report form from a button

Posted: Mon Nov 18, 2013 5:25 am
by admin
Max is a legend.