How to count the Column value rows where Value is "Yes"

Discussion in 'Free Source Codes' started by ABDUL AZIZ, Jun 18, 2019.

    
  1. ABDUL AZIZ

    ABDUL AZIZ Member


    Dear Experts,

    I have a report in which there is a column which has a value of Yes or No.

    I want to count the value Column rows where Value is "Yes"

    Please let me know how to do?

    Thanks & Regards,
     


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    As in Excel and other such softwares, you cannot Total on anything other than Numerical values. So Tally is no different in following the same logic.

    However, you can make one more column to right/left of your column (and make it invisible)....... in that you make a conditional formula.... If yes then 1 else 0, then total up that column values at the bottom. You can refer to this totalled value in your main column of Yes/No.

    You gotta think "out of the box" :)
     


  3. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Another way is to make a Function, where the counter will increment by 1 for every "yes" it founds. But function is beyond my talents, knowledge and skills. :)
     


  4. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir,

    I have made the below function, which counts the total entries/row and displays in message.



    [Function: EntryCounterYes]
    Variable : TotalEntries : Number
    Variable : Count : Number

    100 : Set : TotalEntries : $$NumItems:FranchiseeDetailReportCollection
    110 : Walk Collection : FranchiseeDetailReportCollection
    111 : If : Not $$IsEmpty:$FraStatus
    120 : Increment : Count
    121 : END IF
    130: End Walk
    131 : Msg Box : "Total No. of Entries as Yes" : ##Count


    [Button :ActiveFra]
    Title :"Active Fra"
    Key :Alt+Z
    Action : Call: EntryCounterYes


    But I want to count only those rows which contains Yes in $FraStatus. Like instead of Not $$Empty:$FraStatus I want do :$FraStatus Contains Yes or $FraStatus=Yes.

    I don't know how to do that, please help..

    Regards,

    Error message by Tally.JPG
     


  5. Jay kumar tailor

    Jay kumar tailor Well-Known Member


    Take a field for it instead of button or walk
     


  6. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir, I am new to code , I don't know how to do ? please do it for me if possible...
     


  7. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir,

    please have a look at the below code, it is working, but instead of all the row I want only Yes rows count, Can i Add some formula here and how?

    Local : Field : FraStatus : Set As : $$NumItems:FranchiseeDetailReportCollection

    but i want to add @@YesCount formula.

    Regards,
    Error message by Tally.JPG
     


  8. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Do it the way you have written.....either of the condition will work.............
     


  9. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir, I don't know how to join formula with collection like..

    Local : Field : FraStatus : Set As : $$NumItems:FranchiseeDetailReportCollection:mad:@YesCount

    is it correct?
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    You have made a function on your own, yet you are stuck at a simple thing? Have you written the code or is it from someone else?

    Try making little steps on your own..... else you will not learn.
     


  11. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir,

    Initially it was copied but now I understand that code and have done modifications accordingly..
    but
    Mr. Jay says use field instead of functions and it is working fine with collection, it is only one line code
    but
    I am not able apply filter when i apply filter collection, result shows nothing.
    What i could understand that either the way i am trying to use formula is incorrect or my complete approach is wrong.

    Please help...
     


  12. ABDUL AZIZ

    ABDUL AZIZ Member


    Sir,

    Since original collection contains both Yes and No entries, so i created new collection and used filter for Yes entries and it is working fine, but I know that this is now the right way, there must be some simpler way to do it.

    Local : Field : FraStatus : Set As : $$NumItems:FranchiseeDetailReportCollectionYesCount

    original collection with yes and know
    [Collection:FranchiseeDetailReportCollection]

    Type : Ledger
    Filter : ForFra
    Sort : Default : -$FraLedStatus, $FraLedAgrEndDate, $FraLedName
    Search Key : $FRALedCode
    Fetch : *.*

    New collection to count yes
    [Collection:FranchiseeDetailReportCollectionYesCount]

    Type : Ledger
    Filter : YesCount
    Sort : Default : -$FraLedStatus, $FraLedAgrEndDate, $FraLedName
    Search Key : $FRALedCode
    Fetch : *.*


    [System: Formula]

    ForFra : $FRALedCode <> ""
    YesCount : $FraLedStatus = Yes

    Regards,
    Error message by Tally.JPG
     


  13. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    There are multiple ways to do things..... if your end result is achieved then it is right......
     


Share This Page