Find Index of Selected Table Item

Discussion in 'Tally Developer' started by Grace K, Mar 15, 2024.

    
  1. Grace K

    Grace K New Member


    I have a collection that is used as a table. When i select an item from the table i want to set the index of that item into a field. How do i retrieve the index of the table item? Is there any inbuilt function in tally?

    [Field : Patientname1]
    Width : 70 mms
    Use : Name Field
    Table : SalesmanNameCollection, New Number
    Show Table : Always
    Set As : IF $$EditData=$$SysName:NewNumber THEN ##PName ELSE $$Value
    Set Always : Yes
    Trigger : POS Invoice1 : $$EditData=$$SysName:NewNumber
    Dynamic : If $$Line>1 then $$SysName:EndofList Else ""
    Storage : PatientName
    Subform : Duplicates : ##OldName=$$Value
    Modifies : PatntName


    [Collection : SalesmanNameCollection]
    Title : "Patients"
    Type : Patient : Company
    Childof : ##SVCurrentCompany
    Fetch : FileNumber,PatientName,agee,Gender
    Format : $PatientName, 20
    Format : $FileNumber, 20
     


  2. AMIT JALAN

    AMIT JALAN Member


    Hi, Can you explain what exactly you need with Index number.

    I don't have any idea about index number but Might be I may help you to achieve the same by other means.
     


  3. Grace K

    Grace K New Member


    Sorry, i was able to solve that. But my actual issue is that i want to write a function to update a certain value of the collection that is FileNumber. I have a filtered collection that contains only the particular object that i want to update but the function i wrote is not working

    [Collection : FilteredSalesmanCollection]
    Use : SalesmanNameCollection
    Filter : FilePatient

    [System : Formula]
    FilePatient : $FileNumber=#PatientIndex


    [Function : updateFileNumber]
    Parameter : index : String
    Parameter : newfile : String
    01 : Walk Collection : FilteredSalesmanCollection
    01a : Set Object :
    01c : Set Target
    01b : Set Object Values : FileNumber : ##newfile
    02d : Set Target : .
    01d : Accept Alter
    06 : Endwalk
     


  4. AMIT JALAN

    AMIT JALAN Member


    How did you get the Index Number of a particular item from the collection?
     
    Last edited: Mar 21, 2024


  5. AMIT JALAN

    AMIT JALAN Member


    There is a minor correction required in your function (Label: 01b). Please try.

    Code:
    [Function : updateFileNumber]
    Parameter : index : String
    Parameter : newfile : String
    01 : Walk Collection : FilteredSalesmanCollection
    01a : Set Object :
    01c : Set Target
    ;;01b : Set Object Values : FileNumber : ##newfile ;; Wrong
    01b : Set Values : FileNumber : ##newfile
    ;;02d : Set Target : .
    02d : Set Target : ..
    01d : Accept Alter
    06 : Endwalk
     


Share This Page