Link to home
Start Free TrialLog in
Avatar of venkat4sv
venkat4sv

asked on

Dropdowndatawindow validation.

I have a column(Adj Reason) in Powerbuilder window, which contains a dropdown data window.
Display value is : adj_reason_desc
Data Value is : adj_reason_cd
Dropdown datawindow data source is a procedure. Data window have 3 columns like adj_reason_cd, adj_reason_desc and adj_class.
Procedure is simply getting data from bill_adj table without any input parameters.
In bill_adj table, the data is like

adj_reason_cd  adj_class  adj_reason_desc             last_update_ts            last_update_userid
500                  M             Demand Change             1/1/2006                     RS94878
501                  S             Emergency Svc                3/2/2006                    VV88777
...................
999                 M                                                    
(the last one adj_reason_desc is space)
My requirement is when ever user select space value (adj_reason_desc), I mean adj_reason_cd  is 999. I need to give access for entering some desc on that column and need to stores to the bill_adj table  as
999                 M             User entered desc            7/20/2006                   user userid

How can I insert adj_reason_desc column thru this dropdowndatawindow.

Thanks for your advance help.





Avatar of Lordain
Lordain

I am going to have to make some presumptions and conclusions based on your post so may need to work through this some.

It seems like adj_reason_cd is not unique.  My question then is what makes the row unique as this will likely be required to write back to the database.

I am also going to presume you want to update the parent record and not the child.

First you will need to make the datawindow updatable and make sure the column you want to update is selected.
Next you will need to properly set the updatable properties correctly.
You need to select the columns which are updatable along with what will uniquely qualify the row.
Last you need to choose the table/view where the insert/update to take place.

Presuming this correctly...

The flaw with this is you potentially expose the other adj_reason_cd to be modified which you probably don't want to do.  I am presuming you only want a user to enter a description when the adj_reason_cd = 999.  You can accomplish this via the protect property of the control.

When you issue a dw.update( ) to the control it should accomplish what I believe you are trying to do.
Avatar of venkat4sv

ASKER

Already the table is defined a row like adj_reason_cd is 999.
For 999, the adj_reason_desc is spaces.
From dddw, if we select space (ie, adj_reason_cd is 999) then how do we opens up a single line edit box for entering the adj_reason_desc.
If they selected space then we need to disable the dddw and forcible need to enter desc for that column (ie.,single line edit column should not be null, when selected 999), and the new column is only visible, if we select adj_reason_cd is 999.  Finally when ever we press update button, then I need to pass that adj_reason_desc (single line edit column data) for update procedure.

I would do something like this if I understand you correctly.

Add the column you want to update to the dataobject.  Protect this column until the user either through the protect property or just toggle the visible property.  Looks like it is already in the same table so should be easy.

In the case of your DDDW.  I would code in the itemchanged event to make this column available and editable to the user.  If you need the syntax for this let me know.

User makes the data entry for the row and let PB handle the update for you.

This is a clean, simple, and easy to maintain method.  There would be no need to mess with single line edit columns, or passing to procedures.
I would appreciate if you send the syntax for  the above method.
ASKER CERTIFIED SOLUTION
Avatar of Lordain
Lordain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial