Tips for PowerScript Painter
As you know last year, to open the PowerScript painter you must either click on the Script button in the toolbar or click script with the right mouse button on an object. You will notice that the painter has its own toolbar to the main editing functions. Functions Delete, Cut, Copy and Paste all work as a plain text editor. In addition, it offers functions for pasting into the script variable names, objects, and even structures of standard code.
Before continuing, I suggest you familiarize yourself with the help functions that are available on the subject of PowerScript. First, there is the Help menu that takes you to the encoding techniques. To do do: Help -> Help contents -> Contents -> PowerScript language. And if you have the CD References in Books Online you have access to all documentation on language in the PowerScript Reference which you can read through the DynaText reader.
Re: Tips for PowerScript Painter
Soon we will begin studying the sample application that comes with PowerBuilder software. This application is very complete and very well designed and worth exploring. It shows a system for order entry and billing for a company that sells nuts. If you have the software installed on your C: you will find the application ABNC (Anchor Bay Nut Company) as follows:
- C: \ PWRS \ Pb5i32 \ Ex \ Abnc \ Abnc_ord.pbl
Re: Tips for PowerScript Painter
THE PowerScript: BASIC TECHNIQUES
Lines of Code : PS The language is not very rigid spaces, indentations, etc.. did not matter to the compiler. However, they are the teacher and you must respect the basic techniques for code readability. In general we write a command line, for readability it is sometimes better to put the order on 2 lines using the continuation character "&". The following line is correct:
- MessageBox ("SQL Error", String (SQLCA.SQLDBcode) + "" + SQLCA.SQLErrText)
But it would be better to read it in 2 lines in a script:
- MessageBox ("SQL Error", String (SQLCA.SQLDBcode) &
- + "" + SQLCA.SQLErrText)
Otherwise you could write 2 commands on one line separated by one, but this is not a recommended practice! The use of uppercase or lowercase does not matter, except for readability.
Comments : It recommends the use of comments in scripts wherever an explanation is required. Comments can be on one line using / / as:
Code:
/ / This is a comment
sle_nom.Text = "Michel" / / The comment follows a command
It may indicate a block comment with / * and * at the beginning / end:
/ * This is a block
comments on
several lines * /
Re: Tips for PowerScript Painter
Variable names
- The name must start with a letter
- Maximum of 40 characters
- Should not contain spaces, may contain signs - _% $ # (The hyphen - although legal is strongly discouraged because it is confusing with the transaction less, rather use the underscore as: last_name or uppercase as: LastName)
- Do not be a reserved word (part code)
Data Types
- Blob : Binary large object. Used to store unbounded year Amount of data (for example, generic binary, image, or large text, Such as a word-processing document).
- Boolean : Contains TRUE or FALSE.
- Char gold character : A single ASCII character.
- Date : The date, Including The Full year (1000 to 3000), The Number of the Month (01 to 12), and the Day (01 to 31).
- DateTime : The date and time in a single data type, Used only for reading and writing from and DateTime values to a database. To convert DateTime values to data types That You Can Use in PowerBuilder, use · The Date (datetime) function to convert a DateTime value to a PowerBuilder date value after reading from a database · The Time (datetime) function to convert a DateTime value PowerBuilder to a time value after reading from a database · The DateTime (date, time) function to convert a date and (optional) time to a DateTime Before writing to a DateTime column in a media databasePowerBuilder microseconds in the database interface for "any DBMS That supports microseconds.
- December gold Decimal : Signed decimal numbers up to 18 digits.You With Cdn Place The decimal point anywhere Within The 18 digits. For example, 123,456, 12345678901234.5678 0.000000000000000001 gold.
- Double : A Signed floating-point number with 15 digits of precision and a range from 2.2E-308 to 1.7E +308.
- Integer or Int : Signed 16-bit integers, from -32768 to +32767.
- Long : Signed 32-bit integers, from -2,147,483,648 to +2,147,483,647.
- Real : A floating-point number Signed With six digits of precision and a range from 1.17 to 3.4 E -38 E +38.
- String : Any ASCII characters with variable length (0 to 60,000).
- Time : The Time in 24-hour format, Including the Hour (00 to 23), minutes (00 to 59), second (00 to 59), and fraction of second (up to six digits) With A range from 0:00:00 to 23 : 59:59.999999. PowerBuilder supports microseconds in the database interface for DBMS That "any support microseconds.
- UnsignedInteger, UnsignedInt, or UInt : 16-bit unsigned integers, from 0 to 65.535.
- UnsignedLong gold ULong : 32-bit unsigned integers, from 0 to 4,294,967,295.
Re: Tips for PowerScript Painter
Declarations : Examples of statements of values to variables:
Code:
Integer NumberDays
Real MontantDu
String CustomerName, AdresseClient
PasseDu Integer = 30, = 60 Delinquent
Real ValeurPi = 3.1416
Real ValeurPi constant = 3.1416
By adding the word before the Constant declaration is assured that the value can not be changed by code in the script.
Operators : The usual operators are available: +, -, *, /, ^
and the assignment operators: + + - + = -= *= / = ^ =
With variables of type String + sign denotes a concatenation.
Code:
String alpha, beta chain
alpha = "String split"
beta = "two parties"
string = alpha + beta
The usual comparison operators are used: => <<=> = <>