Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

print report

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Ricu
Posts: 10
Joined: Thu Aug 13, 2020 2:11 pm

print report

Unread post by Ricu »

Hello there,

I want to build a report with only one row of a table for printing. i want to use a report because i can arrange the items as wanted!
I didnt find any solution yet. Can you help me?

Regards,

Alex
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: print report

Unread post by kev1n »

Hi,

Have you already created the report with "Fast Form"?
Is there just one row in the table or do you want to print a specific row that you select?

And what do mean by printing? Outputting it as pdf?
Ricu
Posts: 10
Joined: Thu Aug 13, 2020 2:11 pm

Re: print report

Unread post by Ricu »

Hi, thank you for your fast reply !

Yes, I created a report with fast report, but when i run it, the output is the entire table, i just want a specific row in a table.
Its like when you have records about lots of people but you want to print a birth certificate.
Yea, outputting as pdf would be great, but i have 2 problems :
1. I need just a specific row(a specific person)
2. I must arrange the objects in page(because i will literally print it on an A5 page - as i said, like a birth certificate- the data must fit into the page and I need to arrange the objects)

Thank you in advance,

Alex
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: print report

Unread post by kev1n »

Two possibilites:

1. Specify a "Launch From" which will show a form before the report is generated where you can select the record to be printed.

https://wiki.nubuilder.cloud/ ... aunch_From

2. Run the report on a button click and show it in an iframe/new tab.

https://forums.nubuilder.cloud/viewtopic. ... 444#p21485

In both cases, use a Hash Cookie in the SQL that looks similar to this.

Code: Select all

WHERE record_id = '#RECORD_ID#'
Ricu
Posts: 10
Joined: Thu Aug 13, 2020 2:11 pm

Re: print report

Unread post by Ricu »

OK
THAT WORKED!!!
but there is a problem... i will have to change '#RECORD_ID' in the SQL code everytime i want to print a new certificate.
isnt there an option to select the last record? or something like this.

THANK YOU SO MUCH!
Ricu
Posts: 10
Joined: Thu Aug 13, 2020 2:11 pm

Re: print report

Unread post by Ricu »

ok I've got an idea but i dont know how to implement it!

I saw that there is a function called MAX. I tried to write this in SQL:

Code: Select all

WHERE record_id = MAX(record_id)
but it didnt work. Any idea why?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: print report

Unread post by kev1n »

Ricu wrote:i will have to change '#RECORD_ID' in the SQL code everytime i want to print a new certificate.
'#RECORD_ID#' is correct to refer to the current record.

This would allow you to print the currently open record.
Ricu wrote: I saw that there is a function called MAX. I tried to write this in SQL:

Code: Select all

WHERE record_id = MAX(record_id)
Is your "record_id" really numeric? Then you could try sorting the rows in descending order and get the top row:

Code: Select all

SELECT *
FROM your_table
ORDER BY record_id DESC
LIMIT 1
Ricu
Posts: 10
Joined: Thu Aug 13, 2020 2:11 pm

Re: print report

Unread post by Ricu »

WOW

It worked perfectly(the one with

Code: Select all

SELECT *
FROM your_table
ORDER BY record_id DESC
LIMIT 1
Thank you so much!!!
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: print report

Unread post by admin »

.
Post Reply