grab unique date values

bino

Member
Hi all,

I have what may be a simple question for some of you. I have a for each that grabs a number of records. creates a temp table.

Each record has a selldate. I need to grab the unique selldates so I can break the display up by selldate for the month.

Heres a simple example of what I'm trying to do with a webspeed app:


for each item where item.sellmonth = today.

create search1.
assign search1.item-no = item.item-no
search1.item-name = item.item-name
search1.selldate = item.selldate
search1.sellmonth = item.sellmonth.

end.


if selldate = vselldate1 then do:
for each search1 where search1.selldate = vselldate1

display search1.item-no search1.item-name search1.selldate


if selldate = vselldate2 then do:
for each search1 where search1.selldate = vselldate2

display search1.item-no search1.item-name search1.selldate

and so forth.

I need some type of procedure for grabbing the unique vselldates (dates) in the search so I can break my display up by the unique dates. usually be 3 or 4 different selldates in a month
 

jongpau

Member
Hi,

Have you thought about using a break by?
Code:
for each item no-lock where item.sellmonth = today:
  create search1. 
  assign search1.item-no   = item.item-no 
         search1.item-name = item.item-name 
         search1.selldate  = item.selldate 
         search1.sellmonth = item.sellmonth. 
end.
for each search1 break by search1.selldate:
  if first-of(search1.selldate)
  then do:
    /* your code here */
  end.
end.
If you need to do more processing on the search1 table within the "first-of" block, you can define a buffer on the search1 table and use that to do another for each etc.

HTH
 
Top