Connecting Tech Pros Worldwide Forums | Help | Site Map

Extracting value/selected item from combo box

Newbie
 
Join Date: Jun 2007
Location: Melbourne, Australia
Posts: 30
#1: Sep 20 '07
Hi,

I need to obtain the value of the selected item from a combo box.

Expand|Select|Wrap|Line Numbers
  1. BEGIN
  2.     IF :LOGIN_BLOCK.USER_TYPE = 'Student' THEN
  3.         :GLOBAL.student_id := :LOGIN_BLOCK.ID;
  4.         CALL_FORM(:GLOBAL.project_path || 'ENROLLMENT_FORM.fmx');
  5.     ELSE
  6.         :GLOBAL.staff_id := :LOGIN_BLOCK.ID;
  7.     END IF;
  8. END;
That is the code I have to do this but it doesn't work, it always accesses the else section of the statement.

The LOGIN_BLOCK is the data block, and the USER_TYPE is the combo box that contains "Student" and "Staff".

I need the If statement to see which one is selected so that a global variable can be assigned a value and a specific form can be called.

Thanks

amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#2: Sep 20 '07

re: Extracting value/selected item from combo box


Quote:

Originally Posted by mlevit

Hi,

I need to obtain the value of the selected item from a combo box.

Expand|Select|Wrap|Line Numbers
  1. BEGIN
  2.     IF :LOGIN_BLOCK.USER_TYPE = 'Student' THEN
  3.         :GLOBAL.student_id := :LOGIN_BLOCK.ID;
  4.         CALL_FORM(:GLOBAL.project_path || 'ENROLLMENT_FORM.fmx');
  5.     ELSE
  6.         :GLOBAL.staff_id := :LOGIN_BLOCK.ID;
  7.     END IF;
  8. END;
That is the code I have to do this but it doesn't work, it always accesses the else section of the statement.

The LOGIN_BLOCK is the data block, and the USER_TYPE is the combo box that contains "Student" and "Staff".

I need the If statement to see which one is selected so that a global variable can be assigned a value and a specific form can be called.

Thanks

Check below Steps:

1. Go to the property palatte of the COMBO BOX.
2. For the property "Element In the List", click on that.It will display LIST OF ELEMENTS WINDOW
3. Check the LIST ELEMENT and LIST ITEM VALUE associated with the LIST ELEMENT.
Eg: For LIST ELEMENT = 'Student' LIST ITEM VALUE also should be equal to 'Student'. Only then your IF condition will Work.
Newbie
 
Join Date: Jun 2007
Location: Melbourne, Australia
Posts: 30
#3: Sep 20 '07

re: Extracting value/selected item from combo box


Quote:

Originally Posted by amitpatel66

Check below Steps:

1. Go to the property palatte of the COMBO BOX.
2. For the property "Element In the List", click on that.It will display LIST OF ELEMENTS WINDOW
3. Check the LIST ELEMENT and LIST ITEM VALUE associated with the LIST ELEMENT.
Eg: For LIST ELEMENT = 'Student' LIST ITEM VALUE also should be equal to 'Student'. Only then your IF condition will Work.

Thanks for that mate, I got it about 2 hours ago.

I was surprised each element have a value associated with it. Makes it a bit more complicate.

Thanks, anyway.
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,192
#4: Sep 20 '07

re: Extracting value/selected item from combo box


Quote:

Originally Posted by mlevit

Thanks for that mate, I got it about 2 hours ago.

I was surprised each element have a value associated with it. Makes it a bit more complicate.

Thanks, anyway.

You can make it simpler by associating a simpler value with each combo box items.
Say 0 from student and 1 for staff
Reply