Sometimes Sorting is Not Working in Task Report

Certified Senior Developer

Hi All,

I have created a task report where my initial sort is task_id in descending and configured in Site .Whenever I load the task report, it shows me the grid in a correct manner with task_id in descending order.

I am also showing a link where I am calling the record action to create a new task.

The task consists of 5 milestone with active chaining and all has back button except the 1st milestone.

When the user clicks the "next" button in 1st milestone then we generate task id by writing in DB.

Not working Scenario : 

From task report, the user clicks the link(create new task link),he completes 1st milestone data & click next ,goes to 2nd milestone.

Then from 2nd milestone if the user goes back and comes to 1st milestone, then user tries to navigate, so they just click the task report tab .

Issues :

1. Now the current task id is not visible in the task report grid

2. The sorting of task_id in task report is totally collapsed. Until this sorting was working properly for task_id in descending.

Note : In Record Action ,I called the process model which has start form since i am using the same PM in separate tab in Site to create task.

I am not getting what is the issue. So could you please help me on this.

Thanks in Advance .

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    The sorting of task_id in task report is totally collapsed.

    It's hard to tell for sure what your task report is doing in the back-end, but based only on your screenshot, it looks as if the "#" column is being evaluated as TEXT, and therefore, sorting correctly (according to TEXT sorting rather than INT sorting).  Remember that TEXT sorts by the first character of a string, then for any ties, resolves the next character (if any), and so-on.  So "9" is highest, then "89", etc.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Hi Mike,

    Yes you are correct, we changed task id to integer using tointeger function in task report.

    It is sorting properly now.

    Many thanks!!

    But still for the above mentioned scenario the task id disappears in task report.

    Could you please let me know why task_id disappears in task report sometimes.

  • 0
    Certified Lead Developer
    in reply to Jansi J

    I'm unclear what the process flow is up until that point.  What exactly do you mean when you say "the user goes back"?  Are you saying that's the only time this happens?

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Yes ,we found this issue only when the user comes back from 2nd screen to 1st screen and navigates to any tabs.

    Analysis:

    If the user comes back from 3rd screen to 2nd screen and navigates to any tab ,and checked in task report, then it shows me the respective task id.

    It only not works if the user comes back from 2nd to 1st screen and navigate.

    In the below screenshot "c4" is the task id

  • 0
    Certified Lead Developer
    in reply to Jansi J

    Can you clarify what you mean by "comes back from 2nd screen to 1st screen" though?  Does that mean the process flow allows the old "allow user to go back" functionality?  That's not a very good idea - you should always have the process flow navigate forward from a task and, if you want to let the user loop back to a prior task, handle that in the process flow using an XOR gateway checking what button they've clicked.

    Additionally: what is the full code here?  IMHO the definition here should just be "tp!id", no bells or whistles.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Please see the below screenshot,

    The number I mentioned in the above screenshot is the milestones(screens) of task.

    Note : I have configured the 1st screen in both start form and in user input task since the start node shouldn't have incoming flow right---this solution was provided by you when I posted my  question regarding this previously 

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    If I use tp!id then it will show me the task Id generated by the process

    but I need the task Id which we generate for this application(primary key of the Task CDT),like below

  • 0
    Certified Lead Developer
    in reply to Jansi J

    Ok thanks for clarifying.  Please refer to the second part of my previous post which it appears you didn't address - the definition of your "Task ID" report field seems very likely problematic here, but I can't even guess as to what the issue might be without more insight into what you're actually doing there.

  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Many thanks Mike for spending your time on this. I have posted the reason why I not used tp!id in task id column definition.

  • 0
    Certified Lead Developer
    in reply to Jansi J
    I have posted the reason why I not used tp!id in task id column definition.

    Sorry, I didn't see that reply for some reason when still typing my previous one.

    I need the task Id which we generate for this application(primary key of the Task CDT)

    Gotcha - well your logic is returning blank for some of those.  Since you're not using the task's actual Task ID, it's impossible to know why it might be returning blank without knowing the full logic you're using to evaluate the ID.  One warning, though - process report logic **absolutely must use primitive functionality only**.  Otherwise it WILL return a null value.  Figuring out what it can and can't use, however, takes some experimentation.  One way to make this much easier is to encapsulate the logic you're using in an expression rule (note: any expression rule you call must be called WITHOUT using key:value syntax, which is super counter-intuitive and problematic, but still better than the alternative).  The benefit here, is that you can just make-and-save tweaks to your expression rule logic, then hit "refresh" on your report until it's working the way you want.