iNTERFACEWARE Products Manual > Installing and Using Chameleon > Tutorials and Exercises > HL7 to Application > Step 6 - Python Scripts > Creating a Python Script to Capitalize the First Letter of a Name |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
To create a Python script to capitalize only the first letter of a name:
Note that the Patient Table contains an Inbound Script column. This is where you specify Python scripts that alter incoming data. You can define a separate Python script for each data item in your table; each Python script in the Inbound Script column only affects one specific data item. To alter the Surname field:
In this Python script, value is a special predefined variable that contains the data value currently being processed. Here, the data value is the surname of the patient. capitalize() is a Python function that modifies a string of characters so that only the first character of this string is capitalized. This modified string is then re-assigned to value, which is mapped to the Surname field in your data table. Since you also want to alter capitalization in the FirstName field, you will need to repeat the above steps for the FirstName row of the Patient Table. When you are finished, save your VMD file.
When you have saved your VMD file, restart the server application, and use the HL7 Simulator to send the test messages once again. You will notice that only the first letter of the FirstName and Surname are capitalized:
For more information about Python in Chameleon, see Using Python Scripting. |