获取DW中显示的列的列表

发布于 2024-10-10 03:04:26 字数 113 浏览 3 评论 0原文

如何获取 dw 中可以看到的列列表? 当我使用 dwobject.object.datawindow.column.count 循环遍历列时,我得到了 sql 中的所有列。至少有一种方法可以找出其中哪些未显示吗?

How do you get the list of columns that can be seen in a dw?
When I loop through the columns using dwobject.object.datawindow.column.count, I get all the columns in sql. Is there at least a way to figure out which of them isn't displayed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

千鲤 2024-10-17 03:04:26
  Long li_Loop
  String ls_ColName, lsa_ColNames[]

  FOR li_Loop = 1 TO dwobject.object.datawindow.column.count
    ls_ColName = dwobject.Describe("#" + String( ll_Loop ) + ".Name")
    IF Long( dwobject.Describe( ls_ColName + ".Visible") ) > 0 THEN
      lsa_ColNames[ UpperBound(lsa_ColNames[]) + 1] = ls_ColName
    END IF

 next

// 数组 lsa_ColNames[] 包含所有可见的列名称。

  Long li_Loop
  String ls_ColName, lsa_ColNames[]

  FOR li_Loop = 1 TO dwobject.object.datawindow.column.count
    ls_ColName = dwobject.Describe("#" + String( ll_Loop ) + ".Name")
    IF Long( dwobject.Describe( ls_ColName + ".Visible") ) > 0 THEN
      lsa_ColNames[ UpperBound(lsa_ColNames[]) + 1] = ls_ColName
    END IF

 next

// The array lsa_ColNames[] contains all the visible columns names.

娇妻 2024-10-17 03:04:26

我自己设法找到了它:

Integer li_col_idx, &
        li_pos

String  ls_objects, &
        ls_contorl, &
        ls_columns[], &
        ls_type, &
        ls_visible


li_col_idx = 1
ls_objects = dw_tab.object.datawindow.objects  // Forgot to add this row

DO while ls_objects <> ""
    li_pos = Pos(ls_objects, "~t")

    IF li_pos > 0 THEN
        ls_control = left(ls_objects, li_pos - 1)
        ls_objects = mid(ls_objects, li_pos + 1)
    ELSE
        ls_control = ls_objects
        ls_objects = ""
    END IF

    ls_type = dw_tab.describe(ls_control + ".type")
    ls_visible = dw_tab.describe(ls_control + ".visible")
    IF ls_type = "column" AND ls_visible = "1" THEN 
        ls_columns[li_col_idx] = ls_control
        li_col_idx++
    END IF
LOOP 

I've managed to find it out by myself:

Integer li_col_idx, &
        li_pos

String  ls_objects, &
        ls_contorl, &
        ls_columns[], &
        ls_type, &
        ls_visible


li_col_idx = 1
ls_objects = dw_tab.object.datawindow.objects  // Forgot to add this row

DO while ls_objects <> ""
    li_pos = Pos(ls_objects, "~t")

    IF li_pos > 0 THEN
        ls_control = left(ls_objects, li_pos - 1)
        ls_objects = mid(ls_objects, li_pos + 1)
    ELSE
        ls_control = ls_objects
        ls_objects = ""
    END IF

    ls_type = dw_tab.describe(ls_control + ".type")
    ls_visible = dw_tab.describe(ls_control + ".visible")
    IF ls_type = "column" AND ls_visible = "1" THEN 
        ls_columns[li_col_idx] = ls_control
        li_col_idx++
    END IF
LOOP 
简美 2024-10-17 03:04:26

在最近的代码中,我通过查看编辑样式改进了(希望)上述内容。我不仅需要找到活动/显示的列,而且可能使用隐藏列(无视觉控制(VC))设置排序,并且无法指示它(请参阅“列排序指示器”上的线程)。

ls_control = idw.describe(ls_next_column + ".type")
if f_IsEmpty(ls_control) then continue

choose case ls_control
case 'column'
    // EDIT STYLE; dddw, ddlb, edit, mask...
    ls_control = idw.Describe(ls_next_column + ".Edit.Style")

    if f_IsEmpty(ls_control) then continue

    choose case ls_control
    case '?', '!'
        continue

    case else
        . . . 

