Sunday, 12 April 2020

PowerBuilder 2019R2 New Ribbon bar control – Create Simple screen with Ribbon Bar control

Create new application and Target.
If you are a new developer then check following links for the basics

I have created a sample app with window on it. Now add the ribbon bar control. Go to controls icon and select the Ribbon bar. You can do the same by Menu-> Insert-> RibbonBar


Now click on the window to place the control
Save the changes.

Go to Tools-> RibbonBar builder. By default it will open with a default template. 

Click on Save as button and save it on your application working directory.
Name it as Home for now.

Now go to your window where you placed the RibbonBar control and go to open event of the Window and write the following code.

rbb_1.ImportFromXMLFile('Home.Xml') 
Here the Home.XML is nothing but the one which did SaveAs in previous step.
Save the changes.

Run the application, you will see window like below.

Now you can make changes to this Ribbon Bar control using the RibbonBar Builder and see the changes over here.


-Pushparaj

Saturday, 4 April 2020

Provide Permission to all procedures and tables in Database

Following script will help you to create Grant SQL for all the procedures and Tables in your Database.

Procedures:
SELECT
  ' Grant Execute on  '+s.name+'.'+pr.name +'  to YourGroup/UserName'
FROM
    [DatabaseName].sys.procedures pr
INNER JOIN
    [DatabaseName].sys.schemas s ON pr.schema_id = s.schema_id;


Tables:
SELECT
'Grant Select,Insert,update,Alter,References,Delete on '+s.name+'.'+t.name+' to YourGroup/UserName'
  FROM sys.tables AS t
  INNER JOIN sys.schemas AS s
  ON t.[schema_id] = s.[schema_id]
  where t.name like 't_%'

-Pushparaj

PowerBuilder close query code to check unsaved changes on Datawindow

Write the below code in CloseQuery event in window level to find unsaved changes in Datawindow.

Integer li_count,li_ret

window aw_window
aw_window=this

FOR li_count = 1 TO UpperBound(control[])
IF TypeOf(aw_window.control[li_count])=Datawindow! Then 
Datawindow dw
dw=control[li_count]
IF dw.AcceptText() = 1 AND dw.ModifiedCount() > 0  THEN
li_ret=Messagebox('Alert','Changes Not Saved, Do you Want to Save it?',Question!,YesNo!,1)
If li_ret=1 Then Return 1
End if 
End if
NEXT


PowerBuilder HLP file reader for Windows 10

You might be facing issues on reading HLP files in Windows 10 version. After some research and multiple attempts I got a working solution. Below is the link to download the help reader installation file. It worked for me, hopefully it will work for you too. From IDE if you press F1, it may not work directly. You may need to open the HLP file directly.

https://www.softpedia.com/get/Authoring-tools/Help-e-book-creators/WinHlp32-for-Windows-10.shtml

For the following versions I have the HLP file reader,

I have downloaded and used it in the past, hopefully it will still work. If anyone needs it then leave a comment over here, I will reply back you with the setup file.

-Pushparaj