1

PowerBuilder 12.5

I do not want to edit the datawindow object source code and i want to change datasource of the datawindow where i used a stored procedure. i want to use a different stored procedure or query. How to do that without editing the source of datawindow?

2 Answers2

1

If I was in your case I would create another datawindow with the other stored procedure call, then I would change the dataobject between them with if-then-else. If you need to have strictly the same dataobject then I would tried something with retrieval args and send as retrieval a value that would distinguish the two different options, then you can use IF-THEN-ELSE inside the datasource.

   IF :al_arg = 1 THEN
      call procedure1;
   ELSIF :al_arg = 2 THEN
      call procedure2;
   ELSE
      //something else    
   END IF;

Hope it helped!

Nick
  • 23
  • 4
1

I would also create a new datawindow with as data source your procedure. Then to use it, use the sharedata() function. More specifically, if you have a datawidnows control dw_1 holding your 'old' datawindow, create a new (possibly hidden) control dw_new and use the new dataobject in it. Alternatively, you could use a datastore. Then code:

dw_1.reset // To make sure everything has been flushed
dw_new.retrieve()
dw_new.sharedata(dw_1)

The abolute condition for this to work is to have exactly the same buffer ie the same fields with the same definition.