I am trying to create a task report and I have taken reference from:

Hi

I am trying to create a task report and I have taken reference from:
forum.appian.com/.../Task_Report_Tutorial.html

In my task report I have a column Assigned To. The values in this column are either Group or User which are being displayed but group is being displayed as Goup: id and user as username, PFA screenshot for your reference.
Can some one please suggest how do I display user's as well as group's name?

Thanks in advance....

OriginalPostID-199642



  Discussion posts and replies are publicly visible

  • @komalc Hi, few months ago, I have written a rule which will format the data you have been asking for and attached a code snippet for the same.

    What you need to do is, while configuring the paging grid, you need to apply the rule (written for formatting the data) in an iterative fashion over the column that holds the User or Group data (which is tp!assignees in your case.) obtained post querying the analytics.

    Hope that will give you leads and do let us know in case of follow-up questions. Also let's see if you could get much valuable suggestions from community.
  • Hi sikhivahans

    Thank you for your reply!!
    It solved my problem.

  • Hi sikhivahans

    I have also gone through your rule and understood that you worked on user by using touser() and for the group you converted the value into integer using tointeger(). I have a doubt that in the beginning you have casted the input into a type with typenumber 127. What is the typename of this type number.
    Also would like to know is there any documentation which associates the typenames with typenumbers.

    Thanks in advance...
  • @komalc Here goes the answers to your questions and please do let us know in case of any follow-up questions:

    >> What is the typename of this type number?
    Test the expression below:
    fn!typename(127)

    And you will see that the output is 'List of User or Group'.

    As far as I know there isn't any documentation available so far until and unless I miss something. One way how I generally do in case of Appian Data Types (mentioned at https://forum.appian.com/suite/help/16.1/Appian_Data_Types.html) is, you can determine the type number by using the local variable or rule input in an expression rule. Here I have used local variable and you can try the same by using rule input.

    Examples:
    1.
    load(
    \tlocal!NumberInteger:1,
    \tconcat("Type Name: ",typename(typeof(local!NumberInteger)),char(13),"Type Number: ",typeof(local!NumberInteger))
    )

    2.
    load(
    \tlocal!NumberInteger_Multiple:{1},
    \tconcat("Type Name: ",typename(typeof(local!NumberInteger_Multiple)),char(13),"Type Number: ",typeof(local!NumberInteger_Multiple))
    )

    3.
    load(
    \tlocal!Text:"abc",
    \tconcat("Type Name: ",typename(typeof(local!Text)),char(13),"Type Number: ",typeof(local!Text))
    )

    4.
    load(
    \tlocal!Text_Multiple:{"abc"},
    \tconcat("Type Name: ",typename(typeof(local!Text_Multiple)),char(13),"Type Number: ",typeof(local!Text_Multiple))
    )

    If you would like to stay away from using number, you can create a constant of type 'User or Group' and use the same in casting as follows: (And you don't need to configure any values for this constant)

    fn!cast(fn!typeof(cons!my_user_or_group_constant),)


    Please do bear in mind that we don't need to do in the above mentioned way (that is making use of a variable rather than a type constructor) for cdt as we can access a cdt using type constructor as follows:

    Examples:

    1. If we need the type number of cdt of single type:
    cast(typeof(type!myCDT()),)

    2. If we need the type number of cdt of multiple type:
    cast(typeof({type!myCDT()}),)

    I guess we can also eliminate usage of numbers (that is, 127 in cast(127,)), if we are able to access the Appian Data Types mentioned at https://forum.appian.com/suite/help/16.1/Appian_Data_Types.html using type constructor as mentioned in the above example.

    >> And re the statement - "You have casted the input into a type":
    So when you query the analytics and get the resultant data, I observed that Appian understands the type of data held in the 'tp!assignees' column (In general, most of these kind of cases) is of type 'Any Type'. That's the reason why we are casting the 'Any Type' data to 'List of User or Group' data and this casting allows us to easily understand the User and Group objects present inside the actual data by making use of simple Appian functions.
  • Hi Komal,
    You need an expression that returns the group name if its the group OR the username if its the user.

    You can use the below expression to wrap your column value which give you the desired result:

    =if(runtimetypeof(ri!groupOrUser) = tointeger('type!{www.appian.com/.../2009}Group'),
    group(togroup(ri!groupOrUser), "groupName"),
    rule!APN_displayUser(touser(ri!groupOrUser))
    )

    Let us know in case this doesn't works.
    Hope this helps!
  • I doubt how far the above code snippet works in following cases and if it doesn't work, it leads to erroneous results:

    1. In case if the task has got more than one assignees.
    2. In case if the task has got both User objects and Group objects as task assignees.

    In general, the expression rule should be in such a way that it should be able to handle multiple objects and also the various types(i.e. User, Group, User or Group etc) of the objects.
  • The above code snippet will work fine for all the following 3 data types ie, will handle them on them fly.
    1) User
    2) Group
    3) UserOrGroup

    As far as handling multiple assignees (any of the 3 data type) are concerned, in case there can be a list - apply can be called in the above expression rule which will handle both the single or multiple assignees.
  • Hi @sikhivahans @siddharthg837

    Thank you for your replies.
    @sikhivahans my query is resolved by your explanation.
  • @siddharthg It's true that the code snippet works when it is used in combination with apply(), but looping over each element in the array and an additional condition that checks the data type on the fly are a sort of burden when compared to casting, as casting the data to User or Group data type will help us getting the users (touser()) and groups (tointeger()) in a single shot.

    Anyhow it would be worth opting for an approach based on the execution times, as it is a key factor that makes difference in the approaches.

    @komalc No problem, glad to hear that.
  • Hi

    With respect to the same reference, I have made "Indicator" in my Portal Report for the column Average Lag Time. This is being displayed in my portal report. Now how do I get the same indicator displayed in my Tempo Report (just as I got user name and group name being displayed by the above help). I am working in version 7.11.

    Thanks in Advance!!