| Members: 266 |
| Language: English |
|
Group categories:
|
| More group info » |
|
The following are some translations that should make reading COS easier and make it easier to convert code written in COS to MVBASIC. Please feel free to add to this page other translations as you learn them.
If you see: write change it to: print
If you see: do or its shorthand d just drop it
If you see: set or its shorthand s just drop it
If you see: ##class(someclassname) change it to "someclassname"
If you see: ##class(someclassname).somemethod() change it to "someclassname"->somemethod()
If you see: someobject.somemethod() or someobject.someproperty such as %request.somemethod() change it to: someobject->somemethod() or someobject->someproperty
If you see: _ change it to: : (underscore is concatenation)
If you see: ' change it to ! (single quote is negation)
If you see: a dot . between an object reference and a method or property name, translate that to an arrow ->
If you see: $$$OK change it to: 1 or "%SYSTEM.Status"->OK()
If you see: &html<...> change it to: print ... statements to output the same html
If you see: if (condition) { } change it to: IF condition THEN ... END
If you see: $IsObject change it to IsObject
If you see: $$$Text or other three dollar sign things, they are COS macros and cannot be used in mvbasic. These could be wrapped with ClassMethods that execute them and return the output.
If you see: .. (two dots) before a method or property it stands for %this. (the %this object and a dot) change it to: @ME-> (at ME arrow)
If you see: Goto (yup, I've seen it in COS), pretend there is no equivalent construct in MVBASIC ;-)
If you see: Quit change it to: RETURN
If you see: ! in an output statement, it is a new line
If you see: $S or other $ single character things, take a look at http://localhost:57772/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS (changing the URL for your installation, specifically this page http://localhost:57772/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_abbreviations for $S)
Some examples below: In COS:
Set result = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")Translates to MVBASIC:
result = "%ResultSet"->%New("%Dictionary.ClassDefinition:Summary")
Explanation: So, in this case, we are calling the %New method (aka, the constructor) of the %ResultSet class by putting the class name in double quotes, then an arrow, then the %New method, passing it the same parameter no matter what language is calling it. One place you often need to use COS syntax is within a parameter value, such as the %Dictionary.ClassDefinition example above. You do not change that to %Dictionary->ClassDefinition.
Object methods and properties. Class methods. In COS: Do ##class(P.Person).Populate() Translates to MVBASIC: "P.Person"->Populate() Methods and properties: In COS: set obj=##class(Sample.Person).%OpenId(1) write obj.Name set obj.Name="Umnikov, Anton" do obj.%Save()
|
| |||||||||||||||||||
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2009 Google |