Altering StockItemName in userdefined aggregate

Discussion in 'Free Source Codes' started by kamalDas, Dec 2, 2019.

    
  1. kamalDas

    kamalDas New Member


    Dear Experts ,

    While we create our own aggregate in the company object and storing stock item names in that , but after renaming the stock item name, when we try to open the aggregate again in edit mode the item will be removed, what can we do to avoid this?
     


  2. Devendra_Rawat

    Devendra_Rawat Well-Known Member





    Read this article

    Utilize UDF as Real Master


    As you aware, it is very easy to change the name of the masters (Ledger, Stock Item, Groups, etc.) in Tally even after
    passing the transactions using the same. The changes reflect instantly wherever the master has been associated. We can
    provide similar experience to customer when we use UDF as master in the customized solutions.

    Example with a use-case

    An organization wants a solution to know the breakup of sales based on its sales man. The solution requires a facility to
    create and maintain a list of sales man. The list of sales man has to be populated in sales voucher for selection. There
    should be a provision to alter the name of the sales man at master level and the changes should reflect in sales vouchers
    where the name of the sales man has been changed.
    How to achieve this?

    Use UDF as a real master by creating the unique IDs for each element of the aggregate UDF using the functions
    $$MakeUniqueID or $$MakeTallyUniqueID as it creates IDs based on various parameters. The Name of the sales man
    and Unique ID has to be stored in the aggregate UDF while creating list of sales man. At Sales voucher level, only the ID
    of the sales man has to be stored by using an invisible field, while selecting the sales man from the table.



    TDL code

    Note: The below mentioned TDL code is just to demonstrate the idea. It is suggested to test such features thoroughly
    before implementing in real time data. The commented invisible attribute in the below mentioned code can be
    uncommented to see the real time experience.


    Code:
    [#Menu: Accounts Info.]
    Add : Item : Before : @@locQuit : "Sales Man" : Alter : SalesMan
    [Report: SalesMan]
    Form : SalesMan
    Object : Company : ##SvCurrentCompany
    Title : "Sales Man Creation / Alteration"
    [Form: SalesMan]
    Part : SalesMan
    Width : 60
    Horizontal Align : Left
    [Part: SalesMan]
    Line : SalesManTitle, SalesMan
    Repeat : SalesMan : SalesMen
    Scroll : Vertical
    Break On: $$IsEmpty:#SalesManName
    [Line: SalesManTitle]
    Field : SalesManNameTitle, SalesManIDTitle
    Border : Column Titles
    [Line: SalesMan]
    Field : SalesManName, SalesManID
    [Field: SalesManNameTitle]
    Set as : "Name of Sales Man"
    Width : 30
    Skip : Yes
    [Field: SalesManIDTitle]
    Set as : "Unique ID (Invisible Field)"
    Width : 30
    Skip : Yes
    ; Invisible : Yes
    [Field: SalesManName]
    Storage : SalesManName
    Width : 30
    Max : 30
    Unique : Yes ;;To avoid duplication of name
    [Field: SalesManID]
    Set as : If $$IsEmpty:#SalesManName Then "" Else $$MakeUniqueID ;;$$MakeTallyUniqueID
    Storage : SalesManID
    Width : 30
    Set Always : Yes
    Fixed : Yes
    Skip : Yes
    ; Invisible : Yes
    ;;Changes in Sales Voucher to allocate the sales man
    [#Part: EI BaseInfo]
    Option : EI SalesManInfo : @@IsSales
    [!Part: EI SalesManInfo]
    Add : Line : After : EI Consignee : EI SalesManInfo
    [Line: EI SalesManInfo]
    Field : Simple Prompt, EI SalesManInfo, EI SalesMan
    Local : Field : Simple Prompt: Info : $$LocaleString:"Name of Sales Man :"
    [Field: EI SalesManInfo]
    Use : Name Field
    Table : ListofSalesMen
    Set as : If $$IsEmpty:#EISalesMan Then "" Else
    $$CollectionFieldByKey:$SalesManName:#EISalesMan:ListofSalesMen
    Set Always : Yes
    Show Table : On Blank
    [Field: EI SalesMan]
    Set as : $$TableObj:EISalesManInfo:$SalesManID
    Storage : VchSalesMan
    Set Always : Yes
    Width : 30
    Skip : Yes
    ; Invisible : Yes
    [Collection: ListofSalesMen]
    Title : "List of Sales Man"
    Type : SalesMen : Company
    Childof : ##SVCurrentCompany
    Format : $SalesManName, 30
    Search Key : $SalesManID
    [System: UDF]
    VchSalesMan : String : 22003 ;;To store the name of sales man at Voucher level
    SalesMen : Aggregate : 22000 ;;To store the list of sales men at Master level
    SalesManID : String : 22001
    SalesManName : String : 22002
    ;;End of file
     
    kamalDas, Rohit Khedar and uttam100 like this.


  3. anish

    anish Member


    thank you so much for sharing valuable info !
     


  4. uttam100

    uttam100 Member


    Good informative post.
     


  5. kamalDas

    kamalDas New Member


    Thank You Sir For Sharing this valuable Post,


    But in this case insted of typing
    IF we Bring the costcentre collection for salesman name and it is saved in the aggregate ,But after renaming the costcentre when we try to open the aggregate it will be removed . How can we avoid that.
     


  6. udaya

    udaya Active Member


    Best...post...
     


Share This Page