Page 1 of 1

print report

Posted: Wed Aug 26, 2020 1:23 pm
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

Re: print report

Posted: Wed Aug 26, 2020 2:44 pm
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?

Re: print report

Posted: Wed Aug 26, 2020 6:57 pm
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

Re: print report

Posted: Wed Aug 26, 2020 7:06 pm
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#'

Re: print report

Posted: Wed Aug 26, 2020 9:54 pm
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!

Re: print report

Posted: Wed Aug 26, 2020 10:42 pm
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?

Re: print report

Posted: Wed Aug 26, 2020 11:19 pm
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

Re: print report

Posted: Wed Aug 26, 2020 11:42 pm
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!!!

Re: print report

Posted: Sat Aug 29, 2020 11:20 pm
by admin
.