Debugging architect expressions

Debugging expressions from the architect using the expressiondebugger

In the architect we have the option to select the “Copy as text” option for functions. Using this, we can trace more easily if this expression will give the expected result. Also we can use the analysis tools to find performance issues. Using the right mouse button the context menu gives you the “Copy as text” option:

In the built-in expression debugger we can then test this expression:

If the expression contains red underlines we need to help it by adding ~ marks:

If your expression contains placeholders (blue underlines, starts with %), we need to evaluate them as well:

examples of this would be

[<"0",connectioncontacts:load(3)>]

or

[<"0",~N_RelatieRelatieVerband:load(1977)>,<"1",int:load(2020)>]

Example for calculating age from date_of_birth:

With placeholder:

Novulo Expression Debugger Advanced
The context and placeholder windows are small, though very powerful. When you copy an expression that is not a function, but part of a process, chances are that you encounter a variable called “trigger.record” of some kind.

You don’t have to replace those by hand, but you do need some understanding of the context tree you are trying to build. Let’s give an example:

Our example is from Novulo Service (M3038, r440), process: N_Service - Ensure huidige gebruiker als betrokkene, part of: cache connection based on reported by.

This exists out of this expression (copy to text):

N_RelatieRelatieVerband:if(
boolean:not(cms_bepaal_relatie_van_ingelogde_website_gebrui.contact.isnull()),
N_RelatieRelatieVerband:first({
N_RelatieRelatieVerband,
this,
boolean:and([
relatie_naar.equals(parent.cms_bepaal_relatie_van_ingelogde_website_gebrui.contact),
relatie_van.equals(parent.trigger.service.reported_by_contact)
])
}),
N_RelatieRelatieVerband:getnull()
)

If you paste this in the expression debugger some red warnings remain. A part you acn solve by prefacing it with ~, but the rest you need to either replace literally or build the context correctly. In that case you can do the following:

first we need to explain what the word “trigger” means. In the expression it points to the parent.trigger and at this moment you don’t have anything in your context. So we will create a context with a “trigger”:

[<"trigger", ... >]

But what does the trigger consists out of? Well, exactly what we give our process as starting values:

In this case that is just a service, so our list concsists out of parameters from just service:

[<"trigger", [<"service", ... >] >]

At the dots you can add a specific service request. A longer list would look like this:

And you context can look like this:

[<"trigger", [<"pagestate", ~NServicedetailspagestate:load(1) >,<"record", ~N_Service:load(1) >,<"old_responsible", ~N_RelatieRelatieVerband:load(1) >] >]

Of course with values filled out that make more sense. (The pagestate value from this example you can request with F12 in your browser).

In out first example we also have the value from a previous process. We can define that, just as the trigger, from the context list, eventually we will end up with something like this:

[
<"trigger",[<"service",servicerequests:load(50609)>]>,
<"cms_bepaal_relatie_van_ingelogde_website_gebrui",[<"contact",contacts:load(1432)>]>
]
1 Like