Need Help to Auto Numbring Alias

Discussion in 'Free Source Codes' started by Prasanna Pathak, Dec 17, 2017.

    
  1. Bhawna

    Bhawna Member


    This is really thoughtful and helpful solution @Sanjeev S

    I was wondering is there a way that I could add "text" in front of the auto-generated numbers

    I have two companies and thinking of putting a prefix (manually or automatically) so that there is no overlap of Alias/Barcode.

    e.g ABC1000001 and XYZ1000001

    Would really appreciate a solution



     


  2. Sanjeev S

    Sanjeev S Active Member


    Bhawana Mam,

    You need to add just a prefix to mycode

    [system : formulae]
    MyCode1 : @@MyNCode
    MyCode2 : $$ZeroFill:mad:@MyCode1:6
    MyPrefix : @@CmpmailName contains "ABC" then "ABC" else "XYZ"
    MyCode : @@MyPrefix + @@MyCode2
     
    Bhawna likes this.


  3. Bhawna

    Bhawna Member


    Great. Thanks

    I am testing the code. Facing error in one company (getting the same number in Alias everytime) . I will share an update after complete testing.


     


  4. Bhawna

    Bhawna Member


    @Sanjeev S sir

    I am using Company Website instead of Company Name - was facing some issues with Company Name.

    Also, I tested the code and facing an error - The number is not updating automatically. I continue to see the same number or some random number (image attached) in Alias on creating new Item


    Could you please check if I have put the two Codes shared by you correctly. Thanks for your help !




    [#Form : Stock Item]
    Local : Field : MST Alias: Set As : +
    If $$Line=1 And $$InCreateMode Then ($$String:mad:@MyCode) +
    else if $$Line=1 And $$InAlterMode and $$IsEmpty:$Name then ($$String:mad:@MyCode) +
    else $Name
    Local : Field : MST Alias: Set Always : Yes

    [system : formulae]
    MyCode1 : @@MyNCode
    MyCode2 : $$ZeroFill:mad:@MyCode1:7
    MyPrefix : @@Cmpwebsite
    MyCode : @@MyPrefix + @@MyCode2
    LNo : $$CollectionField:$OnlyAlias:1:InstaAStocks
    LNoNum : $$Number:mad:@LNo
    MyNCode : @@LNoNum + 1

    [Collection : InstaAStocks]
    Collection : List of StockItems
    Fetch : MasterId, PartNo, OnlyAlias
    Sort : @@Increasing : -$OnlyAlias,$Name
    Format : $Masterid
    Format : $OnlyAlias
     

    Attached Files:



  5. Sanjeev S

    Sanjeev S Active Member


    Bhawna Mam,

    Normally the logic fails if you forcefully add some other alias apart from the Logic. Just remove them or put them in Part No

    The Logic will work.

    Regards,
     
    Bhawna likes this.


  6. Sanjeev S

    Sanjeev S Active Member


    Bhawana Mam,

    You can alternatively try this code .....

    I hope it can work either for Part No or Alias

    /*Item and Ledger has unique Master ID in Tally we can use it in Auto Numbering
    using No of Ledgers/Stockitem can fail if we delete Ledger/Items hence this can be a safer way*/

    [#Field: STKI PartNo]
    Setas : If ($$Line=1 AND ($$InCreateMode or $$IsEmpty:$$Value)) +
    then @MyCode +
    else $$Value

    Type : String : Forced
    SetAlways : Yes

    ;; Local Formula
    MyMastID : #STKIMasterID + 1
    MyCode : $$ZeroFill:mad:MyMastID:6

    [#Part: STKI Desc]
    add : Line : after : STKI Desc : STKI Master ID
    Invisible : NO


    [Line : STKI Master id]
    Fields : Short Prompt, STKI Master id
    Local : Field : Short Prompt : Info : $$LocaleString:"Unique ID"
    Invisible : NOT ##UseStockDescription
    Space Top : 0.25


    [Field : STKI Master ID]
    Use : Number Field
    Set as : @@LNo
    Type : Number : Forced
    Skip : Yes

    Set Always : Yes


    [Collection : InstaMasterID]
    Collection : List of StockItems
    Fetch : MasterId, PartNo
    Sort : -$MasterId
    Add : Format : PartNo, $Masterid


    [System : Formulae]
    LNo : $$CollectionField:$MasterID:1:InstaMasterID
     
    Bhawna likes this.


  7. tejeet

    tejeet Member


    upload_2020-1-14_10-50-8.png

    PLEASE SHARE MARKED GST DETAILS TDL AS IT SHOW ALL GST DETAILS , PLEASE EMAIL ME THIS TDL - tejeet1@gmail.com
     


  8. Bhawna

    Bhawna Member


    This seems to really good logic but somehow, I see the same unique number on Creating the New Stock Item. I will continue to use the earlier TDL shared by you - that works better for my requirements.thanks again for the help
     


  9. Bhawna

    Bhawna Member


    Thanks a lot for the suggestion. Is there a way that I could put a restriction on this i.e do not allow the user to change the alias
     


  10. ANURAG954245

    ANURAG954245 Member


    use
    at field level
    readyonly:not $$iscmpowner
     


Share This Page