?
Solved

Dropdown list  - Datawindow

Posted on 2003-03-24
15
Medium Priority
?
2,327 Views
Last Modified: 2013-12-26
I am novice to Power Builder.  How can I dynamically additem to dropdown list from datawindow?
0
Comment
Question by:peterdevadoss
[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
  • 4
  • 2
  • 2
  • +3
15 Comments
 
LVL 2

Expert Comment

by:NMi
ID: 8202177
Maybe you can use ddlb.AddItem ? ;)

Do you need to populate your listbox with items from a table ?
0
 
LVL 2

Expert Comment

by:SylvainPouliot
ID: 8202819
If you are using a dropdown list box in a Datawindow, you have to " re-create " your list:

dw_1.Modify("emp_status.Values='Active~tA/Part Time~tP/Terminated~tT'")

The syntax is:
Description~tDataValue/

So build up a string using the value you want and use modify.
0
 
LVL 4

Expert Comment

by:Bhatti
ID: 8206671
Please follow the intructions from SylvianPouliot.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:peterdevadoss
ID: 8210194
Yes. I want to populate the listbox with items from a table.
0
 
LVL 2

Expert Comment

by:NMi
ID: 8211478
That's my sample script:



declare clients cursor for
  select CLIENT_TITLE from CLIENTS ;


string client_title

open clients ;

if sql_error("open clients") then
     rollback;
     return
end if


fetch_next:

fetch clients
 into :client_title ;

if sqlca.sqlcode = 100 then
     goto fetch_exit
end if

AddItem(client_title)

goto fetch_next

fetch_exit:

close clients ;
0
 
LVL 2

Expert Comment

by:SylvainPouliot
ID: 8213783
give me the name of your table / columns and datawindow columns
I'll show you...

NMI solution uses a cursor.  It's ok, but he is still using additem...  and this function is for a Listbox, it won't work in your case...
0
 
LVL 2

Expert Comment

by:NMi
ID: 8216427
SylvainPouliot: He just said: "I want to populate the listbox with items from a table." - so why do you think that's not what he needs ? ;)

I know by my practice that this solution with cursor and ddlb is not very good in terms of scalability. I've got a table with 8k cells that I need to load into ddlb. If this table is loaded the normal way in dw, it takes just no time. If I load it info ddlb using cursor, the operation takes almost 5s. Maybe, you can suggest a better solution for such huge DDLBs ?
0
 
LVL 4

Expert Comment

by:Bhatti
ID: 8216912
Hello  peterdevadoss,

There is difference between ListBox and Datawindow.

Datawindow and DropDownDataWindow are two datawindows. Please first deciede what exactly you want.

LISTBOX OR DROPDOWNDATAWINDOW OR DATAWINDOW.

It not realy clear what do you mean by listbox in datawindow, that mean in datawindow you choose a column and select it as dropdownlistbox.

If it is dropdownlistbox then follow the insruction of SylvainPouliot.

Let us know where you want to papulate data, in DropDownListBox or DropDownDataWindow.


THANKS


Best regards

Bhatti
0
 
LVL 2

Expert Comment

by:Caseys95
ID: 8220833
Why can't you use a DDDW (DropDownDataWindow). There are techniques to selecting a subset of a table if this is what needs to be done. This always seems to be a more practical solution when populating from a database table. I would suggest using DDLB ( DropDownListBox ) for fixed lists where you can pre-define the list in the DW painter during development.

The DDDW is a child DW and can be manipulates just like a DW. Look in the PB help for references to DataWindowChild.
The DDDWs SQLSelect can be modified before retrieval, It can be Filtered. There is a lot that can be done to control the list prior to it's retrieval.
0
 
LVL 2

Expert Comment

by:NMi
ID: 8223352
Caseys95: There's an opinion that DDDW looks just ugly ;)
Of course, I mean the case when this DDDW is the only control, not the part of some big datawindow.
0
 

Author Comment

by:peterdevadoss
ID: 8224899
I Just come to know from u guyz that there is a DROPDOWNDATAWINDOW object.  Actually thats the one i am looking for.  I am sorrr for confusing u guyz.
0
 
LVL 2

Expert Comment

by:Caseys95
ID: 8225797
MNi,

Your right, I was not thinking of it being used that way. I was assuming the list is part of a DW. Not a control on a window. As a window control, I would probably use the DDLB as it is easily loaded using AddItem().
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12685554
PAQed with points refunded (20)

modulo
Community Support Moderator
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

719 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