Schultz’s PowerBuilder Notes

The Ol’ Hidden Items in the Dddw Problem Part II


We all eventually need to build a datawindow where the contents of a drop down list is dependent on the value of another column.

Filtering the available selections in the dddw for the current row is straight forward, just add the necessary filtering script in the RowFocusChanged and ItemChanged events.   (See DDDW Contents Based on the Value of Another Column for more information regarding this. ) But if you have a tabular view, problems may soon become apparent with dependent columns in some rows displaying code values instead of descriptions.

Continue reading

Advertisements

November 16, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , , , , , , | 9 Comments

Working with DDDW Properties


The following example returns the display value for the dept_id column for the current row:

String ls_rownum., ls_return

ls_rownum =  String(dw_1.GetRow( ))
ls_return = dw_1.Describe(“Evaluate(‘LookUpDisplay(dept_id)’,” + ls_rownum + “)”)

Continue reading

May 13, 2008 Posted by | Drop Down Data Window (DDDW), Powerscript | , , , , , , , , , , , , , , | 1 Comment

DDDW Odds and Ends


Replacing the dddw dataobject

dw_parent.Modify(dept_id.dddw.name= d_dddw_empsal_by_dept )

Getting the name of the dddw

ls_dddwname = idw_requestor.Describe(ls_columns[li_col] + “.dddwname”)

Datawindowchild as Instance variables

I had a window which had several columns which featured filtering and copying of dddw children data. After the datawindow refreshed its contents, this functionality no longer worked. I tracked this down to the fact that I was saving a reference to the dddw in an instance variable. Apparently, after the datawindow was refreshed, this reference was clobbered, and filtering or copying to this dddw resulted in an error. Oddly, another dddw reference was not clobbered. To solve this problem, I deleted the idwc and when I needed a reference to the dddw, I used a local variable.

DDDW display value must be unique

Sometimes users want the oddest things.

I had an interesting requirement where the user wanted the same display value for two different data values. When the drop down appeared, additional columns were viewed which made it clear which data value should be associated to the display value. The problem was that if the display value does not change, the itemchanged is not triggered and the item status does not change to xxxModified!. This was very surprising and hard to track down.

The solution was to make the display value unique. This was done be appending many blank spaces and then the data value to the display value. The blank padding pushes the data value, which the user does not want to see, out of view

Filter buffer inadvertently discarded

There is a PB bug (at least in 6.5, don’t know if was fixed in later versions) with filtering dddws. Sometimes, the filter buffer is discarded.

May 12, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , | Leave a comment

Weird problem with dddw not applying filter when the user clicks on a different updateble column


In my app, if the user clicked on a new row for an updateable column, the dddw filter for pos_cd was not being applied. It would work if the user clicked on row outside any column, or on the pos_cd or rsrc_grp columns. Developed this workaround, added the following to the Clicked Event:

if IsValid(dwo) then
   if lower(dwo.type) <> "datawindow" then
       this.SetColumn('pos_cd' )
       this.SetColumn('dpt_nbr' ) // first column
   end if
   if Lower(dwo.type) = "column" and row > 0 then
      ls_name = dwo.name
      this.SetColumn(ls_name)
   end if
end if

RowFocusChanged

integer li_col
long    ll_row

ll_row = this.GetRow()

if ll_row > 0 and this.RowCount() > 0 then
   wf_populate_resrc_grp_dropdown(ll_row)
   wf_FilterPositions()
   wf_ScrollToRow()
   li_col = this.GetColumn()
   if NOT IsNull(li_col) and li_col > 0 then
      this.SetColumn('pos_cd' )
      this.SetColumn(li_col)
   end if
end if 

May 10, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , | Leave a comment

Column Properties


Display Properties (Masks)

! Upper Case
^ Lower Case
a Alphanumeric
x Any character
# Number

Continue reading

May 9, 2008 Posted by | 2. Datawindows, Datawindow Painter | , , , , , , , , , , , , , , | Leave a comment

Column Display


How do I get my field to appear like a MLE and word wrap?

  • In the datawindow painter, select the column
  • Properties
  • EDIT tab

Check AUTO VERT SCROLL and AUTOSELECTION. Other selected items may also work, however do not select HORZ SCROLL BAR. When I update a column, the change is applied to the database for many rows, not just the current one.

Check the unique Key Column in the DataWindow’s Update properties dialog box. Click the Primary Key button to assure that the columns selected are indeed unique.

Okay, in a datawindow, how do you get rid of displaying the time portion of the date field?

In the DataWindow painter, select the field and change the format property

Graying out a checkbox

If a checkbox has 3 states, and it’s state is set to that 3rd state (other), then a gray checkmark will appear in the checkbox instead of a black one.

So, by changing the state of checkbox to that 3rd state, and protecting it, it will appear to be grayed out.

May 9, 2008 Posted by | 2. Datawindows, Datawindow Painter | , , , , , , , , , , , , , | 1 Comment