GTL programming in powerdesign9.5+ to solve big problems

Source: Internet
Author: User
Programming | solving | problems
When you develop a database model, you typically have this requirement
Enter the Chinese name of a table or field to automatically generate its Chinese pinyin first letter shorthand function
Such as:
Equipment _ transformer automatically formed database table name Sb_byq

You can set this up in PowerDesigner 9.5 version
Open 1. Tools > Modeloptions. dialog box
2. Click on the left Name convension tree node.
3. Select the Name/code convensions selection box in the right panel
4. Enter the following code in the Convension Script entry box on the Name/code page
. Foreach_part (%name%, ".")
. VBScript (%currentpart%)
Scriptresult=getpy (Scriptinputarray (0))
function Getpychar (char)
TMP=65536+ASC (char)
if (tmp>=45217 and tmp<=45252) then
Getpychar= "A"
ElseIf (tmp>=45253 and tmp<=45760) then
Getpychar= "B"
ElseIf (tmp>=45761 and tmp<=46317) then
Getpychar= "C"
ElseIf (tmp>=46318 and tmp<=46825) then
Getpychar= "D"
ElseIf (tmp>=46826 and tmp<=47009) then
Getpychar= "E"
ElseIf (tmp>=47010 and tmp<=47296) then
Getpychar= "F"
ElseIf (tmp>=47297 and tmp<=47613) then
Getpychar= "G"
ElseIf (tmp>=47614 and tmp<=48118) then
Getpychar= "H"
ElseIf (tmp>=48119 and tmp<=49061) then
Getpychar= "J"
ElseIf (tmp>=49062 and tmp<=49323) then
Getpychar= "K"
ElseIf (tmp>=49324 and tmp<=49895) then
Getpychar= "L"
ElseIf (tmp>=49896 and tmp<=50370) then
Getpychar= "M"
ElseIf (tmp>=50371 and tmp<=50613) then
Getpychar= "N"
ElseIf (tmp>=50614 and tmp<=50621) then
Getpychar= "O"
ElseIf (tmp>=50622 and tmp<=50905) then
Getpychar= "P"
ElseIf (tmp>=50906 and tmp<=51386) then
Getpychar= "Q"
ElseIf (tmp>=51387 and tmp<=51445) then
Getpychar= "R"
ElseIf (tmp>=51446 and tmp<=52217) then
Getpychar= "S"
ElseIf (tmp>=52218 and tmp<=52697) then
Getpychar= "T"
ElseIf (tmp>=52698 and tmp<=52979) then
Getpychar= "W"
ElseIf (tmp>=52980 and tmp<=53640) then
Getpychar= "X"
ElseIf (tmp>=53689 and tmp<=54480) then
Getpychar= "Y"
ElseIf (tmp>=54481 and tmp<=62289) then
Getpychar= "Z"
Else ' If it is not Chinese, it is not processed
Getpychar=char
End If
End Function


function Getpy (str)
For I=1 to Len (str)
Getpy=getpy&getpychar (Mid (str,i,1))
Next
End Function

. endvbscript







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.