powerbuilderdatawindow

Getting the list of displayed columns in a DW


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?


Solution

  • 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