因此编辑样式为空,?或者 !当没有 VC 时。一旦您知道它是 VC,然后检查它是否可见或需要什么。对于我的代码,我只保留 VC 的列表,然后检查是否可以/不指示...

In recent code I improved (hopefully) the above by looking at Edit Style. I needed to find not only the active/displayed columns but a sort might be set with a hidden column (no visual control(VC)) and it can't be indicated (see threads on "column sort indicators").

ls_control = idw.describe(ls_next_column + ".type")
if f_IsEmpty(ls_control) then continue

choose case ls_control
case 'column'
    // EDIT STYLE; dddw, ddlb, edit, mask...
    ls_control = idw.Describe(ls_next_column + ".Edit.Style")

    if f_IsEmpty(ls_control) then continue

    choose case ls_control
    case '?', '!'
        continue

    case else
        . . . 

THUS Edit style is Empty, ? or ! when the column does not have a VC. Once you know it's a VC, THEN check if it's Visible or whatever is needed. For my code, I keep a list of VC's only, then check if it's OK/not to indicate...

羞稚 2024-10-17 03:04:26

我编写了以下函数来正确评估数据对象中对象的属性(列、计算、文本等)。

示例:如果 location_id 列当前可见,以下代码将返回“1”;如果当前不可见,则返回“0”。可见表达式是否包含复杂表达式并不重要。

gfs_evaluate_dw_attribute ( dw_mydatawindow, 1, 'location_id', 'visible' )



global function string gfs_evaluate_dw_attribute (datawindow adw_data, long al_row, string as_columname, string as_attribute);
/*              
    FUNCTION:       gfs_evaluate_dw_attribute
    ARGUMENT:       datawindow adw_data
                        long al_row - row number, 0 or greater
                        string as_columname - dw column or object with attribute to evaluate. This can also be an object on the DW, ie. "DataWindow", "DataWindow.Print", "DataWindow.Trailer.<group #>"
                        string as_attribute - column or object attrbiute to evaluate    
    RETURN:         string
    DESCRIPTION:    returns the attribute setting whether or not there is an expression 
    HISTORY:        Chis Daugherty 01/14/2014   INITIAL VERSION 

*/  
//////////////////////////////////////////////////////////////////////////////

string ls_expression, ls_result, ls_evaluate , ls_type
long ll_tab_pos, ll_Pos_quote 

ls_expression = adw_data.Describe ( as_columname + "." + as_attribute  )

if ls_expression = '!' or isnull(ls_expression) then return ''

IF Left( ls_expression, 1 ) = "~"" AND Right(ls_expression, 1 ) = "~"" THEN 
    // PB quirk will SOMETIMES return an expression in quotes!
    ls_expression= Mid ( ls_expression, 2 , Len ( ls_expression ) - 2 ) 
END IF 

ll_tab_pos = Pos( ls_expression, "~t" ) 

ls_type =  adw_data.Describe( as_columname + ".Type"    )

IF  ls_type =  'compute' THEN

    IF ll_tab_pos > 0 AND lower(as_attribute) <> 'expression' THEN
        choose case lower(trim(Mid( ls_expression, 1, ll_tab_pos  ),true))  
        case '1','0'
            ls_expression = Mid( ls_expression, ll_tab_pos + 1 ) 
        case else
        end choose
    END IF  

    ll_Pos_quote = Pos ( upper(ls_expression) , "'" ) 
    do while ll_Pos_quote > 0 
        ls_expression = Replace( ls_expression, ll_Pos_quote , 0, "~~" )  //insert tilda!
        ll_Pos_quote += 2 //move past quote and tilda
        ll_Pos_quote = Pos ( upper(ls_expression) , "'", ll_Pos_quote  ) 
    loop    
ELSEIF ll_tab_pos > 0 THEN // conditional value 
    ls_expression = Mid( ls_expression, ll_tab_pos + 1 ) 
    //check for single quote that gets in way of quote below
    ll_Pos_quote = Pos ( upper(ls_expression) , "'" ) 
    do while ll_Pos_quote > 0 
        ls_expression = Replace( ls_expression, ll_Pos_quote , 0, "~~" )  //insert tilda!
        ll_Pos_quote += 2 //move past quote and tilda
        ll_Pos_quote = Pos ( upper(ls_expression) , "'", ll_Pos_quote  ) 
    loop
