Topic: Chart in form and report

hello sparrow, I need you to help me to make chart in form and report about total datawarga.kategoriusia (calculatefield) in one church. And one again, when i update datawarga.foto  the foto can't deleted from folder photo.
i share my project in mediafire. i am thank you so much.

https://www.mediafire.com/file/k6thwbzk … c.rar/file

Re: Chart in form and report

Hi,


Specifically, I don't know why you need such an expression (case when) and where it is used, when the chart is created and where what photos are.


Please describe specifically what exactly (calculated field, chart, table, photo),
where it is placed (form, table, field ...),
what exactly does not work (error),
how to get there and not get lost among your 60 forms.


Please note that I do not know the language, I do not know what you are calculating, what you want to get.


If you describe your problem correctly, they will try to help you.

Re: Chart in form and report

(
  CASE WHEN PRINTF('%d',(julianday(date()) - julianday(TanggalLahir))/365.2422)*1 <= 12 THEN 'Sekolah Minggu' 
  WHEN PRINTF('%d',(julianday(date()) - julianday(TanggalLahir))/365.2422)*1 <= 22 THEN 'Remaja' 
  WHEN PRINTF('%d',(julianday(date()) - julianday(TanggalLahir))/365.2422)*1 <= 45 THEN 'Dewasa Muda' 
  WHEN PRINTF('%d',(julianday(date()) - julianday(TanggalLahir))/365.2422)*1 <= 59 AND datawarga.id_jeniskelamin = 1 THEN 'Pria' 
  WHEN PRINTF('%d',(julianday(date()) - julianday(TanggalLahir))/365.2422)*1 <= 59 AND datawarga.id_jeniskelamin = 2 THEN 'Wanita' 
  ELSE 'Usia Indah' END 
  )

Re: Chart in form and report

thank you Sparrow,

How do I create a graph based on age category in the application that I have shared? which I can display in the form or in fastreport? here I share the graph image

Post's attachments

Attachment icon chart.PNG 11.99 kb, 64 downloads since 2025-04-05 

Re: Chart in form and report

something like that

Post's attachments

Attachment icon Bar.zip 7.17 kb, 128 downloads since 2025-04-05 

Re: Chart in form and report

I try to give my small project so that my intention for this application can be understood. Please help me with my difficulties, thank you.

Post's attachments

Attachment icon AgeCategory-Calculatefield.rar 487.01 kb, 128 downloads since 2025-04-05 

7 (edited by sparrow 2025-04-05 21:18:01)

Re: Chart in form and report

I didn't even see an attempt from your side.

Hint 1.
A calculated field is essentially a SQL subquery.
All you need is to write a SQL query with a subquery (calculated field) and substitute it into my example.

Hint 2.
Use the command in the Form1_OnShow event and look at the query.
showmessage(form1.TableGrid1.dbGetSqlStatement);

Re: Chart in form and report

Thank you Sparrow, I have successfully followed the example you made.

Re: Chart in form and report

Hi,
Well done.


Bonus. Printing a chart in FastReport generated on the MVD form.

Post's attachments

Attachment icon Bar2Report.zip 9.15 kb, 146 downloads since 2025-04-10 

Re: Chart in form and report

Sparrow, Thanks for your attention,  I have Bonus from you. God Bless You