• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 627
  • Last Modified:

ItemChanged event

I have to dropdown data windows boxes emp no and emp name
I want to select or type emp no and when I have selected or tab out I want
the emp name displayed in the drop down datawindow. Please send me code to do this I have
got the data retrieve ok just having probs with setItem , i guess I need some instance variables
set up
0
raheis
Asked:
raheis
  • 4
  • 2
  • 2
1 Solution
 
raheisAuthor Commented:
sorry in the Qustion area
0
 
divyeshhdoshiCommented:
Hi,
 
Use lokkupdisplay () in computed field to display Emp Name (if emp-no field has dropdown dw. )
 
Thanks.
0
 
divyeshhdoshiCommented:
SOrry lookupdisplay() function.
 
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
MarkPTXCommented:
Declare an instance variable for your datawindowchild:
datawindowchild      idwc_artist

In the PFC_PREOPEN (or OPEN if you're not using PFC) event define the variable:
dw_header.GetChild('artist', idwc_artist)

Make sure that the dropdown datawindow includes the column with the data you want. If you do not want it to display in the dropdown, you can delete it from the display but you must select it in the query.

Then in the ITEMCHANGED event do something like this:
int            li_data
long            ll_row
string      ls_column, ls_display, ls_msgParms[]

ls_column = dwo.Name

Choose Case ls_column
      Case 'artist'
            ll_row = idwc_artist.GetRow()
            ls_display = idwc_artist.GetItemString(ll_row, 'artist_name')
            this.SetItem(row, 'artist_name', ls_display)
0
 
raheisAuthor Commented:
Hello Mark,

I think your in the going in the right direction but I got 2 dropdowns
eg
Empid : 123               Emp Name : Smith

When I select 123 in the first dropdown I want to set the second drop down to smith and be able to either type 123 in editable dropdown or just select it.

Thanks,
R.
0
 
MarkPTXCommented:
Why do you need the description field to be a dropdown? Can a user select the name rather than the ID? If the second field is intended as display only, create a computed field in your main datawindow select that you can use to hold the description and drop the other dropdown. If you need for your users to be able to select in either field, you would need to create 2 dropdownchild instance variables, get the value selected in the one changing and FIND the equivalent value in the other dropdown and sroll to it. You would have to be careful with such a double update process to recognize when the other record was already at the correct value to avoid creating an infinite loop in itemchanged.
0
 
raheisAuthor Commented:
yes I definitely need 2 dropdowns and that is where i need some code snippet because Im having trouble setting the second one
0
 
raheisAuthor Commented:
Thanks, I used an instance variable set in item changed and used itemfocuschanged to get and set the other dddw it works.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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