Jump to content

- - - - -

how to control break by char of a field

1 reply to this topic

#1 Guest_Ben_*

  • Guests

Posted 10 August 2006 - 08:41 AM

how to control break by the first char and second char of a field(alpha) names Commodity
for example : the values of Commodity like this AAA,AAB,ABC,BAC,BAD . I want all the record have AA as a group for total , AB as a group for total ,BA as a group for total ,finally all have A to total, all have B to tota.
the correct report:
AAA 10
AAB 20
total_AA 30

ABC 30
total_AB 30
total_A 60

BAC 40
BAD 50
total_BA 90
total_B 90

how do I handle this ? thanks

I set $commo1=commodity(1,1) $commo2=commodity(1,2) in read after logic
and in control break logic $commo2 as CB1 $commo1 as CB2 , but it does't work well!!!!!

#2 jcduym



  • Members
  • PipPip
  • 35 posts

Posted 10 August 2006 - 09:26 AM

Hi Ben

Use the control-break VAR-POS-ST and VAR-POS-END. This allows you to use a substring of the variable to trigger the control break. Remember tha control-breaks are executed from bottom to top, so CB2 will also cause CB1 to be executed. This assumes you have sorted your report correctly.

Thus using your commodity variable (sorted on it):
CB1 commodity VAR-POS-ST = 1, VAR-POS-END = 3
CB2 commodity VAR-POS-ST = 1, VAR-POS-END = 2
CB3 commodity VAR-POS-ST = 1, VAR-POS-END = 1
CB4 &$EOF (optional)

This should give the desired result



Edited by jcduym, 10 August 2006 - 09:27 AM.

Reply to this topic


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users