User wise Task List

Discussion in 'Tally Developer' started by Ria, May 6, 2022.

    
  1. Ria

    Ria Member


    This code is simply for assigning tasks to a user.

    For example a person with admin perms can assign the tasks to a user, and after that the user who is logged in should be able to view the list of tasks assigned to him/her.

    I have been able to store the task list, but unable to display it in another report.

    This code is a very simple version of what I wanted to achieve, I will try improving on it once I'm able to display the list of tasks, user-wise.




    Code:
    [#Field : CMP Username]
      
        Sub Form: UserTaskReport    : NOT $$IsEmpty:$$Value
      
    [Report : UserTaskReport]
      
        Form : UserTaskForm
      
    [Form : UserTaskForm]
      
        Background    :    "released yellow"
        Height        :    100% Screen
        Width        :    100% Screen
        Parts        :    UserTaskBody
        No Confirm    :    Yes
      
    [Part : UserTaskBody]
      
        Line            : UserTaskTitLine, UserTaskBodyLine
        Repeat            : UserTaskBodyLine:AESUserTasklist
        Break On        : $$IsEnd:$AESUserTaskDet
        Scrolled        : Vertical
          Common Border   : Yes
      
    [Line : UserTaskTitLine]
      
        Fields            : TaskNo, TaskDesc, TaskDate
        Border            : Thick Bottom
        Space Bottom    : 2
      
    [Field : TaskNo]
      
        Use            : Name Field
        Set as        : "Sr. No"
        Width        : 7% Screen
        Style        : Large Bold
        Border        : Thin Right
        Color        : "black"
        Read Only    : Yes
        Skip        : Yes
        Align        : Center
      
      
    [Field : TaskDesc]
      
        Use            : Name Field
        Set as        : "Task"
        Color        : "black"
        Skip        : Yes
        Style        : Large Bold
        Border        : Thin Right
        Align        : Center
        Full Width    : Yes
      
    
    [Field:TaskDate]
      
        Use            : Name Field
        Set as        : "Due Date"
        Width        : 20
        Color        : "black"
        Read Only    : Yes
        Skip        : Yes
        Style        : Large Bold
        Align        : Center
    
      
    [Line : UserTaskBodyLine]
      
        Fields    : UserTaskSrNo,UserTaskDes,UserTaskDue
        Local    : Field:Default:Local:Style:Default:Bold:No
      
    [Field : UserTaskSrNo]
      
        Use                : Number Field
        Set as            : $$Line
        Color            : "black"
        Read Only        : Yes
        Skip Forward    : Yes
        Width            : 7% Screen
        Align            : Center
          
    [Field    : UserTaskDes]
      
        Use                : Name Field
        Color            : "black"
        Width            : 50% Screen
        Storage            : AESUserTaskdet
        Full Width        : Yes
      
    [Field    : UserTaskDue]
      
        Use                : Uni Date Field
        Color            : "black"
        Width            : 20
        Storage            : AESUserTaskdate  
        Inactive        : $$IsEnd:$AESUserTaskdet
        Align            : Center
    
    
    [System : UDF]
      
        AESUserTaskUpdate    : Logical    : 6000
        AESUserTasklist        : Aggregate    : 6001
        AESUserTaskdet        : String    : 6002
        AESUserTaskdate        : Date        : 6003
      
    
    [#Menu : Gateway of Tally]
      
        Add : Button : TaskBtn
      
    [Button : TaskBtn]
      
        Title    : "My Tasks"
        Key        : F7
        Action    : Display    : DispUserTask
      
    
    [Report : DispUserTask]
      
        Object    : Company
        Form    : DispUserTask
      
    [Form : Disp User Task]
      
        Background        : "released yellow"
        Height            : 100% Screen
        Width            : 100% Screen
        Parts            : Disp User Task
        No Confirmation    : Yes
      
    [Collection : AES Current User Task List]
      
        Type    : Company
        Walk    : User List, AESUserTasklist
        Compute    : username            : $.Name
        Compute : AESUserTaskdet    : $AESUserTaskdet
        Compute : AESUserTaskadate    : $AESUserTaskDate
    
        Filter    : CurrentUserFilter
      
    [System : Formula]
      
        CurrentUserFilter    : $username = $$CmpUserName
      
    [Part : Disp User Task]
      
        Line            : UserTaskTitLine, UserTaskBodyLine;DispUserTaskTitLine, DispUserTaskBodyLine
        ;Repeat            : DispUserTaskBodyLine:AESCurrentUserTaskList
        ;Break On        : $$IsEnd:$UserTaskdesc
        Scroll            : Vertical
          Common Border   : Yes
    
    
    [Line : DispUserTaskTitLine]
      
        Fields            : TaskNo, TaskDesc, TaskDate
        Border            : Thick Bottom
        Space Bottom    : 2
      
    [Line: DispUserTaskBodyLine]
      
        Fields    :    DispUserTaskSrNo,DispUserTaskDes,DispUserTaskDue
      
        Local    :    Field    :    Default    :    Local    :    Style    :    Default    :    Bold    :    No
      
    [Field : DispUserTaskSrNo]
      
        Use                : Number Field
        Set as            : $$Line
        Color            : "black"
        Read Only        : Yes
        Skip Forward    : Yes
        Width            : 7% Screen
        Align            : Center
          
    [Field : DispUserTaskDes]
      
        Use            : Name Field
        Set as        : $AESUserTaskDet
        Color        : "black"
        Width        : 50% Screen
        Full Width    : Yes
      
      
    [Field :Disp UserTaskDue]
      
        Use            : Uni Date Field
        Set as        : $AESUserTaskdate
        Color        : "black"
        Width        : 20
        Inactive    : $$IsEnd:$AESUserTaskdet
        Align        : Center

    This code shows an error for incorrect storage,

    but when I comment the part of the code below "[#Menu:Gateway of Tally] "
    it works fine, it saves the task list and can be viewed in "Users and passwords" after pressing F11.


    Not every user has the permission to access that "Users and passwords" form so I need a way to display the assigned tasks to the user who is currently logged in.
     
    naren1234 likes this.


  2. HVPatel

    HVPatel Active Member


    Hi,
    There is changes in collection, you have to make secondary collection with source main collection and walk aggregate, and remove not required Compute
    below is updated working code
    Code:
    [#Field : CMP Username]
     
        Sub Form: UserTaskReport    : NOT $$IsEmpty:$$Value
     
    [Report : UserTaskReport]
     
        Form : UserTaskForm
     
    [Form : UserTaskForm]
     
        Background    :    "released yellow"
        Height        :    100% Screen
        Width        :    100% Screen
        Parts        :    UserTaskBody
        No Confirm    :    Yes
     
    [Part : UserTaskBody]
     
        Line            : UserTaskTitLine, UserTaskBodyLine
        Repeat            : UserTaskBodyLine:AESUserTasklist
        Break On        : $$IsEnd:$AESUserTaskDet
        Scrolled        : Vertical
          Common Border   : Yes
     
    [Line : UserTaskTitLine]
     
        Fields            : TaskNo, TaskDesc, TaskDate
        Border            : Thick Bottom
        Space Bottom    : 2
     
    [Field : TaskNo]
     
        Use            : Name Field
        Set as        : "Sr. No"
        Width        : 7% Screen
        Style        : Large Bold
        Border        : Thin Right
        Color        : "black"
        Read Only    : Yes
        Skip        : Yes
        Align        : Center
     
     
    [Field : TaskDesc]
     
        Use            : Name Field
        Set as        : "Task"
        Color        : "black"
        Skip        : Yes
        Style        : Large Bold
        Border        : Thin Right
        Align        : Center
        Full Width    : Yes
     
    
    [Field:TaskDate]
     
        Use            : Name Field
        Set as        : "Due Date"
        Width        : 20
        Color        : "black"
        Read Only    : Yes
        Skip        : Yes
        Style        : Large Bold
        Align        : Center
    
     
    [Line : UserTaskBodyLine]
     
        Fields    : UserTaskSrNo,UserTaskDes,UserTaskDue
        Local    : Field:Default:Local:Style:Default:Bold:No
     
    [Field : UserTaskSrNo]
     
        Use                : Number Field
        Set as            : $$Line
        Color            : "black"
        Read Only        : Yes
        Skip Forward    : Yes
        Width            : 7% Screen
        Align            : Center
         
    [Field    : UserTaskDes]
     
        Use                : Name Field
        Color            : "black"
        Width            : 50% Screen
        Storage            : AESUserTaskdet
        Full Width        : Yes
     
    [Field    : UserTaskDue]
     
        Use                : Uni Date Field
        Color            : "black"
        Width            : 20
        Storage            : AESUserTaskdate 
        Inactive        : $$IsEnd:$AESUserTaskdet
        Align            : Center
    
    
    [System : UDF]
     
        AESUserTaskUpdate    : Logical    : 6000
        AESUserTasklist        : Aggregate    : 6001
        AESUserTaskdet        : String    : 6002
        AESUserTaskdate        : Date        : 6003
     
    
    [#Menu : Gateway of Tally]
     
        Add : Button : TaskBtn
     
    [Button : TaskBtn]
     
        Title    : "My Tasks"
        Key        : F7
        Action    : Display    : DispUserTask
     
    
    [Report : DispUserTask]
     
        Object    : Company
        Form    : DispUserTask
     
    [Form : Disp User Task]
     
        Background        : "released yellow"
        Height            : 100% Screen
        Width            : 100% Screen
        Parts            : Disp User Task
        No Confirmation    : Yes
     
    [Collection : Main Coll]
        Type        : User List : Company
        Childof        : ##SVCurrentCompany
         Fetch: *,*.*
    [Collection: AES Current User Task List]
         Source Collection    : Main Coll
    
    ;    Type    : Company
        Walk    : /*User List,*/ AESUserTasklist
        Compute    : username            : $.Name
    ;    Compute : AESUserTaskdet    : $AESUserTaskdet
        Compute : AESUserTaskadate    : $AESUserTaskDate
        Fetch: *,*.*
    Filter    : CurrentUserFilter
     
    [System : Formula]
     
        CurrentUserFilter    : $username = $$CmpUserName
     
    [Part : Disp User Task]
     
        Line            : UserTaskTitLine, DispUserTaskBodyLine ;UserTaskBodyLine;DispUserTaskTitLine, DispUserTaskBodyLine
        Repeat            : DispUserTaskBodyLine:AESCurrentUserTaskList
        ;Break On        : $$IsEnd:$UserTaskdesc
        Scroll            : Vertical
          Common Border   : Yes
    
    
    [Line : DispUserTaskTitLine]
     
        Fields            : TaskNo, TaskDesc, TaskDate
        Border            : Thick Bottom
        Space Bottom    : 2
     
    [Line: DispUserTaskBodyLine]
     
        Fields    :    DispUserTaskSrNo,DispUserTaskDes,DispUserTaskDue
     
        Local    :    Field    :    Default    :    Local    :    Style    :    Default    :    Bold    :    No
     
    [Field : DispUserTaskSrNo]
     
        Use                : Number Field
        Set as            : $$Line
        Color            : "black"
        Read Only        : Yes
        Skip Forward    : Yes
        Width            : 7% Screen
        Align            : Center
         
    [Field : DispUserTaskDes]
     
        Use            : Name Field
        Set as        : $AESUserTaskDet
        Color        : "black"
        Width        : 50% Screen
        Full Width    : Yes
     
     
    [Field :Disp UserTaskDue]
     
        Use            : Uni Date Field
        Set as        : $AESUserTaskdate
        Color        : "black"
        Width        : 20
        Inactive    : $$IsEnd:$AESUserTaskdet
        Align        : Center
       
    
     
    dipika and Ria like this.


  3. Ria

    Ria Member


    It is working now, thanks a lot.

    Can you explain why I got the error, "Incorrect storage" in Field:UserTaskDes?

    The error message was so misleading :(
     


  4. HVPatel

    HVPatel Active Member


    Because of unwanted Compute in collection
     
    dipika and Ria like this.


  5. Frz

    Frz Member


    Not working on Tally Prime

     


Share This Page