Solved

Drop Down displays the Data Value instead of Display Value

Posted on 2003-11-30
7
919 Views
Last Modified: 2013-12-26
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
Comment
Question by:girishdhruva
7 Comments
 
LVL 5

Expert Comment

by:gafoor78
ID: 9845914
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
 
LVL 5

Expert Comment

by:gafoor78
ID: 9845938
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
 
LVL 6

Expert Comment

by:DaniPro
ID: 9848860
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 8

Expert Comment

by:gajender_99
ID: 9849094
if you want an example how this should work send send me an e-mail on gajender_99 at hotmail.com
0
 
LVL 2

Expert Comment

by:mdhampton
ID: 9896119
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
 
LVL 1

Accepted Solution

by:
bendep earned 500 total points
ID: 12816975
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
 

Author Comment

by:girishdhruva
ID: 12864860
Thanks Ben

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

Thanks again,
Girish
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question