Totalscaused by (code variable)

JamieBrown
Member Posts: 107
Hi,
This is another newb question so I'm guessing you guys will easily know a way round this...
I'm using the following to create a code variable from the "Post Code" field.
This is fine, but I need to create group totals by this variable. I've tried using:
But this doesn't work due to postcoderev not being an integer.
Is there another way around this?
thanks in advance.
This is another newb question so I'm guessing you guys will easily know a way round this...
I'm using the following to create a code variable from the "Post Code" field.
postcoderev := FORMAT(customer."post code",4);
This is fine, but I need to create group totals by this variable. I've tried using:
CurrReport.TOTALSCAUSEDBY = postcoderev;
But this doesn't work due to postcoderev not being an integer.
Is there another way around this?
thanks in advance.
0
Comments
-
You can't use this function in such way.TOTALSCAUSEDBY (Report)
Use this function to determine which field caused a group total to be calculated - meaning determining which field changed contents and thereby concluded a group.IF CurrReport.TOTALSCAUSEDBY = FIELDNO(Item) THEN CurrReport.SHOWOUTPUT(FALSE);
Actually, you cannot make group totals for a variable by code.0 -
You can only use the totalscausedby for phsical fields that are part of a key:
You could try to use a buffer table, loop through and update the buffer, then report on the buffer table.Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
instead of using this
Code:
postcoderev := FORMAT(customer."post code",4);
use this:
Number :Integer
Number := Customer.FIELDNO(customer."post code");
IF CurrReport.TOTALSCAUSEDBY = Number THEN
CurrReport.SHOWOUTPUT(FALSE);Regards,
GD0 -
Thanks guys, I think I'm going to cheat and add a new field & Key to the customer table.
Gulamdastagir, sorry I should have mentioned that the "Post Code" field is alpha numeric.
thanks0 -
FIELDNO (Record)
Use this function to return the number assigned to a field in the table description.
Number := Record.FIELDNO(Field)
Number
Data type: integer
The number of the field you selected.
Record
Data type: record
The name of the record that contains the field.
Field
Data type: field
The name of the field in the record
It really doesnt matter what the datatype of the field isall u need is the nameRegards,
GD0 -
Hi Jamie
Try the following -
Change in Table -
Add a Key to the Customer Table for the Post Code
Change in Report -
Select Customer DataItem
Open Properties
Go to DatItemTableView and specify SORTING(Post Code)
Go to GroupTotalFields and Specify PostCode
Go to Sections and Add Group Header and Group Footer Section
Write the following code in OnPreSection trigger of both the Section
CurrReport.Showoutput(CurrReport.TotalsCausedBy=FieldNo("Post code"))
Save the report and Test it.
All the Best
Mukesh0 -
Hey Guys
Read the original post, Jamie wants to group on part of a field value, from position 4 for some reason??
Not sure why when we have Post Codes like these, and the first set of values are the County then District:
SE17 3SN, BR8 7TW, W1 1WD Hmmmm :-kAnalyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
Thanks David
Now this should work
Add one more field Post Code Group to Customer table and write the code in OnValidate trigger of PostCode so that whenever the postcode is changed, The Post Code Group should be populated with the formula -
"Post Code Group" := FORMAT("post code",4);
Add a key to Customer table for Post Code Group and use the Post Group Code instead of Post Code as mention in my previous solution.
Mukesh Verma0
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