1. Steven Watkin
  2. PowerBuilder
  3. Friday, 7 July 2023 19:33 PM UTC

Hello,

I have a question about the Datawindow Saveas function in Powerbuilder 2021. Your documentation states: "If you do not specify any arguments for SaveAs, PowerBuilder displays the Save As dialog box. A drop-down list lets the user specify the format of the saved data."

Immediately after entering the required data in the Saveas dialog box, Powerbuilder saves the datawindow according to the format entered. I know of no way to interrupt the process, abort the Saveas function depending on what was entered, and call a different function. 

My question: Is there a way to alter this datawindow Saveas dialog box as follows:

  1. Remove items from the dropdown that we don't need
  2. Add an entry to the dropdown to save the datawindow in a new format - by calling third party software DW2XLS made by Desta Ltd.
  3. Detect when the user has selected the DW2XLS format, abort the Saveas call when this option is selected, and call the DW2XLS function instead.

 We must do our due-diligence by asking this question before embarking on a task to develop our own Dialog box - customized exactly how we want.

 Thank you,

Steven Watkins 

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 7 July 2023 19:41 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi,

Use GetFileSaveName() with your custom options and then after that, do a SaveAs() or dw2xls export, according to whichever selection has been made by the user.

regards

Comment
  1. Steven Watkin
  2. Thursday, 13 July 2023 12:29 PM UTC
Met with my boss yesterday and he gave the green light to proceed with this. Thank you.
  1. Helpful
  1. John Fauss
  2. Thursday, 13 July 2023 13:16 PM UTC
That is great news, Steven - Thanks for letting us know the outcome. Hope we see you back here soon!
  1. Helpful
There are no comments made yet.
Steven Watkin Accepted Answer Pending Moderation
  1. Monday, 10 July 2023 18:39 PM UTC
  2. PowerBuilder
  3. # 1

Thank you Chris,

 

I knew that would be the answer but I had to ask it. didn't know I would get so many excellent suggestions in here for replacing the Saveas dialog box. 

I need to come here more often.

 

Thanks,

Steve

 

Comment
There are no comments made yet.
Steven Watkin Accepted Answer Pending Moderation
  1. Monday, 10 July 2023 18:36 PM UTC
  2. PowerBuilder
  3. # 2

Thank you again Miguel, I will check it out.

Comment
There are no comments made yet.
Steven Watkin Accepted Answer Pending Moderation
  1. Monday, 10 July 2023 18:36 PM UTC
  2. PowerBuilder
  3. # 3

Hello John,

Thank you so much for this advice. I have used Topwiz before and am confident this will work very nicely.  I am meeting with my boss later this week and will have some good options for replacing the current Saveas dialog box.  

Just tried it and it works great. I will demonstrate both the Topwiz solution and the built-in PB solution on Friday and let my boss decide. 

Thanks again,

Steve

Comment
  1. Steven Watkin
  2. Tuesday, 11 July 2023 14:01 PM UTC
Hello Miguel,



Yes I saw it and I have been playing around with it a little. It is an excellent solution - practically the same as the Topwiz solution but a little different. I am going to demonstrate them both to my boss and leave it up to him. Either way can replace the Datawindow Saveas dialog box AND have the control we need to call a DW2XLS function rather than Saveas. So we can kill two birds with one stone.



Thank you again for your suggestions - they are very helpful.



Steve
  1. Helpful 1
  1. Miguel Leeuwe
  2. Tuesday, 11 July 2023 14:17 PM UTC
Yw, myself I'm also using Rolands userobject to show dialogs, but that's because I didn't realize in its day that I don't really need it.

It works great though, but I just wanted you to be aware of the possibility to get a more modern explorer look also without using that object.

regards
  1. Helpful 1
  1. Steven Watkin
  2. Wednesday, 12 July 2023 12:34 PM UTC
I personally agree. Topwiz went to a lot of trouble to create that so I hate to ignore it but it is basically the same thing. All I can think is that the current version of GetFileSaveName wasn't available at the time they created it.



I like the aflag options PB provides. I am using it with 2^(2 - 1) + 2^(14 - 1) and it is working the way I think best but if someone wants to change it I can.



Thanks for your help!



Steve
  1. Helpful 1
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 7 July 2023 20:49 PM UTC
  2. PowerBuilder
  3. # 4

Hi Steven ;

  No ... the built-in SaveAs dialogue is a fixed PB runtime dialogue. It is, what it is. However, most PB developers create their own Response window and handle their own special SaveAs functionality as needed. Since you are now under program control of your response window, you can design it and program it whichever way you want.

Regards ... Chris

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 7 July 2023 20:08 PM UTC
  2. PowerBuilder
  3. # 5

Hi, Steven -

In addition to Miguel's spot on suggestion and if you are wanting a slightly more modern "save as" dialog window, then try out the "GetFileName" free code sample from Roland Smith's TopWizProgramming web site:

    https://www.topwizprogramming.com/freecode_getfilename.html

The demo app invokes the Windows standard "open file" and/or "save as" dialog windows via Windows API calls, and you can customize the file type filter list, starting path, etc. A little more effort over what Miguel has suggested, but Roland's code samples are well-written and easy to understand.

Best regards, John

Comment
  1. Roland Smith
  2. Friday, 7 July 2023 21:00 PM UTC
I also have an example GetFolder that replaces the standard GetFolder function with a custom PB window. It might be a good starting point for a custom SaveAs window.
  1. Helpful 2
  1. Miguel Leeuwe
  2. Saturday, 8 July 2023 05:31 AM UTC
Hi John,

No need to use any other function than GetFileSaveName(). You can pass in a flag that controls a more modern explorer style look.

https://docs.appeon.com/pb2019/powerscript_reference/ch10s218.html This has a link to GetFileOpenName(), where the "flags" are explained.

See also: https://community.appeon.com/index.php/qna/q-a/getfileopenname-different-format?limitstart=0#reply-23452

regards.

  1. Helpful 1
There are no comments made yet.
Steven Watkin Accepted Answer Pending Moderation
  1. Friday, 7 July 2023 20:08 PM UTC
  2. PowerBuilder
  3. # 6

Hello Miguel,

I think that will work well. 

Thank you and have a nice weekend.

 

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.