Skip to content

Method Editor

Simon Mourier edited this page Feb 19, 2020 · 1 revision

The View Editor is accessible using the entity Ribbon Bar or the design surface context menu. When you click on “Add Method”, you will be presented a dialog box like this one:

Method Editor - Picture 100

There are 3 types of methods that you can create using this dialog box:

  • CMQL methods which are written using CMQL.

  • Snippets with signature. Snippets are coded using a target language (C#, SQL, or anything else). They include a function or a method declaration, possibly including parameters, whatever how this is expressed in the target language.

  • Snippets without signature. Snippets without signature are coded using a target language (C#, SQL, or anything else) but are just bodies of a function, without method declaration. It means the method is a CodeModeler method, defined elsewhere at project level.

CMQL Method

If you choose “CMQL”, an advanced text box will be shown. This text box supports CMQL auto-completion. For example, here we have typed “lo” and the auto-completion displays the possible CMQL methods, accompanied with a tooltip window:

CMQL Method - Picture 101

Note: The “Rule” CMQL method type is obsolete and not supported so you must not declare a CMQL method using this method type

Now we continue, we have added an Age parameter (matches the Age property on that entity) and the auto-completion proposes a list of clauses:

CMQL Method - Picture 102

And here is final method. As you see, it’s very easy to write:

CMQL Method - Picture 103

Once a method has been declared, you can double click on it in the entity shape to open the CMQL editor and modify it.

Raw Methods

CMQL supports raw and load raw, search raw, count raw and delete raw methods.

As soon as you start typing the editor will detect one of these methods and update its UI like this:

Raw Methods - Picture 133

Or this

Raw Methods - Picture 132

As you can see a method can have multiple bodies, each being associated with a final language such as T-SQL or P-SQL, etc. Producers will only bodies that targets them.

Snippets

If you choose a snippet method, you will see a dialog box like this:

Snippets - Picture 105

In a snippet, you can add any code you want. This code will be injected “as is” in the final output file.

The snippet method editor supports syntax coloring (but not auto-completion) for C# and VB.NET.

Clone this wiki locally