We want to create a personal overview in Insights. So we need to apply a filter based on the name of the person who is logged in. Filtering on user.name isn’t possible, which is why we built the following into the template:
{% if x == user.name %}
{% result “my_planning” “Yes” %}
{% else %}
{% result “my_planning” “No” %}
{% endif %}
However, the result in the query is that when x is empty, the value in the list becomes Yes, and when x does have a value, the value in the list becomes No. That’s obviously not what we want.
What is the correct way to create a personal list in Insights?
As an addition: If I retrieve the result within the dossier x, then the result is Yes, but in Insights it apparently shows No.
Support has referred us to the Community.
Hi @MDomburg !
First of all, Happy New Year, and apologies for the delayed response.
It does seem unusual that a named template result would return a different value in Insights than it does elsewhere. I attempted to replicate your setup using the same code but was unable to reproduce your exact issue. Below are the steps I followed:
-
I copied your code and added it to a file.
-
I verified the named result. The template returns “No,” which is correct based on the code logic. When I add assign x = user.name to the code, the result changes to “Yes,” which again aligns with the expected behaviour.
-
To filter on the named results in Insights, I navigated to Actions > View data for Insights > Run a reconciliation data filter on this property.
-
I then ran the filter in Insights, which returned the file I added the result my_planning to, matching the result shown in the template.
Given this, I’m also wondering whether this issue could be avoided altogether by filtering on Clients followed by user in insights, which is effectively equivalent to user.name.
Kind regards
Delphine
I was already afraid you would confirm the issue, and that you would also be surprised by the outcome. In any case, I want to thank you for reproducing the issue and for thinking along with us on a solution.
In this situation, there is a difference in how user.name is used. In the “Office information” template we store the name of the assistant accountant, and we had wanted to compare that with user.name. However, to follow a file you have to actively follow the file, and you don’t necessarily have to be the assistant accountant. So the list ends up being different. This means we will have to use this alternative after all, with the risk that the list may be incomplete.