How do i Fetch This in Collection?

Discussion in 'Tally Developer' started by Sohail Khan, Mar 16, 2021.

    
  1. Sohail Khan

    Sohail Khan Member


    Please Help me Experts in the Collection to get Length Column. I am Getting only First Value in SQL Query.
    Thank You.
    Code:
    [#Collection: Pending Purc Orders]
         Compute: StorageforLengthh : $$CollectionField:$StorageforLength:1:InventoryEntries
        ;Search Key          :  $Name
        Fetch               : Name, OrderDueDate, FinalBalance, GodownName, TrackLedger, BatchName, BilledQty, +
                              OrderPreclosureQty, Rate, Discount, Amount, OpeningBalance,Parent, BasicPackageMarks, StorageforLength, StorageforLengthh
    
        ParmVar     : pvAccountName          : String : $$AccountName
        Parmvar     : pvPartyLedgerName      : String : If $$IsEmpty:($$BaseOwner:$PartyLedgerName) then $LedgerEntries[1].LedgerName Else ($$BaseOwner:$PartyLedgerName)
        ParmVar        : pvFirstPartyLedgerName : String : IF @@IsRejIn OR @@IsRejOut Then $$BaseOwner:$PartyLedgerName Else  $.LedgerEntries[1].LedgerName
        Parmvar     : PartyLedVchmode          : String : $..LedgerName
    
        ;; For Specific Voucher Types,source object is from primary owner (Report Voucher)
        Option                : InPendingOrderwithFltItem       : @@TrackEnabledVchType
    
        ;; For Other than specific Voucher Types, source object is from stock item allocation report.
        Option                : InPendingOrderwithoutFltItem : Not @@TrackEnabledVchType
       
        Option                : GatherTrackInStr              : NOT @@IsOutwardType AND NOT @@IsInwardType
    
    [#Collection: VCHPo]
       
        Parm Var            : pvStockItemName : String : $StockItemName
    
        Title               : $$LocaleString:"List of Orders"
        Sub Title           : $$LocaleString:"Name", $$LocaleString:"Due On", $$LocaleString:"Balance"
        Source Collection   : Pending Purc Orders
        Fetch               : Name, OrderDueDate, FinalBalance, GodownName, TrackLedger, BatchName, BilledQty, +
                              OrderPreclosureQty, Rate, Discount, Amount, OpeningBalance,Parent, BasicPackageMarks, StorageforLength, StorageforLengthh
    
        Filter              : ForNotAppl,TrackOfItem
    
        Format              : $Name, 8
        Format                : $BasicPackageMarks, 8
        Format                : $StorageforLength, 8
        Format                : $StorageforLengthh, 8
        Format              : $OrderDueDate, 6      : Universal Date
        Format              : $FinalBalance, 8      : Base
    
        Client Only         : Yes
        Keep Source            : ().        
    [​IMG] [​IMG]
     


  2. Himanshu-2002

    Himanshu-2002 Active Member


    Use Collection Field by Key Function Instead of Collection Field Function
     


  3. Sohail Khan

    Sohail Khan Member


    Not showing Sir, Please Guide.
    [*Collection: Pending Purc Orders]

    Fetch : Name, OrderDueDate, FinalBalance, GodownName, TrackLedger, BatchName, BilledQty, +
    OrderPreclosureQty, Rate, Discount, Amount, OpeningBalance,Parent, StorageforLength, StorageforLengthh

    Compute:StorageforLengthh: $$CollectionFieldByKey:$StorageforLength:$Name:InventoryEntries
    Search Key:$Name
    ParmVar : pvAccountName : String : $$AccountName
    Parmvar : pvPartyLedgerName : String : If $$IsEmpty:($$BaseOwner:$PartyLedgerName) then $LedgerEntries[1].LedgerName Else ($$BaseOwner:$PartyLedgerName)
    ParmVar : pvFirstPartyLedgerName : String : IF @@IsRejIn OR @@IsRejOut Then $$BaseOwner:$PartyLedgerName Else $.LedgerEntries[1].LedgerName
    Parmvar : PartyLedVchmode : String : $..LedgerName
    ;; For Specific Voucher Types,source object is from primary owner (Report Voucher)
    Option : InPendingOrderwithFltItem : @@TrackEnabledVchType
    ;; For Other than specific Voucher Types, source object is from stock item allocation report.
    Option : InPendingOrderwithoutFltItem : Not @@TrackEnabledVchType

    Option : GatherTrackInStr : NOT @@IsOutwardType AND NOT @@IsInwardType
     


  4. Himanshu-2002

    Himanshu-2002 Active Member


    Do it Like this

    [Collection: InventorySearchKeyColl]
    Source Collection :.
    Walk: Inventory Entries
    Compute:UDF:$UDF
    Search Key: $VoucherNumber

    [Collection: Purchase Order Coll]
    ...

    Compute: Length value: $$CollectionFieldByKey:$UDF:$VoucherNumber:InventorySearchKeyColl
     


  5. Himanshu-2002

    Himanshu-2002 Active Member


    Concept: Inventory Entries Doesn't have a search Key By Default That is why...It wasn't working So, I created a collection where I fetched Data Of Inventory Entries and added a search Key
     


  6. Sohail Khan

    Sohail Khan Member


    Can you share the collection with me. I dont know how to make that.
     


  7. Himanshu-2002

    Himanshu-2002 Active Member


    use this

    [Collection: InventorySearchKeyColl]
    Source Collection :.
    Walk: Inventory Entries
    Compute:UDF:$UDF
    Search Key: $VoucherNumber
     


  8. Sohail Khan

    Sohail Khan Member


    Nahi hora hai Sir, Now its showing Like this
    [Collection:CollForLength]
    Type : Ledger Purchase Orders


    Fetch : VoucherNumber, Name, StorageforLength, StorageforLengthh
    [Collection:mycollforlength]

    Source Collection : CollForLength
    Walk : Inventory Entries
    ;Compute:StorageforLength:$StorageforLength
    ;Compute:StorageforLengthh: $$CollectionFieldByKey:$StorageforLength:$Name:mycollforlength
    ;Search Key: $Name
    Fetch : VoucherNumber, Name, StorageforLength, StorageforLengthh
     

    Attached Files:



  9. Himanshu-2002

    Himanshu-2002 Active Member


    1. Source Collection Should be Current Collection
    Example: Source Collection:.

    2. If you are saving a value at Sub Object Level then You can't find it directly from main object collection. You have to walk to the sub object after that Compute the Values

    Tip: Computed name and Method name should be unequal. Believe me... I have wasted hours by checking Every line of codes and After Doing Everything I solved it by doing this many times.

    Example:- Compute:UDFVal:$UDF
     


  10. Sohail Khan

    Sohail Khan Member


    S
    Sir i used like this but it shows nothing.
    [Collection: InventorySearchKeyColl]
    Source Collection :.
    Walk: Inventory Entries
    Compute:storageforlengthh:$storageforlength
    Search Key: $Name
     


  11. Himanshu-2002

    Himanshu-2002 Active Member


    Sir It will not show anything in SQL Query
     


  12. Himanshu-2002

    Himanshu-2002 Active Member


    And What is $Name

    Until You didn't Computed Name... You can't use it
     


  13. Sohail Khan

    Sohail Khan Member


    K. I will try tomorrow. $name is order no for each item .
     


  14. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    It can be EQUAL in a Collection, but while defining the UDF in a Object, it has to be UNEQUAL.
     


  15. Himanshu-2002

    Himanshu-2002 Active Member


    Yes Sir, Logically It should work like that But Sometimes That Method worked for me
     


  16. Sohail Khan

    Sohail Khan Member


    Sir, I tried it But still not working, Now its Showing Last Line Value when using Collectionfieldbykey.
    Code:
    [Collection: InventorySearchKeyColl]
    Source Collection :.
    Walk: Inventory Entries
    Compute:StorageforLengthh:$StorageforLength
    Search Key: $Name
      
    [*Collection: Pending Purc Orders]
       
        Fetch               : Name, OrderDueDate, FinalBalance, GodownName, TrackLedger, BatchName, BilledQty, +
                              OrderPreclosureQty, Rate, Discount, Amount, OpeningBalance,Parent, StorageforLength, StorageforLengthh, VoucherNumber
    Compute: StorageforLengthhh:$$CollectionFieldByKey:$StorageforLengthh:$Name:InventorySearchKeyColl
    
        ParmVar     : pvAccountName          : String : $$AccountName
        Parmvar     : pvPartyLedgerName      : String : If $$IsEmpty:($$BaseOwner:$PartyLedgerName) then $LedgerEntries[1].LedgerName Else ($$BaseOwner:$PartyLedgerName)
        ParmVar        : pvFirstPartyLedgerName : String : IF @@IsRejIn OR @@IsRejOut Then $$BaseOwner:$PartyLedgerName Else  $.LedgerEntries[1].LedgerName
        Parmvar     : PartyLedVchmode          : String : $..LedgerName
    
        ;; For Specific Voucher Types,source object is from primary owner (Report Voucher)
        Option                : InPendingOrderwithFltItem       : @@TrackEnabledVchType
    
        ;; For Other than specific Voucher Types, source object is from stock item allocation report.
        Option                : InPendingOrderwithoutFltItem : Not @@TrackEnabledVchType
      
        Option                : GatherTrackInStr              : NOT @@IsOutwardType AND NOT @@IsInwardType
    ;    Select $amount, $name,$StorageforLengthhh from PendingPurcOrders
    
    [*Collection: VCHPo]
      
        Parm Var            : pvStockItemName : String : $StockItemName
    
        Title               : $$LocaleString:"List of Orders"
        Sub Title           : $$LocaleString:"Name", $$LocaleString:"Due On", $$LocaleString:"Balance"
        Source Collection   : Pending Purc Orders
        Fetch               : Name, OrderDueDate, FinalBalance, GodownName, TrackLedger, BatchName, BilledQty, +
                              OrderPreclosureQty, Rate, Discount, Amount, OpeningBalance,Parent, StorageforLengthhh
    
        Filter              : ForNotAppl,TrackOfItem
    
        Format              : $Name, 8
        Format              : $StorageforLengthhh, 8
        Format              : $OrderDueDate, 6      : Universal Date
        Format              : $FinalBalance, 8      : Base
    
        Client Only         : Yes
        Keep Source            : ().    
    [​IMG]
    [​IMG]
     
    Last edited: Mar 18, 2021


  17. Himanshu-2002

    Himanshu-2002 Active Member


    Sir Did You Computed The Search Key?
    Please Try to Understand what you are writing
     


  18. Sohail Khan

    Sohail Khan Member


    Search key Kaise karu Compute?:(
    [Collection: InventorySearchKeyColl]
    Source Collection :.
    Walk: Inventory Entries
    Walk: Batch Allocations
    Walk: Accounting Allocations
    Compute:SearchKey:$Name
    Compute:BasicUserDescriptionn:$BasicUserDescription
    Compute:StorageforLengthh:$StorageforLength
    Search Key: $SearchKey

     


  19. Himanshu-2002

    Himanshu-2002 Active Member


    Sir Aap 3 times walk kyu kar rahe ho?
     


  20. Sohail Khan

    Sohail Khan Member



  21. Himanshu-2002

    Himanshu-2002 Active Member


    Congrats Sir
     


  22. Sohail Khan

    Sohail Khan Member


    Drive sir, helped me in the collection.
     


  23. Himanshu-2002

    Himanshu-2002 Active Member


    Oo... What method he used?
    Can you share the code So, That I can learn new concepts?
     


  24. Sohail Khan

    Sohail Khan Member


    [Collection : PurOrd_VchSrc]
    Type : Vouchers : Voucher type
    Child of : $$VchTypePurcOrder
    Belongs To : Yes
    Fetch : IsOptional
    Filter : NOTIsOptionalVoucher
    [Collection : PurOrd_VchSummaryColl]
    Source Collection : PurOrd_VchSrc
    Walk : ALLInventoryEntries, BatchAllocations
    By : Order ID : $OrderID
    By : StockItemName : $StockItemName
    Compute : MYLength : $StorageforLength
    Compute : MYPackageforMarks : $BasicPackageMarks
    Search Key : $OrderID
     


  25. Himanshu-2002

    Himanshu-2002 Active Member



Share This Page