Problem with Break By statement

Kalyansid

New Member
Hi,

I am currently facing a problem with breakby statement.

define variable v-sortby as char .
form
v-sortby
with frame a.
update
v-sortby
with frame a.
for each ar_mstr break by (IF v-sortby = "I" THEN ar_nbr ELSE
ar_bill):
disp ar_mstr with 2 col.
end.

The above piece of code works fine as ar_nbr & ar_bill are both characters, however if i replace ar_bill with ar_date which is a Date type then it gives a error message as Incompatible data types in expression or assignment. (223).

Please suggest.

thanks!!!
 

ss_kiran

Member
Hi,

I am currently facing a problem with breakby statement.

define variable v-sortby as char .
form
v-sortby
with frame a.
update
v-sortby
with frame a.
for each ar_mstr break by (IF v-sortby = "I" THEN ar_nbr ELSE
ar_bill):
disp ar_mstr with 2 col.
end.

The above piece of code works fine as ar_nbr & ar_bill are both characters, however if i replace ar_bill with ar_date which is a Date type then it gives a error message as Incompatible data types in expression or assignment. (223).

Please suggest.

thanks!!!

Try converting the date to string,
for each ar_mstr break by (IF v-sortby = "I" THEN ar_nbr ELSE
STRING(ar_date)):
disp ar_mstr with 2 col.
end.

Thanks
 

D.Cook

Member
Careful though!
STRING(ar_date) will produce a string depending on your locale setting which probably won't sort very well.
For sorting as a string, you'd want your date in a format like YYYY-MM-DD, which can easily be achieved with ISO-DATE(ar_date)
 
Top