INTO ARRAY tmp
IF tmp[1,3]=>val(thisform.TXTMan.Text)
DO CASE
CASE l==1
res[l,1]=tmp[1,1]
res[l,2]=tmp[1,2]
res[l,3]=tmp[1,3]
l=l+1
CASE l>1
IF NOT(tmp[1,1]==res[l-1,1]) AND NOT(tmp[1,2]==res[l-1,2]) AND NOT(tmp[1,3]==res[l-1,3])
res[l,1]=tmp[1,1]
res[l,2]=tmp[1,2]
res[l,3]=tmp[1,3]
l=l+1
ENDIF
ENDCASE
ENDIF
ENDFOR
ENDFOR
FOR i=l TO n*m
res[i,1]=''
res[i,2]=''
ENDFOR
CREATE TABLE Temp5 FREE (col1 C(30), col2 C(30), col3 N(2))
APPEND FROM ARRAY res
thisform.GRDMList.battlesinnumcountries
thisform.GRDMList.RecordSourceType = 0
thisform.GRDMList.RecordSource = 'Temp5.dbf'
Выпадающий список с запросами - CMBQueries.Click:
case thisform.CMBQueries.ListIndex==19
SELECT country.country,Battleships.name, Battleships.fire1_num;
FROM ships!battleships INNER JOIN ships!country ON Battleships.country_id = country.country_id;
WHERE Battleships.fire1_num=(SELECT MAX(Battleships.fire1_num) FROM ships!battleships);
INTO TABLE Temp;
NOCONSOLE
thisform.GRDMList.countriesmaxfire
thisform.GRDMList.RecordSourceType = 0
thisform.GRDMList.RecordSource = 'Temp.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==13
thisform.LBLMan.Caption="Для класса:"
thisform.LBLMan.Visible=.t.
thisform.TXTMan.Visible=.f.
thisform.CMDMan.Visible=.t.
thisform.LBLMan2.Visible=.f.
thisform.CMBMan1.Visible=.t.
thisform.CMBMan2.Visible=.f.
thisform.CMBMan3.Visible=.f.
В результате работы этой процедуры, на форме появляются надпись "Для класса:", выпадающий список, содержащий все типы кораблей и кнопка "Вывести". Для вывода результата нужно выбрать в списке нужный элемент и нажать на кнопку "Вывести", либо клавишу Enter.
Кнопка "Вывести" - CMDMan.Click:
case thisform.CMBQueries.ListIndex==13
SELECT battles.place, battles.b_date, Types.class, Battleships.name;
FROM ships!battles INNER JOIN ships!battleships;
INNER JOIN ships!types ;
ON Battleships.class_id = Types.class_id ;
ON battles.ship_id = Battleships.ship_id;
WHERE Battleships.class_id = thisform.CMBMan1.ListIndex-1;
ORDER BY battles.place, Types.class;
INTO TABLE Temp;
NOCONSOLE
thisform.GRDMList.shipstypesinbattle
thisform.GRDMList.RecordSourceType=0
thisform.GRDMList.RecordSource='Temp.dbf'
Выпадающий список с запросами - CMBQueries.Click:
case thisform.CMBQueries.ListIndex==8
SELECT DISTINCT Battleships.fire1_diameter;
FROM ships!battleships;
INTO ARRAY fire1_diameter;
NOCONSOLE
n=ALEN(fire1_diameter)
DIMENSION maxfire[n,3]
FOR i=1 TO n
SELECT Battleships.name, MAX(Battleships.fire1_num);
FROM ships!battleships WHERE Battleships.fire1_diameter = fire1_diameter(i);
INTO ARRAY tmp
maxfire[i,2]=fire1_diameter[i]
maxfire[i,1]=tmp[1,1]
maxfire[i,3]=tmp[1,2]
ENDFOR
CREATE TABLE Temp2 FREE (col1 C(30), col2 N(3), col3 N(2))
APPEND FROM ARRAY maxfire
thisform.GRDMList.shipsfirenummax
thisform.GRDMList.RecordSourceType = 0
thisform.GRDMList.RecordSource = 'Temp2.dbf'
thisform.LBLMan.Visible=.f.
thisform.TXTMan.Visible=.f.
thisform.CMDMan.Visible=.f.
thisform.LBLMan2.Visible=.f.
thisform.CMBMan1.Visible=.f.
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.