Выделить записи в таблице по некоторому сложному условию — различия между версиями
Материал из Фабиус wiki
Hisava (обсуждение | вклад) м |
Hisava (обсуждение | вклад) м (→2) |
||
(не показано 5 промежуточных версий этого же участника) | |||
Строка 1: | Строка 1: | ||
= 1 = | = 1 = | ||
local aa, sql, flt | local aa, sql, flt | ||
− | sql := [ Select RGNUM From DOCS] + Ret_f_ext() + [ Where KINDDOC = '[[MTR]]' ] | + | sql := [ Select RGNUM From [[DOCS]]] + [[Ret_f_ext]]() + [ Where KINDDOC = '[[MTR]]' ] |
aa := [[SelectSqlToArr]]( sql, { 'RGNUM' } ) | aa := [[SelectSqlToArr]]( sql, { 'RGNUM' } ) | ||
if ![[IsEmpty]]( aa ) | if ![[IsEmpty]]( aa ) | ||
Строка 14: | Строка 14: | ||
local aa, sql, flt | local aa, sql, flt | ||
− | 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( ] + | + | ( [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '01.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '02.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '03.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '04.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '05.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '06.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '07.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '08.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '09.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '10.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '11.03' or ; |
− | Left( ] + | + | [[Left]]( ] + [[SQLFIELD]]( '_TIMEFIRST',, 'sql_char' ) + [, 5 ) = '12.03' or ; |
− | Left( ] + | + | [[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 := | + | flt := CREATE_FILT_FROM_ARR( 'RGNUM', aa ) |
[[SetFilter]]( flt ) | [[SetFilter]]( flt ) | ||
[[SetSelRows]]( , true ) | [[SetSelRows]]( , true ) |
Текущая версия на 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
Смотрите также
Шаблоны программ на внутреннем языке фабиуса для повторного использования