Please could anyone to help me?
This is a "selective sum" problem. You want a count of the records in Invoices but only if they meet some additional criteria--a specific value in the invoice type field.
I am assuming that the value in "proforma" should be the count of all invoices with an invoice type of Proforma.
Here's one way to do that:
Define two calculation fields, constProforma and constOriginal. Define constProformat to return text as its result type and put this expression in place as the value it returns:
Do the same for constOriginal, but use "Original" as it's expression.
In Manage | Database | relationships, make a new table occurrence of Invoices by clicking it and then clicking the duplicate button (2 green plus signs). You can double click the new occurrence box to get a dialog to appear where you can rename the new occurrence box to be Invoices|Proforma.
We have not duplicated a table. Instead, this is a new reference to the same table already present in your database.
Add it to your relationships like this:
Invoices::constProforma = Invoices|Proforma::InvoiceType
Repate this process but name the new table occurrence Invoices|Original and use constOriginal as the match field in Invoices.
Now you can define a pair of calculaiton fields, cProformaCount and cOriginalCount. Use: Count ( Invoices|Proforma::Invoice Type ) as the expression for the first calculation field and Count ( Invoices|Original::Invoice Type )
Put these two calculation fields on your Invoices layout and they will display a count of all Proforma and Original invoices in the table.
Please note that I original passed on this post because of information missing from your post. To answer, I had to make a number of guesses about what you want that could be incorrect and thus this suggested solution may not be what you wanted.
Thank you very much.
I made it with different way and it works fine.
I made Proforma Number field with auto enter data, then a calculation field "If proforma" with function If ( Type="Pro Forma"; SerialIncrement ( If Proforma; 1) ) and then a Sum field to count the If proforma field.
I uploaded the file for check. I don't care for the Incoice ID, only fo the Proforma No and Original No.
Please tell me, from your experience is it reliably?
I don't care for the Incoice ID
You should. While you don't have to make it visible on any layout. It's needed in order for your portal to Invoice Data where you enter items purchased for each invoice, to work.
I don't think that your calculation fields will work the way that you think. Your "count of" summary field will work, but the calculations could be simplified to be just:
And you'll get the same results. I think you expect these fields to show a value that increments with each new record of the same type and this will not be the case with what you have set up as the calculations do not access the needed data from the other records of the same invoice type.