WHERE Battleships.class_id=thisform.CMBMan1.ListIndex-1;
UNION;
SELECT country.country;
FROM ships!battleships;
INNER JOIN ships!country ON Battleships.country_id = country.country_id;
WHERE Battleships.class_id=thisform.CMBMan2.ListIndex-1;
INTO TABLE Temp;
NOCONSOLE
thisform.GRDMList.countriesproducedtwotypes
thisform.GRDMList.RecordSourceType=0
thisform.GRDMList.RecordSource='Temp.dbf'
Выпадающий список с запросами - CMBQueries.Click:
case thisform.CMBQueries.ListIndex==2
SELECT DISTINCT Battles.ship_id;
FROM ships!battles;
INTO ARRAY ship;
NOCONSOLE
m=ALEN(ship)
DIMENSION mind[m,2]
k=1
FOR j=1 TO m
SELECT DISTINCT Battleships.name, MIN(Battles.b_date);
FROM ships!battles INNER JOIN ships!battleships ;
ON Battles.ship_id = Battleships.ship_id;
WHERE Battles.ship_id = ship[j];
AND Battles.damage = .T.;
AND Battles.drawn = .F.;
INTO ARRAY mdate
DO CASE
CASE k==1
mind[k,1]=mdate[1,1]
mind[k,2]=mdate[1,2]
k=k+1
CASE k>1
IF NOT(mdate[1,1]==mind[k-1,1])
mind[k,1]=mdate[1,1]
mind[k,2]=mdate[1,2]
k=k+1
ENDIF
ENDCASE
ENDFOR
n=ALEN(mind)
DIMENSION rezult[n/4], tmp[n]
tmp[1]=''
FOR i=1 TO n/4
rezult[i]=''
ENDFOR
m=1
FOR i=1 TO k-1
SELECT DISTINCT Battleships.name;
FROM ships!battles INNER JOIN ships!battleships ;
ON Battles.ship_id = Battleships.ship_id;
WHERE Battles.b_date > mind[i,2];
AND Battleships.name = mind[i,1];
INTO ARRAY tmp
IF NOT(tmp[1]=='')
DO CASE
CASE m==1
rezult[m]=tmp[1]
m=m+1
CASE m>1
IF NOT(tmp[1]==rezult[m-1])
rezult[m]=tmp[1]
m=m+1
ENDIF
ENDCASE
ENDIF
ENDFOR
num=ALEN(rezult)
CREATE TABLE Temp6 FREE (bname C(30))
FOR i=1 TO num
IF NOT(rezult[i]=='')
APPEND BLANK
REPLACE bname WITH rezult[i]
ENDIF
ENDFOR
thisform.GRDMList.shipsdamagedinbattleparticipated
thisform.GRDMList.RecordSourceType = 0
thisform.GRDMList.RecordSource = 'Temp6.dbf'
thisform.LBLMan.Visible=.f.
thisform.TXTMan.Visible=.f.
thisform.CMDMan.Visible=.f.
thisform.LBLMan2.Visible=.f.
thisform.CMBMan1.Visible=.f.
thisform.CMBMan2.Visible=.f.
thisform.CMBMan3.Visible=.f.
Выпадающий список с запросами - CMBQueries.Click:
case thisform.CMBQueries.ListIndex==14
thisform.LBLMan.Caption='Не менее:'
thisform.LBLMan.Visible=.t.
thisform.TXTMan.Visible=.t.
thisform.CMDMan.Visible=.t.
thisform.LBLMan2.Visible=.f.
thisform.CMBMan1.Visible=.f.
thisform.CMBMan2.Visible=.f.
thisform.CMBMan3.Visible=.f.
В результате работы этой процедуры, на форме появляются надпись "Не менее:", поле ввода данных и кнопка "Вывести". Для вывода результата нужно ввести данные и нажать на кнопку "Вывести", либо клавишу Enter.
Кнопка "Вывести" - CMDMan.Click:
case thisform.CMBQueries.ListIndex==14
SELECT country.country;
FROM ships!country;
INTO ARRAY countries
SELECT DISTINCT battles.place;
FROM ships!battles;
INTO ARRAY battles
n=ALEN(countries)
m=ALEN(battles)
DIMENSION tmp[1,3],res[m*n,3]
tmp[1,3]=0
l=1
FOR j=1 TO m
FOR i=1 TO n
SELECT battles.place, Country.country, COUNT(Battleships.name);
FROM ships!battles INNER JOIN ships!battleships;
INNER JOIN ships!country ;
ON Battleships.country_id = Country.country_id ;
ON battles.ship_id = Battleships.ship_id;
WHERE battles.place = battles[j];
AND Country.country = countries[i];
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.