else
    //NO expression just the value was set
    ls_result = ls_expression  
    return ls_result
END IF 

if isnull(al_row) or al_row < 0 then al_row = 0
ls_evaluate = "Evaluate('" + ls_expression + "', " + string(al_row) +") "

ls_result = adw_data.describe(ls_evaluate)



return ls_result


//end of function

多年来我一直以某种形式使用它。享受!
克里斯·多尔蒂

The I wrote the following function to properly evaluate the attribute of an object (column,compute,text, etc) in a dataobject.

Example: The following code will return '1' if the location_id column is currently visible or a '0' if it is not currently visible. It doesn't matter if the visible expression contains a complex expression or not.

gfs_evaluate_dw_attribute ( dw_mydatawindow, 1, 'location_id', 'visible' )



global function string gfs_evaluate_dw_attribute (datawindow adw_data, long al_row, string as_columname, string as_attribute);
/*              
    FUNCTION:       gfs_evaluate_dw_attribute
    ARGUMENT:       datawindow adw_data
                        long al_row - row number, 0 or greater
                        string as_columname - dw column or object with attribute to evaluate. This can also be an object on the DW, ie. "DataWindow", "DataWindow.Print", "DataWindow.Trailer.<group #>"
                        string as_attribute - column or object attrbiute to evaluate    
    RETURN:         string
    DESCRIPTION:    returns the attribute setting whether or not there is an expression 
    HISTORY:        Chis Daugherty 01/14/2014   INITIAL VERSION 

*/  
//////////////////////////////////////////////////////////////////////////////

string ls_expression, ls_result, ls_evaluate , ls_type
long ll_tab_pos, ll_Pos_quote 

ls_expression = adw_data.Describe ( as_columname + "." + as_attribute  )

if ls_expression = '!' or isnull(ls_expression) then return ''

IF Left( ls_expression, 1 ) = "~"" AND Right(ls_expression, 1 ) = "~"" THEN 
    // PB quirk will SOMETIMES return an expression in quotes!
    ls_expression= Mid ( ls_expression, 2 , Len ( ls_expression ) - 2 ) 
END IF 

ll_tab_pos = Pos( ls_expression, "~t" ) 

ls_type =  adw_data.Describe( as_columname + ".Type"    )

IF  ls_type =  'compute' THEN

    IF ll_tab_pos > 0 AND lower(as_attribute) <> 'expression' THEN
        choose case lower(trim(Mid( ls_expression, 1, ll_tab_pos  ),true))  
        case '1','0'
            ls_expression = Mid( ls_expression, ll_tab_pos + 1 ) 
        case else
        end choose
    END IF  

    ll_Pos_quote = Pos ( upper(ls_expression) , "'" ) 
    do while ll_Pos_quote > 0 
        ls_expression = Replace( ls_expression, ll_Pos_quote , 0, "~~" )  //insert tilda!
        ll_Pos_quote += 2 //move past quote and tilda
        ll_Pos_quote = Pos ( upper(ls_expression) , "'", ll_Pos_quote  ) 
    loop    
ELSEIF ll_tab_pos > 0 THEN // conditional value 
    ls_expression = Mid( ls_expression, ll_tab_pos + 1 ) 
    //check for single quote that gets in way of quote below
    ll_Pos_quote = Pos ( upper(ls_expression) , "'" ) 
    do while ll_Pos_quote > 0 
        ls_expression = Replace( ls_expression, ll_Pos_quote , 0, "~~" )  //insert tilda!
        ll_Pos_quote += 2 //move past quote and tilda
        ll_Pos_quote = Pos ( upper(ls_expression) , "'", ll_Pos_quote  ) 
    loop
else
    //NO expression just the value was set
    ls_result = ls_expression  
    return ls_result
END IF 

if isnull(al_row) or al_row < 0 then al_row = 0
ls_evaluate = "Evaluate('" + ls_expression + "', " + string(al_row) +") "

ls_result = adw_data.describe(ls_evaluate)



return ls_result


//end of function

I've been using it for years in one form or another. Enjoy!
Chris Daugherty

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文