Get MasterId of Voucher from Voucher Number

Discussion in 'Free Source Codes' started by Devendra_Rawat, Mar 21, 2021.

    
  1. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    Tally Solution.

    https://help.tallysolutions.com/article/DeveloperReference/faq/6191.html

    Similar to a Master, is it possible to identify a particular Voucher?
    Yes, it is possible to uniquely identify a voucher, similar to a master.

    Procedure
    1. If the Object Voucher needs to be identified in a Report or a Function to set the current object context, then only the MasterID of the current Voucher can be used. MasterID must be used prefixed with ID:

    Example
    [Report: TSPL Sample Voucher Object]

    Object : Voucher : @@TSPLVchID

    [System: Formula]

    TSPLVchID : "ID:27"

    2. If the Object Voucher needs to be identified in the Action Modify Object, any methods can be used.
    a. If MasterID is used as an identifier, Date is not required and uniqueness of the Voucher is ensured.
    b. If any other identifier is specified, specifying Date becomes mandatory and first Voucher matching the given Method Value for the specified day will be taken up for alteration.

    Example

    [Function: Modify PO Narration]

    VARIABLE : VarNarr : String

    00 : SET : VarNarr : "This is modified Narration"
    10 : MODIFY OBJECT : (Voucher,@@VID).Narration : ##VarNarr

    [System: Formula]
    VID : Date:"1-Apr-2008":Reference:"abcd"

    Similar to the Method Reference used above, any of the other Methods can be used as shown below:

    VID: "Date:'" + $$String:$Date + "'" + ":Reference:'" + $PurchaseOrderNo + "'"
    VID: "Date:'" + $$String:$Date + "'" + ":Narration:'keshava madhava'"
    VID: "Date:'" + $$String:$Date + "'" + ":Narration:'" + $$Table:EIOrder:$Narration.


    This is useful, for example when your are importing/updating your tally vouchers from an excel list and you want to avoid duplicate entries.. BUT there is more to it... how to use above method practically..

    Using a Collection and then CollectionFieldbyKey.. to find the MasterId will ruin the import process...


    ... Code will be updated shortly.. and will be :cool: visible :cool: to only those... who want to learn more... :cool::cool:
     
    Last edited: Mar 21, 2021


  2. Himanshu-2002

    Himanshu-2002 Active Member


    Will It Work If we pass GUID?
     


Share This Page