?
Solved

How to Add item to Dropdownlistbox dynamically?

Posted on 2005-03-22
2
Medium Priority
?
3,317 Views
Last Modified: 2013-12-26
I have a datawindow(dw_coll_excsel) which has a dropdownlistbox(select_exc_flag). The values of this dropdownlistbox are hardcoded. But on a certain condition, i want to add an item to this dropdownlistbox from the open event of the window. This is what I have given, but i am getting an error. The type of select_exc_flag is Number, but it has display values as strings. How do I incorporate that here.
I want to insert the 17th row with data value as "Acct is coded to rep 96"

This is what I have done:
dw_coll_excsel.InsertRow(0)
string s
int row
s = "Acct is coded to rep 96"
IF A = "SUPPLY" THEN
row=dw_coll_excsel.object.select_exc_flag[1].AddItem(17)
END IF
0
Comment
Question by:taniatangri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
michaelstoffel earned 200 total points
ID: 13606605
While I would highly recommend switching to a dddw instead of a ddlb, you can modify the values using:

dw.Object.column.Values = "displayval~tactualval/displayval2~tactualval2......"

So, from your example:

string ls_ddlbValues
long ll_flagValue

s = "Acct is coded to rep 96"
IF A = "SUPPLY" THEN
   ls_ddlbValues = dw_coll_excsel.object.select_exc_flag.Values
   ls_ddlbValues += '/' + s + '~t' + string(ll_flagValue)
   dw_coll_excsel.object.select_exc_flag.Values = ls_ddlbValues
END IF

Remember, just like a dddw the list is the same for every row.  If it changes based on row, you should definitely use a dddw and one of the different techiniques used to filter the dropdown per row.
0
 

Author Comment

by:taniatangri
ID: 13608434
Thanks a lot! Your solution solved my problem.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 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