Powerbuilder change dynamically datawindow select

1.3k views Asked by At

I have two radio buttons and one datawindow. By selecting one of them, the datawindow select must change dynamically. For example, when rb1 is checked the datawindow select is "select name, surname, age from Table1" and when rb2 is checked datawindow select is "select name, surname, age from Table2". How can i do that?

Thanks!

2

There are 2 answers

0
Rich Bianco On

There are many ways to skin a cat but it's not uncommon to see either of these strategies used. The first might be okay if you want both to look similar in presentation. Second might be cleaner if there is the user interface looks different for each one.

  1. Use SetSQLSelect function (or)

  2. Swap out one of two datawindow objects based on radio button position.

0
compu-go On

If the select part of the sql (everything before from) is exactly the same you can use datawindow.setsqlselect( sqlstring )

You can make 2 datawindow objects and change the dataobject of the datawindow on the window dw.dataobject = string (the connection to the DB will be lost so you have to set the transaction object again before executing the retrieve)

You can also have 2 datawindows on the window and play with the dw.visible = boolean property