Count number of record

Horse06
Member Posts: 496
Hi, I create a report on the sales order and I want to count how many orders based on the sales number. If the sales number data type is text, how to calculate the total number? Thanks in advance!
0
Comments
-
FOR I := 1 TO STRLEN("No.") DO BEGIN IF EVALUATE(TempInt,FORMAT("No."[I])) THEN TempStr += FORMAT("No."[I]); END; evaluate(TempInt,TempStr); message('You've created ' + TempStr + ' Sales order Number');
You can use TempInt as integer and do what you want with it.0 -
Thanks for your quick response! I like my output of report like this
Sales Order No.
SO110
SO112
SO113
___________
Total 3 Orders0 -
Oh in that case in your footer section add a text box and set sourceexpr to be
'Total ' + format("Sales header".Count) + ' Orders'0 -
Thanks! The function of Count is used on the record. If I have several Sales: A, B, C, how to write report like this:
A:
S110
S112
_____
2 Orders
B:
S113
_____
1 Orders
C:
S220
S230
S440
S250
____
4 Orders
Thanks in advance!0 -
You need the total at the end of the loop. So you can do it with a counter.
"OnPreDataItem":intCounter := 0;
"OnAfterGetRecord":intCounter += 1;
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thank you, kriki! It coun the total sales order, but it didn't work it out on the sales order of the separate salesperson. Would you provide me the detailed info. Thank you very much Kriki!0
-
Then you should sort by and set groupyotals by salesperson0
-
1) CurrReport.CREATETOTALS(intCounter) in OnPreDataitem
2) intCounter := 1 in OnAfterGetRecord (yes, just assign, not increase)
3) Everywhere you print intCounter you will have correct grand total (in Footer) and totals (in groupfooter)0 -
Thanks! intCounter declared without linking to any value seems not working. I tried the following and it didn't work either,
FOR I := 1 TO STRLEN("salesperson code") DO BEGIN
IF EVALUATE(TempInt,FORMAT("salesperson code")) THEN
strSales += FORMAT("Salesperosn Code.");
END;
Any probelms here? Thanks!0 -
If you are using the Sales Invoice Header table (112) then you need to set the following properties
1) DataItemTableView Salesperson Code (create a key if it doesn't exist)
2) GroupTotalFields Salesperson Code
then do as Kine said1) CurrReport.CREATETOTALS(intCounter) in OnPreDataitem
2) intCounter := 1 in OnAfterGetRecord (yes, just assign, not increase)
3) Everywhere you print intCounter you will have correct grand total (in Footer) and totals (in groupfooter)
Ensure that in your sections you have GroupHeader and GroupFooter defined and this code on each OnPreSection
CurrReport.SHOWOUTPUT :=
(CurrReport.TOTALSCAUSEDBY = "Sales Invoice Header".FIELDNO("SalesPerson Code"));
This should do the trick.0 -
Thank you Albertvth! It works.0
-
Don't you just love whan a plan comes together!
\:D/
This forum rules!0 -
Hi expert. Is there any way to count just the debit record in the customer account, since debit and credit are considered one entry if we count the record. The Fact is Debit and Credit are not equal all the time and we just want to count how many DEBITS one customer has and how to do it? Thanks in advance!0
-
Savatage wrote:Don't you just love whan a plan comes together!
it's like working on a project together.
0 -
Horse06 wrote:Hi expert. Is there any way to count just the debit record in the customer account, since debit and credit are considered one entry if we count the record. The Fact is Debit and Credit are not equal all the time and we just want to count how many DEBITS one customer has and how to do it? Thanks in advance!
Do you mean customer entries? The invoices have another Document type than the credit memo's.
Maybe you can use this to count the records.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions