Topic: About report

Hello to all

In my family banking management project, I continue by coding a report (via ReportSQL). To do this, I use code from Derek used in another of his projects.
I have two questions ;
1 - How should we code the use of a cacculated field (here cftbalance) in a report ?
2 - What is the use of adding AS “transactions.date” and others. at the end of each  ?
If I remove it, there is no impact in my error message.

Here is this piece of code in which I include a calculated field. This bug (apparently a problem with misplaced parenthesis):

SELECT

strftime('%d/%m/%y',transactions.tdate) AS "transactions.date",
transactions.tdesc AS "transactions.tdesc",
type.ttype AS "type.ttype",
imputations.Imputation AS "imputations.imputation",
transactions.tpaidout AS "transactions.tpaidout",
transactions.tpaidin AS "transactions.tpaidin",
total(t.tpaidin) - total(t.tpaidout) from transactions t, accounts a where (t.tdate <= transactions.tdate) and t.id_accounts = a.id and transactions.id_accounts = a.id)) AS " transactions.cftbalance"
   
from transactions

Left outer join type on transactions.id = type.id_transactions
Left outer join imputations On transactions.id = imputations.id_transactions

Thank you in advance for your responses.

J.B.

Re: About report

Calculated field in SQL query, InlineCalcFields() - https://myvisualdatabase.com/forum/view … hp?id=8704

Визуальное программирование: блог и телеграм-канал.

Re: About report

Salut Jean, Привет Konstantin,
Ça va avec toi et la famille?
It doesn't answer your question (which Konstantin has already replied to) but I was just curious if there is a reason why you can't use 'Report' instead of 'Report SQL' (you know me - anything for an easy life! smile) .

From what I remember of the project, I think it should work okay.
Regards,
Derek.

Re: About report

No, the parentheses are not to blame here.

Let's start from the beginning.
In SQL, using AS, you can assign an alias to a field.
For example: strftime('%d/%m/%y',transactions.tdate) AS "TransDate".
In most cases you can name the field yourself in MVD.
Regarding your request:
You have two FROM and one SELECT.
One is lost. You need to become more familiar with the SQL language.

Re: About report

Hello K245, Derek, Sparrow

K245 : Thanks for your help.I'm about to send you a new set of French translations.

Derek : I created the report using the Report action. The result is perfect, but intermittently the balance display is fanciful. The rounding goes wrong then returns to normal (see attachment).
So, I tried to create this report with the Report SQL action to see what it would do. Not better. So I come back to Report.

Sparrow : Thank you for your response. I had never used a calculated field in a report. Your answer and that of K245 enlightened me.

Thank you to all of you
J.B.

Post's attachments

Attachment icon Exemple.png 37.4 kb, 19 downloads since 2023-10-12 

Re: About report

Salut Jean,
I have also had problems like that in FastReport and usually I have been able to fix it by forcing the format of the field.
But why it does it in the first place is a mystery - intermittent problems are always the worst sad !
Regards,
Derek.

Post's attachments

Attachment icon jean.jpg 201.25 kb, 19 downloads since 2023-10-12 

Re: About report

Many thanks Derek
It does the job
I immediately placed this tip with the screenshots in my snippets (made with MVD).
It is true that the FastReport documentation that I consulted is not very talkative on this subject.
thanks again
Sincerely
J.B.

Re: About report

jean.brezhonek wrote:

K245 : Thanks for your help.I'm about to send you a new set of French translations.

Mon ami, merci de m'avoir rappelé ma promesse. J’ai eu le plaisir de publier votre dernière traduction et j’attends avec impatience de nouvelles.
Formatage du code
https://k245.ru/wp-content/uploads/2022/08/Vyravnivanie.jpg
https://k245.ru/fr/mvdb-fr/formatage-du-code.html

I really appreciate your contribution to the common cause of popularizing the My Visual Database.

Визуальное программирование: блог и телеграм-канал.