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.
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.
Comments
Actually, you cannot make group totals for a variable by code.
You could try to use a buffer table, loop through and update the buffer, then report on the buffer table.
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
use this:
Number :Integer
Number := Customer.FIELDNO(customer."post code");
IF CurrReport.TOTALSCAUSEDBY = Number THEN
CurrReport.SHOWOUTPUT(FALSE);
GD
Gulamdastagir, sorry I should have mentioned that the "Post Code" field is alpha numeric.
thanks
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 name
GD
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
Mukesh
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 :-k
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
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 Verma