Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 969
  • Last Modified:

Drop Down displays the Data Value instead of Display Value

BackGround:
Consider a Grid DataWindow with FIELDS, A & B.
Both the fields are with edit style Drop Down Datawindow.
The Data Value is different from the Display value for FIELD B DDDW.
The FIELD B DDDW, retrieves based on the value entred in the FIELD A.

Issue Description:

Suppose the FIELD A DDDW has two values:  a, b

Corresponding Data (Display) values in the FIELD B DDDW are:
For a:
1 (ONE)
2 (TWO)

For b:
3 (THREE)
4 (FOUR)

The first row in the grid is saved with the value 'a' for the FIELD A and '1' for the FIELD B. The Field B displays the display value i.e ONE.
Now another row is saved with the value 'b' forthe field 'A' and '3' for the field 'B'. The field B in the first row now displays '1' instead of 'ONE'


0
girishdhruva
Asked:
girishdhruva
1 Solution
 
gafoor78Commented:
Hi

It is bcos the retrieve is applying for all the DDDw in the DW....but u can stimulate it

just look at this previous solution

http://www.experts-exchange.com/Programming/Programming_Languages/PowerBuilder/Q_20652332.html

rgrds
gafoor

0
 
gafoor78Commented:
read the above line
It is bcos the retrieve is applying for all the DDDw in the DW

as
it is bcos the retrieve applying for all the rows for that DDDW. so in the second retrieve the first row will also change..that time there is no ONE is avilable..so it is showing the data value instead
0
 
DaniProCommented:
If you change the retrieval argument in a dddw or apply a different filter condition this produce his effect on all the row ....
You can try to don't apply the filter but hide the undesirable row with the SetDetailHeight function [ ex. child_dddw.SetDetailHeight(iniRow, endRow, 0) ]
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
gajender_99Commented:
if you want an example how this should work send send me an e-mail on gajender_99 at hotmail.com
0
 
mdhamptonCommented:
To expand on the above answers:

In the datawindow for the FIELD B dropdown, retrieve ALL values. Include FIELD A in the retrieve (but optional for display). In the rowfocuschanged event, get the datawindow child for FIELD B, and step through each row of the datawindow child, and set the detail height to 0 for all rows that do not match.

The biggest problem with this is that if the user uses the keyboard, they can sometime select values that have the detail height = 0. (I have seen this with the down and up arrows). You wil want to perform extra validation in the itemchanged event to prevent the user from entering invalid data.

If anyone knows how to prevent the above problem, let me know!
0
 
bendepCommented:
you could use an overlapping computed field containing the lookup-value (see PB help lookupdisplay) for an (always) invisible fieldb_1 (having a dddw with all possible values for B so lookup will always work). This computed field should be set visible for all rows except the current row (visible expression: 'if(currentrow=getrow(), 0, 1)'),
while another fieldb_2 will be visible only on the current row (visible expression: 'if(currentrow=getrow(), 1, 0)') that holds a filtered dddw which show only the appropriate values for field A.

So -in short- you need 3 controls:

- fieldb_1 always invisible but contains a dddw with all possible display values for B
- fieldb_2 only visible for current row, contains a dddw with only appropriate values for A (code refresh in rowfocuschanged event)
- computed_fieldB: visible for all rows except the only that is current (focused), contains an expression that looks up the displayvalue from fieldb_1. Expression: lookupdisplay(fieldb_1)

I know this sounds a bit confusing but this solution does work for me.

Ben
0
 
girishdhruvaAuthor Commented:
Thanks Ben

This solution works fine. Infact I was using the same work around for our application also.

Thanks again,
Girish
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now