Getting Number of Stock Item under Category

Discussion in 'Free Source Codes' started by kapil22, Feb 26, 2022.

    
  1. kapil22

    kapil22 Member


    Dear Masters,

    Can you help on this subject in Tally Prime.

    Regards,
    Kapil
     


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Make a new collection....
    filter it as per your category/group.

    use $$Numitems to get the # of items in that category/group.
     
    kapil22 likes this.


  3. kapil22

    kapil22 Member


    Thanks ❤️ it's sidham
     


  4. kapil22

    kapil22 Member


    One more question if I want Num stock item which don't have category. I tried but not succeed. Pls suggest
     


  5. RaylongTale

    RaylongTale New Member


    You can use filter for that too like Mr. Amit kmdar suggested.
     


  6. kapil22

    kapil22 Member


    try not succeed
     


  7. RaylongTale

    RaylongTale New Member


    Kindly Share the code for the filter you used. I can guide you to get it.
     


  8. kapil22

    kapil22 Member


    please have a look:
    Regards,
    Kapil
    Code:
    [#Field:     STKI PartNo]
        option:    STKI PartNoNew:    @@K004IsBarcodeApplicable
    [!field:    STKI PartNoNew]
        Setas:         If ($$Line=1 AND $$InCreateMode) then @KSCCode + "P"+$$ZeroFill:@KSTotal:5 else $$Value
        Type:         String: Forced
        SetAlways:     Yes
        KSTotal:         (@KStartPartNo + @KSNumstock)
        KStartPartNo :     1
        KSNumstock:     $$Numitems:KStockItemCollection ;$$NumStockItems
        Max:         10
        Skip:         Yes
        KSCCode:        if #STKICategory= $$SysName:NotApplicable then "ODE" ELSE @@KSCCode ;#STKICategory
        color:        Red
        background:     Pale Green
    
    [Collection:    KStockItemCollection]
        type:    Stock Item
        filter:    KSTKICategory
        belongsto: yes
        fetch:    Name
    [#Form:     Stock Item]
        option:    Stock ItemNew:    @@K004IsBarcodeApplicable
    [!Form:     Stock ItemNew]
        local:Part: STKI Basic:Local:Line: MST Name: Local:field: MST Name: setas: #KSTKIItemName +@@RSKIN+ #KSTKIMaterial +@@RSKIM+ #KSTKIColor +@@RSKIC+ #KSTKISize +@@RSKIS+ #KSTKIRange
        local:Part: STKI Basic:Local:Line: MST Name: Local:field: MST Name: skip: yes
        local:Part: STKI Basic:Local:Line: MST Name: Local:field: MST Name: Color: red
        local:Part: STKI Basic:Local:Line: MST Name: Local:field: MST Name: background: Pale Green
        local:Part: STKI Basic:Local:Line: MST Name: height: 1.3
        local:Part: STKI Basic:Local:Line: MST Name: replace: Field:ShortPrompt:MediumPrompt
        local:Part: STKI Basic:Local:Line: MST Name: local: Field:MediumPrompt:Info : $$LocaleString:"Stock Name"
        local:Part: STKI Basic:Local:Line: STKI PartNo: height: 1.3
        add:part: atbeginning: KSTKI Parent
        Local:part: KSTKI Parent: local:Line: STKI Parent: replace: Field:ShortPrompt:MediumPrompt
        Local:part: KSTKI Parent: local:Line: STKI Parent: local: Field:MediumPrompt:Info : $$LocaleString:"Stock Group"
        Local:part: KSTKI Parent: local:Line: STKI Category: replace: Field:ShortPrompt:MediumPrompt
        Local:part: KSTKI Parent: local:Line: STKI Category: local: Field:MediumPrompt:Info : $$LocaleString:"Stock Category"
        local:Part: STKI Parent: local:Line: STKI Parent: invisible:yes
        local:Part: STKI Parent: local:Line: STKI Category: invisible:yes
    
       
       
    [part: KSTKI Parent]
        add:    Lines:    KSTKIItemName, KSTKIMaterial, KSTKIColor, KSTKISize, KSTKIRange
        lines:    STKI Parent, STKI Category
    [Line: KSTKIItemName]
        field:    MediumPrompt, KSTKIItemName
        local: Field:MediumPrompt:Info : $$LocaleString:"Item Name"
    [Line: KSTKIMaterial]
        field:    MediumPrompt, KSTKIMaterial
        local: Field:MediumPrompt:Info : $$LocaleString:"Item Material"
    [line: KSTKIColor]
        Field:     MediumPrompt, KSTKIColor
        local: Field:MediumPrompt:Info : $$LocaleString:"Item Color"
    [line: KSTKISize]
        Field:     MediumPrompt, KSTKISize
        local: Field:MediumPrompt:Info : $$LocaleString:"Item Size"
    [line: KSTKIRange]
        Field:     MediumPrompt, KSTKIRange
        local: Field:MediumPrompt:Info : $$LocaleString:"Item Range"
    
    [Field: KSTKIItemName]
        use:    NameField
        storage:    KItemName
    [Field: KSTKIMaterial]
        use:    NameField
        storage:    KItemMaterial
    [Field: KSTKIColor]
        use:    NameField
        storage:    KItemColor
    [Field: KSTKISize]
        use:    NameField
        storage:    KItemSize
    [Field: KSTKIRange]
        use:    NameField
        storage:    KItemRange
    [system: udf]
        KItemName:    String:    5001
        KItemMaterial:    String:    5002
        KItemColor:    String:    5003
        KItemSize:        String:    5004
        KItemRange:    String:    5005
    [system: formula]
        RSKIN:    IF #KSTKIItemName = "" THEN "" ELSE " "
        RSKIM:    IF #KSTKIMaterial = "" THEN "" ELSE " "
        RSKIC:    IF #KSTKIColor = "" THEN "" ELSE " "
        RSKIS:    IF #KSTKISize = "" THEN "" ELSE " "
        RSKIR:    IF #KSTKIRange = "" THEN "" ELSE " "
        KSTKICategory: $$IsBelongsToCategory:#STKICategory
        KSCReplace: $$StringFindAndReplace:#STKICategory:"-":""
        KSCCode:    $$Stringword:1:@@KSCReplace
    
     


  9. RaylongTale

    RaylongTale New Member


    Fetch Category in collection

    try using this forumla

    KSTKINoCategory : $Category contains "Not Applicable"

    This is just an idea you can recode it as per your needs.

    Regards,
    Raylong
     


  10. kapil22

    kapil22 Member


    final done as follows:
    Thanks,
    Try, Refer, Try, Refer, and Try : the only way to find solution


    Code:
    [#Field:     STKI PartNo]
        option:    STKI PartNoNew:    @@K004IsBarcodeApplicable
    [!field:    STKI PartNoNew]
        Setas:         If ($$Line=1 AND $$InCreateMode) then @KSCCode + "P"+$$ZeroFill:@KSTotal:5 else $$Value
        Type:         String: Forced
        SetAlways:     Yes
        KSTotal:         (@KStartPartNo + @KSNumstock)
        KStartPartNo :     1
        KSNumstock:     if #STKICategory= $$SysName:NotApplicable then $$Numitems:KStockItemCollection2 else $$Numitems:KStockItemCollection
        Max:         10
        Skip:         Yes
        KSCCode:        if #STKICategory= $$SysName:NotApplicable then "ODE" ELSE @@KSCCode
        color:        Red
        background:     Pale Green
    
    [Collection:    KStockItemCollection]
        type:    Stock Item
        filter:    KSTKICategory
        fetch:    Name
    [Collection:    KStockItemCollection2]
        type:    Stock Item
        filter:    KSTKICategory2
        fetch:    Name
    
    [system: formula]
        RSKIN:    IF #KSTKIItemName = "" THEN "" ELSE " "
        RSKIM:    IF #KSTKIMaterial = "" THEN "" ELSE " "
        RSKIC:    IF #KSTKIColor = "" THEN "" ELSE " "
        RSKIS:    IF #KSTKISize = "" THEN "" ELSE " "
        RSKIR:    IF #KSTKIRange = "" THEN "" ELSE " "
        KSTKICategory: $$IsBelongsToCategory:#STKICategory
        KSTKICategory2: $Category contains "Not Applicable"
        KSCReplace: $$StringFindAndReplace:#STKICategory:"-":""
        KSCCode:    $$Stringword:1:@@KSCReplace
     


  11. Rohit Khedar

    Rohit Khedar Member


    how to use this explain with screenshot please
     


Share This Page