Expression evaluates strangly

  • 15 October 2019
  • 3 replies
  • 0 views

Badge +5

12756i72B589CAE8C8E252.png

Why does this expression write "false" in the datalable when the Activity Instance ID equals 20?


13058i1A6B4957A20E1F37.png


3 replies

Badge +9

Hi jaswerl,


 


Can you add additional datalabels for the fields in the expression?


* Activity Display name


* Activity Name


* Activity Instance ID


 


So we can see what gets returned at that point

Badge +15

Hi,


What exactly are you trying to achieve here? The way I see this, this expression makes no sense.


 


Your first If checks if the length of Activity Display Name is 0, if it is 0, return Activity Name, else returns Activity Display Name.


 


Your second If checks if Activity Instance ID is 20, if it is 20, return "Application Task", else it returns Activity Name.


 


So the first If evaluates to either Activity Name or Activity Display Name, and the second If evaluate to either Application Task or Activity Name.


 


The Or logical function returns either True or False based on two BOOLEAN values. Your two If statements do not seem to be evaluating to a boolean value, unless your Activity Name, Activity Display Name, and Activity Name holds a boolean value. It is not surprising to me to see the expression evaluate to false.


 


 

Badge +5

boringNerd
Thank you, I was not aware the or function evaluated to true or false. The problem I have is tricky. I have a k2 5 portal with a view that displays the current activity for a workflow, the task owner(s) and the status. The view is based on the activity instance destination reporting object. This portal was evaluating 5 legacy 4.7 workflows converted to K2 5,
Now I have a new all k2 5 workflow and because the list view column is based on the Activity Name, setting up the k2 5 workflow like the others resulted in a activity names Task, Task1, Task 2, etc., instead of the friendly names in the workflow.
The first part of the expression solved that problem.
But there is a catch, one of the legacy workflows has sub processes and the consultant jury rigged a process to read from another list for each row and throw a task property into the Activity name field that was “User Task” which was really an Application Admin Task.
Now the first expression, while solving the problem of the Activity Name for the main process broke the jury rigged fix and now the Activity name for the sub processes are blank. Not being a programmer, I put the second expression behind the Or to try to write Application Task into the blank space if I made the Activity name field non bound.
Anyway everything else I have tried leaves the activity name column blank for both main processes and sub processes. I have a feeling you cannot unbound the view from the reporting smart object and that seems to be the main issue.

Reply