Dear experts,
we have a PBL consisting solely of DataWindows which are combined to generate certain documents.
Sometimes the task pops up to replace a certain string in the text property of a Text control in many DataWindows simultaneously, e. g. a year specification: 2022 -> 2023:
How can I do this economically?
Can I avoid opening each DW and in each DW this certain Text control?
I'm still hoping that there is a possibility like to open such a library in an appropriate text editor and to use "Replace all". But my attempts failed: After replacing the strings in and saving the PBL with Notepad (?) the PBL was damaged somehow. PowerBuilder did not identify the DataWindows anymore.
Thanks in advance for all trials to help me!
Kind regards,
Konrad Kaltenbach
- You are here:
- Home
- Q&A
- Q&A
- PowerBuilder
- Changing text in many DataWindows simultaneously
- Konrad Kaltenbach
- PowerBuilder
- Monday, 2 October 2023 12:33 PM UTC
- Wednesday, 4 October 2023 13:50 PM UTC
- PowerBuilder
- # 1
Hi René! Hi Francisco! Hi John!
Thanks a lot to everyone of you!
Exporting the DWs using the Library Painter,
replacing in files with Notepad++ (cf. screenshot below) and
reimporting them afterwards at once really works!
Not as fast as if one could replace a string in a PBL itself with an editor (my dream) but much faster than using "Edit source" for every single DataWindow in PowerBuilder.
The way with a (temporary) source control I will try to test within the next weeks. (I need the help of our service provider for this.)
Happy regards, Konrad
- Monday, 2 October 2023 14:53 PM UTC
- PowerBuilder
- # 2
Hi, Konrad -
It's possible to export all of the objects in a .pbl relatively painlessly using the Library Painter:
- Open the Library Painter and navigate to the .pbl that contains the objects to be exported.
- Press Ctrl+A to select all objects, or use extended selection (Shift + Mouse Click) to select a range of objects in the .pbl.
- Click the Export button on the Painter toolbar. In the "save" dialog window that appears, navigate to the drive/folder where you want all of the exported DataWindow source files (.srd) to reside. Click "Save" for the first exported object.
- Repeatedly click "Save" for each of the remaining selected objects (use the keyboard if you don't want to mouse-click).
Edit the .srd source files as needed. Rene's suggestion to use Notepad++ is excellent if you can make sure you are changing the text label and not something else within the DW source syntax (like an X-position value, for example).
To import, you can use a similar technique in the Library Painter that you used to export. In the dialog window where you select the .srd file to be imported, use extended selection to select a range of files.
Best regards, John
- René Ullrich
- Wednesday, 4 October 2023 07:51 AM UTC
-
Helpful Loading... Helpful 0
- Chris Pollach @Appeon
- Wednesday, 4 October 2023 14:14 PM UTC
FWIW: What I do to export All my App's object classes source into test files in one fell sweep is to use the Native Source Code control option in the Workspace. In this case, using the built-in native SCC, it will ask you for a folder to store the object source files. Then perform an "Add to Source". After that one operation, the SCC folder will have every object class in your App as a text file. Then Notepad++ (or what ever editor you want to use) away.. ;-)
Once the sweeping changes are done to the text files. Check out all the object classes in the Library painter. Then re-import the changes TXT file object source code again using the Library Painter. HTH
Food for thought.
Regards ... Chris
-
Helpful Loading... Helpful 0
- Roland Smith
- Thursday, 5 October 2023 18:44 PM UTC
-
Helpful Loading... Helpful 0
- Monday, 2 October 2023 13:09 PM UTC
- PowerBuilder
- # 3
Hi Konrad,
If you use a source control you can change the DWs in file system (in wsobjects directory). After that do a "Refresh" on the PBL to load the changes.
If not you don't use source control you can export all datawindows to file system, do the changes and import it again.
Notepad++ have a function to replace in multiple files.
HTH,
René
- Konrad Kaltenbach
- Monday, 2 October 2023 13:24 PM UTC
thanks a lot for your answer!
I would have to do it the second way. But it is not possible to export all DWs at once, is it? Exporting each single DW will cost me more time than using "Edit source" for each one in PowerBuilder...
Regards,
Konrad
-
Helpful Loading... Helpful 0
- Francisco Martinez @Appeon
- Monday, 2 October 2023 14:28 PM UTC
You can also create a local git repository, add your workspace to that SC, do the changes, refresh and delete the SC directories
Regards - Francisco
-
Helpful Loading... Helpful 1
- René Ullrich
- Wednesday, 4 October 2023 05:17 AM UTC
You ca also use the Library Painter to select and export more than one object. But it will you ask for each object. It should be still faster then export single objects.
The way with a (temporary) source control should be the best way.
-
Helpful Loading... Helpful 2
- Page :
- 1
However, you are not allowed to reply to this question.
You could also write a small program in powerbuilder that exports all datawindows as files ( look for the LibraryExport function).
After that you'd have to open each file and search and replace and then save the file (using powerbuilder).
In the end save the file and treat all the rest.
When done, import the modified files by using the LibraryImport function.
regards