|
Можно ли с помощью dw rexpression получить значение (+)
|
|||
---|---|---|---|
#18+
Можно ли с помощью dw rexpression получить значение поля в dddw , отличное от DisplayColumn и DataColumn ? Поясню : есть dw , на нем колонка с edit-style - dddw. В этом dddw больше двух колонок . Те , что DisplayColumn и DataColumn - не интересуют. Нужно в некотором другом compute - поле на том же dw отобразить значение из dddw - колонки , которая не DisplayColumn и не DataColumn . Можно ли сочинить такое выражение ? ... |
|||
:
Нравится:
Не нравится:
|
|||
26.03.2004, 16:01 |
|
Можно ли с помощью dw rexpression получить значение (+)
|
|||
---|---|---|---|
#18+
нет ... |
|||
:
Нравится:
Не нравится:
|
|||
26.03.2004, 16:25 |
|
Можно ли с помощью dw rexpression получить значение (+)
|
|||
---|---|---|---|
#18+
А я только что вот что придумал : 1) на dw кидаем новую колонку ( дубль той , в которой dddw ) 2) ставим ей стиль редаитрования тоже dddw с тем же dddw , только с другим ( НУЖНЫМ ) DisplayColumn - и все работает: как только выбираем что-нибудь в первом dddw - во втором все переотображается! ... |
|||
:
Нравится:
Не нравится:
|
|||
26.03.2004, 16:34 |
|
Можно ли с помощью dw rexpression получить значение (+)
|
|||
---|---|---|---|
#18+
Вот функция, возвращающая значение из другого поля DDDW (его тип должен быть числовым): /*---------------------------------------------------------------------------------------------------------------------- uf_get_number_from_dwc(adw, al_row, as_col, as_dwc_col_dwc, as_val_to_search_by) ------------------------------------------------------------------------------------------------------------------------ Dscr: Retrurns a value of a NUMERIC column in a DataWindowChild. For example, we have a column 'person_id', whose DDDW contains an invisible column 'birth_year'. When user selects a person, we want automatically populate the invisible column 'birth_year'. Here is the needed fragment of the ItemChanged script: li_birth_year = uf_get_number_from_dwc(this, row, 'person_id', 'birth_year', data) object.birth_year[row] = li_birth_year The corresponding columns in the DW itself and in the Child can differ in their names; in our example, the Data Column in the DWC can be named, for example, 'person_num'. But when you call the function, pass to it the name of the column on the DW itself 'person_id'. Caution! The conumn to search by ('person_id') must be numeric! ------------------------------------------------------------------------------------------------------------------------ Arg: adw - the DW itself (not the child!); al_row - the row in the DW; as_col - the column name in the DW (on which the DDDW is placed); it can be of a numeric or string data type; as_dwc_col_dwc - the column name in the Child whose value the function will return; it must be of a numeric data type; as_val_to_search_by - the value by which to search as a string; if the data column is numeric - cast the value to string before. ------------------------------------------------------------------------------------------------------------------------ Ret: the found value (datetime) ----------------------------------------------------------------------------------------------------------------------*/ int li_dwc_row dec ldec_return string ls_dwc_data_col string ls_serch_expr string ls_col_with_dddw_type DataWindowChild ldwc ls_dwc_data_col = adw.Describe(as_col + '.dddw.datacolumn') ls_col_with_dddw_type = adw.Describe(as_col + ".coltype") ls_col_with_dddw_type = Lower(Left(ls_col_with_dddw_type, 4)) adw.GetChild(as_col, ref ldwc) if ls_col_with_dddw_type = 'char' then ls_serch_expr = ls_dwc_data_col + '="' + as_val_to_search_by + '"' else ls_serch_expr = ls_dwc_data_col + '=' + as_val_to_search_by end if li_dwc_row = ldwc.Find(ls_serch_expr, 1, ldwc.RowCount()) if li_dwc_row < 1 then return ii_null ldec_return = ldwc.GetItemNumber(li_dwc_row, as_dwc_col) return ldec_return Если сделать эту функцию глобальной (и, может, переделать, если надо), то её можно будет использовать в DW expressions как любую глобальную функцию. Я подобного не делал, так что только бросаю идею. ... |
|||
:
Нравится:
Не нравится:
|
|||
07.04.2004, 16:41 |
|
Можно ли с помощью dw rexpression получить значение (+)
|
|||
---|---|---|---|
#18+
Ошибка в комментарии функции: Ret: the found value (decimal) ... |
|||
:
Нравится:
Не нравится:
|
|||
07.04.2004, 16:43 |
|
Можно ли с помощью dw rexpression получить значение (+)
|
|||
---|---|---|---|
#18+
Вот аналогичная функция, если невидимая колонка в DDDW - типа DateTime: /*---------------------------------------------------------------------------------------------------------------------- uf_get_datetime_from_dwc(adw, al_row, as_col, as_dwc_col_dwc, as_val_to_search_by) ------------------------------------------------------------------------------------------------------------------------ Dscr: Retrurns a value of a DATETIME column in a DataWindowChild. For example, we have a column 'person_id', whose DDDW contains an invisible column 'birth_date'. When user selects a person, we want automatically populate the invisible column 'birth_date'. Here is the needed fragment of the ItemChanged script: ldt_birth_date = uf_get_datetime_from_dwc(this, row, 'person_id', 'birth_date', data) object.birth_date[row] = ldt_birth_date The corresponding columns in the DW itself and in the Child can differ in their names; in our example, the Data Column in the DWC can be named, for example, 'person_num'. But when you call the function, pass to it the name of the column on the DW itself 'person_id'. Caution! The conumn to search by ('person_id') must be numeric! ------------------------------------------------------------------------------------------------------------------------ Arg: adw - the DW itself (not the child!); al_row - the row in the DW; as_col - the column name in the DW (on which the DDDW is placed); it can be of a numeric or string data type; as_dwc_col_dwc - the column name in the Child whose value the function will return; it must be of a numeric data type; as_val_to_search_by - the value by which to search as a string; if the data column is numeric - cast the value to string before. ------------------------------------------------------------------------------------------------------------------------ Ret: the found value (datetime) ----------------------------------------------------------------------------------------------------------------------*/ datetime ldt_return int li_dwc_row string ls_dwc_data_col string ls_serch_expr string ls_col_with_dddw_type DataWindowChild ldwc ls_dwc_data_col = adw.Describe(as_col + '.dddw.datacolumn') ls_col_with_dddw_type = adw.Describe(as_col + ".coltype") ls_col_with_dddw_type = Lower(Left(ls_col_with_dddw_type, 4)) adw.GetChild(as_col, ref ldwc) if ls_col_with_dddw_type <> 'char' then ls_serch_expr = ls_dwc_data_col + '=' + as_val_to_search_by else ls_serch_expr = ls_dwc_data_col + '="' + as_val_to_search_by + '"' end if li_dwc_row = ldwc.Find(ls_serch_expr, 1, ldwc.RowCount()) if li_dwc_row < 1 then return idt_null ldt_return = ldwc.GetItemDateTime(li_dwc_row, as_dwc_col) return ldt_return (извиняюсь, что загадил ветку скриптами - может, они и не пригодятся) ... |
|||
:
Нравится:
Не нравится:
|
|||
07.04.2004, 16:47 |
|
Можно ли с помощью dw rexpression получить значение (+)
|
|||
---|---|---|---|
#18+
Спасибо большое за скрипты ! Хотя я уже изложил выше решение , которое меня устраивает : отображение с помощью колонки - дубля. PS А если не секрет , откуда эти скрипты ? ... |
|||
:
Нравится:
Не нравится:
|
|||
07.04.2004, 17:04 |
|
Можно ли с помощью dw rexpression получить значение (+)
|
|||
---|---|---|---|
#18+
"А если не секрет , откуда эти скрипты ?" Да я более, чем 3 года работы на PB собирал разные полезные функции в NVO и носил его из проекта в проект, чтоб не изобратать велосипед. Проекты и так были непростые, и опыта у меня мало, так я им что, Кулибин, что-ли, изобретать всё время - а NVO всё время со мной. ... |
|||
:
Нравится:
Не нравится:
|
|||
14.04.2004, 18:21 |
|
|
start [/forum/topic.php?fid=15&msg=32472385&tid=1339190]: |
0ms |
get settings: |
10ms |
get forum list: |
16ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
145ms |
get topic data: |
10ms |
get forum data: |
3ms |
get page messages: |
50ms |
get tp. blocked users: |
2ms |
others: | 18ms |
total: | 262ms |
0 / 0 |