Выделить записи в таблице по некоторому сложному условию — различия между версиями
Материал из Фабиус wiki
Hisava (обсуждение | вклад) м (→2) |
Hisava (обсуждение | вклад) м (→2) |
||
Строка 16: | Строка 16: | ||
sql := [ Select RGNUM From [[DOCS]]] + [[Ret_f_ext]]() + [ Where KINDDOC = '[[ESJ]]' and LVLNUM = '2' and [[Left]]( CATTR5, 5 ) = ' 103' and ; | sql := [ Select RGNUM From [[DOCS]]] + [[Ret_f_ext]]() + [ Where KINDDOC = '[[ESJ]]' and LVLNUM = '2' and [[Left]]( CATTR5, 5 ) = ' 103' and ; | ||
( [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '01.03' or ; | ( [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '01.03' or ; | ||
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '02.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '02.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '03.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '03.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '04.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '04.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '05.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '05.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '06.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '06.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '07.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '07.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '08.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '08.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '09.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '09.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '10.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '10.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '11.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '11.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '12.03' or ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '12.03' or ; |
− | Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '13.03' ; | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '13.03' ; |
) ] | ) ] | ||
− | aa := SelectSqlToArr( sql, { 'RGNUM' } ) | + | aa := [[SelectSqlToArr]]( sql, { 'RGNUM' } ) |
− | if !IsEmpty( aa ) | + | if ![[IsEmpty]]( aa ) |
− | aa := PrepareArr( aa ) | + | aa := [[PrepareArr]]( aa ) |
flt := Create_Filt_From_Arr( 'RGNUM', aa ) | flt := Create_Filt_From_Arr( 'RGNUM', aa ) | ||
[[SetFilter]]( flt ) | [[SetFilter]]( flt ) |
Версия 15:35, 8 июня 2017
1
local aa, sql, flt sql := [ Select RGNUM From DOCS] + Ret_f_ext() + [ Where KINDDOC = 'MTR' ] aa := SelectSqlToArr( sql, { 'RGNUM' } ) if !IsEmpty( aa ) aa := PrepareArr( aa ) flt := CREATE_FILT_FROM_ARR( 'RGNUM', aa ) SetFilter( flt ) SetSelRows( , true ) endif
2
local aa, sql, flt sql := [ Select RGNUM From DOCS] + Ret_f_ext() + [ Where KINDDOC = 'ESJ' and LVLNUM = '2' and Left( CATTR5, 5 ) = ' 103' and ; ( Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '01.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '02.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '03.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '04.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '05.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '06.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '07.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '08.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '09.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '10.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '11.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '12.03' or ; Left( ] + SQLFIELD( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '13.03' ; ) ] aa := SelectSqlToArr( sql, { 'RGNUM' } ) if !IsEmpty( aa ) aa := PrepareArr( aa ) flt := Create_Filt_From_Arr( 'RGNUM', aa ) SetFilter( flt ) SetSelRows( , true ) endif
Смотрите также
Шаблоны программ на внутреннем языке фабиуса для повторного использования