Tips / Logic for UDF storage

Discussion in 'Tally Developer' started by Gangadhar C Beldar, May 25, 2019.

    

  1. I have added a UDF in a sales Voucher (eg. Salesman) which is a selectable from Filtered Group (eg. SM Group under SDR). While Data Entry only SM group ledgers are displayed for selection. It is working fine.

    Now, the problem is that "When Ledger Name is changed/Altered in SM Group", The data stored in the UDF of are "Previously stored/Entries are have old Values of Ledger Name".

    How to overcome the issue ?
     


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    it can be explained logically, if u do the 2 things....

    1. make a screenshot of your entry screen.....
    2. show your field code, the one wherein you select the salesman.

    then we study and explain.........
     



  3. Dear Sir,
    ;;=========== Start =========
    [System : UDF]
    VchBroker : String : 1001 ;; UDF for Broker Name in Sales/Purchase/Cr Note/Dr Note Vouchers
    BrokerMasterID : Number : 1002 ;; UDF to Store MasterId of Select Broker Ledger

    ; ---------------------------------------------------------------------------
    ; Adding Broker In Voucher.
    ; ---------------------------------------------------------------------------

    [#Line : EI Consignee]
    Add : Option : TrBroker :mad:@IsSales
    [!Line : TrBroker]
    Add : Fields: mediumPrompt, TrPartyBroker, TrBrokerMasterID
    Local : Field : mediumPrompt : Info : $$LocaleString:"Broker :"
    Local : Field : mediumPrompt : width : @@ShortWidth
    [Field : TrPartyBroker]
    Use : Name Field
    Storage : VchBroker
    Table : BrokerTable
    Set Always : Yes
    Show Table : Always
    Key : Create Ledger
    [Field: TrBrokerMasterID]
    Use : Number Field
    Set as : $MasterID
    Storage : BrokerMasterID
    Invisible : Yes
    ;----------------------------------------------------------------------------
    ; Collection for Broker Table
    ;----------------------------------------------------------------------------
    [Collection : BrokerTable]
    Type : Ledger
    Child of : Broker
    Format : $Name,30
    Title : Broker
    Fetch : MasterID
    ;;=========== End =

    I am storing Broker Ledger Name (which is selected from the BrokerTable) in the UDF VchBroker. It was working fine, and Generating Custom Reports (like Commission, outstanding, & receivable etc).
    Problem : When Name of the Broker Ledger Name is changed, Unable to generate reports (Because using stored UDF is used to Generate Reports which contains "Old Value of Ledger Name").
    Now
    : Is it Good Idea to store UDF with Broker Ledger MasterID and use for Report Generate Reports ? Help me in the above code to store Broker Ledger Name MasterID.
     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Since you are generating the report.... then the code is fine...........

    your problem comes when you make changes......... so the problem is with refreshing and not the code. Introduce a dummy refresh in your field.
     



  5. Not the problem with refresh, Say;
    in the month of Apr 19, Broker Ledger Name as "Amit" over a period of time say from 1 jun, Name is changed to "Kamdar Amit". previous UDF Contains "Amit" from Jun Sales voucher UDF contains "Kamdar Amit"
    Hope it clear
     


Share This Page